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 BlockConnectivity(IdentifiedObject
):
24 """A instance definition of connectivity of BlockUsage objects as defined in a a BlockConnection within the dyanmics-meta-model.
27 def __init__(self
, MetaBlockConnectivity
=None, Block
=None, BlockConnection
=None, *args
, **kw_args
):
28 """Initialises a new 'BlockConnectivity' instance.
30 @param MetaBlockConnectivity:
32 @param BlockConnection:
34 self
._MetaBlockConnectivity
= None
35 self
.MetaBlockConnectivity
= MetaBlockConnectivity
38 self
.Block
= [] if Block
is None else Block
40 self
._BlockConnection
= []
41 self
.BlockConnection
= [] if BlockConnection
is None else BlockConnection
43 super(BlockConnectivity
, self
).__init
__(*args
, **kw_args
)
49 _refs
= ["MetaBlockConnectivity", "Block", "BlockConnection"]
50 _many_refs
= ["Block", "BlockConnection"]
52 def getMetaBlockConnectivity(self
):
54 return self
._MetaBlockConnectivity
56 def setMetaBlockConnectivity(self
, value
):
57 if self
._MetaBlockConnectivity
is not None:
58 filtered
= [x
for x
in self
.MetaBlockConnectivity
.BlockConnectivity
if x
!= self
]
59 self
._MetaBlockConnectivity
._BlockConnectivity
= filtered
61 self
._MetaBlockConnectivity
= value
62 if self
._MetaBlockConnectivity
is not None:
63 if self
not in self
._MetaBlockConnectivity
._BlockConnectivity
:
64 self
._MetaBlockConnectivity
._BlockConnectivity
.append(self
)
66 MetaBlockConnectivity
= property(getMetaBlockConnectivity
, setMetaBlockConnectivity
)
72 def setBlock(self
, value
):
74 x
.MemberOf_BlockConnectivity
= None
76 y
._MemberOf
_BlockConnectivity
= self
79 Block
= property(getBlock
, setBlock
)
81 def addBlock(self
, *Block
):
83 obj
.MemberOf_BlockConnectivity
= self
85 def removeBlock(self
, *Block
):
87 obj
.MemberOf_BlockConnectivity
= None
89 def getBlockConnection(self
):
91 return self
._BlockConnection
93 def setBlockConnection(self
, value
):
94 for x
in self
._BlockConnection
:
95 x
.MemberOf_BlockConnectivity
= None
97 y
._MemberOf
_BlockConnectivity
= self
98 self
._BlockConnection
= value
100 BlockConnection
= property(getBlockConnection
, setBlockConnection
)
102 def addBlockConnection(self
, *BlockConnection
):
103 for obj
in BlockConnection
:
104 obj
.MemberOf_BlockConnectivity
= self
106 def removeBlockConnection(self
, *BlockConnection
):
107 for obj
in BlockConnection
:
108 obj
.MemberOf_BlockConnectivity
= None