1 # Copyright (C) 2010-2011 Richard Lincoln
3 # Permission is hereby granted, free of charge, to any person obtaining a copy
4 # of this software and associated documentation files (the "Software"), to
5 # deal in the Software without restriction, including without limitation the
6 # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
7 # sell copies of the Software, and to permit persons to whom the Software is
8 # furnished to do so, subject to the following conditions:
10 # The above copyright notice and this permission notice shall be included in
11 # all copies or substantial portions of the Software.
13 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
18 # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21 from CIM14
.IEC61970
.Core
.IdentifiedObject
import IdentifiedObject
23 class BlockConnection(IdentifiedObject
):
24 """A meta-dyanamics model connectivity specification.
27 def __init__(self
, MetaBlockConnection
=None, MemberOf_BlockConnectivity
=None, Block
=None, *args
, **kw_args
):
28 """Initialises a new 'BlockConnection' instance.
30 @param MetaBlockConnection:
31 @param MemberOf_BlockConnectivity:
34 self
._MetaBlockConnection
= None
35 self
.MetaBlockConnection
= MetaBlockConnection
37 self
._MemberOf
_BlockConnectivity
= None
38 self
.MemberOf_BlockConnectivity
= MemberOf_BlockConnectivity
43 super(BlockConnection
, self
).__init
__(*args
, **kw_args
)
49 _refs
= ["MetaBlockConnection", "MemberOf_BlockConnectivity", "Block"]
52 def getMetaBlockConnection(self
):
54 return self
._MetaBlockConnection
56 def setMetaBlockConnection(self
, value
):
57 if self
._MetaBlockConnection
is not None:
58 filtered
= [x
for x
in self
.MetaBlockConnection
.BlockConnection
if x
!= self
]
59 self
._MetaBlockConnection
._BlockConnection
= filtered
61 self
._MetaBlockConnection
= value
62 if self
._MetaBlockConnection
is not None:
63 if self
not in self
._MetaBlockConnection
._BlockConnection
:
64 self
._MetaBlockConnection
._BlockConnection
.append(self
)
66 MetaBlockConnection
= property(getMetaBlockConnection
, setMetaBlockConnection
)
68 def getMemberOf_BlockConnectivity(self
):
70 return self
._MemberOf
_BlockConnectivity
72 def setMemberOf_BlockConnectivity(self
, value
):
73 if self
._MemberOf
_BlockConnectivity
is not None:
74 filtered
= [x
for x
in self
.MemberOf_BlockConnectivity
.BlockConnection
if x
!= self
]
75 self
._MemberOf
_BlockConnectivity
._BlockConnection
= filtered
77 self
._MemberOf
_BlockConnectivity
= value
78 if self
._MemberOf
_BlockConnectivity
is not None:
79 if self
not in self
._MemberOf
_BlockConnectivity
._BlockConnection
:
80 self
._MemberOf
_BlockConnectivity
._BlockConnection
.append(self
)
82 MemberOf_BlockConnectivity
= property(getMemberOf_BlockConnectivity
, setMemberOf_BlockConnectivity
)
88 def setBlock(self
, value
):
89 if self
._Block
is not None:
90 filtered
= [x
for x
in self
.Block
.BlockConnection
if x
!= self
]
91 self
._Block
._BlockConnection
= filtered
94 if self
._Block
is not None:
95 if self
not in self
._Block
._BlockConnection
:
96 self
._Block
._BlockConnection
.append(self
)
98 Block
= property(getBlock
, setBlock
)