1 # Copyright (C) 2010 Richard Lincoln
3 # This library is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU Lesser General Public
5 # License as published by the Free Software Foundation; either
6 # version 2.1 of the License, or (at your option) any later version.
8 # This library is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 # Lesser General Public License for more details.
13 # You should have received a copy of the GNU Lesser General Public
14 # License along with this library; if not, write to the Free Software
15 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA, USA
17 from CIM14
.IEC61970
.Core
.IdentifiedObject
import IdentifiedObject
19 class BlockConnectivity(IdentifiedObject
):
20 """A instance definition of connectivity of BlockUsage objects as defined in a a BlockConnection within the dyanmics-meta-model.
23 def __init__(self
, MetaBlockConnectivity
=None, Block
=None, BlockConnection
=None, *args
, **kw_args
):
24 """Initialises a new 'BlockConnectivity' instance.
26 @param MetaBlockConnectivity:
28 @param BlockConnection:
30 self
._MetaBlockConnectivity
= None
31 self
.MetaBlockConnectivity
= MetaBlockConnectivity
34 self
.Block
= [] if Block
is None else Block
36 self
._BlockConnection
= []
37 self
.BlockConnection
= [] if BlockConnection
is None else BlockConnection
39 super(BlockConnectivity
, self
).__init
__(*args
, **kw_args
)
45 _refs
= ["MetaBlockConnectivity", "Block", "BlockConnection"]
46 _many_refs
= ["Block", "BlockConnection"]
48 def getMetaBlockConnectivity(self
):
50 return self
._MetaBlockConnectivity
52 def setMetaBlockConnectivity(self
, value
):
53 if self
._MetaBlockConnectivity
is not None:
54 filtered
= [x
for x
in self
.MetaBlockConnectivity
.BlockConnectivity
if x
!= self
]
55 self
._MetaBlockConnectivity
._BlockConnectivity
= filtered
57 self
._MetaBlockConnectivity
= value
58 if self
._MetaBlockConnectivity
is not None:
59 self
._MetaBlockConnectivity
._BlockConnectivity
.append(self
)
61 MetaBlockConnectivity
= property(getMetaBlockConnectivity
, setMetaBlockConnectivity
)
67 def setBlock(self
, value
):
69 x
._MemberOf
_BlockConnectivity
= None
71 y
._MemberOf
_BlockConnectivity
= self
74 Block
= property(getBlock
, setBlock
)
76 def addBlock(self
, *Block
):
78 obj
._MemberOf
_BlockConnectivity
= self
79 self
._Block
.append(obj
)
81 def removeBlock(self
, *Block
):
83 obj
._MemberOf
_BlockConnectivity
= None
84 self
._Block
.remove(obj
)
86 def getBlockConnection(self
):
88 return self
._BlockConnection
90 def setBlockConnection(self
, value
):
91 for x
in self
._BlockConnection
:
92 x
._MemberOf
_BlockConnectivity
= None
94 y
._MemberOf
_BlockConnectivity
= self
95 self
._BlockConnection
= value
97 BlockConnection
= property(getBlockConnection
, setBlockConnection
)
99 def addBlockConnection(self
, *BlockConnection
):
100 for obj
in BlockConnection
:
101 obj
._MemberOf
_BlockConnectivity
= self
102 self
._BlockConnection
.append(obj
)
104 def removeBlockConnection(self
, *BlockConnection
):
105 for obj
in BlockConnection
:
106 obj
._MemberOf
_BlockConnectivity
= None
107 self
._BlockConnection
.remove(obj
)