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 SlotReference(IdentifiedObject
):
24 """The specific role the block usage is playing in a connection frame. This allows connections to be established at the meta dynamics level and not at the instance level.
27 def __init__(self
, slot0
=None, block0
=None, compositeModel0
=None, *args
, **kw_args
):
28 """Initialises a new 'SlotReference' instance.
32 @param compositeModel0:
38 self
.block0
= [] if block0
is None else block0
40 self
._compositeModel
0 = []
41 self
.compositeModel0
= [] if compositeModel0
is None else compositeModel0
43 super(SlotReference
, self
).__init
__(*args
, **kw_args
)
49 _refs
= ["slot0", "block0", "compositeModel0"]
50 _many_refs
= ["block0", "compositeModel0"]
56 def setslot0(self
, value
):
57 if self
._slot
0 is not None:
58 filtered
= [x
for x
in self
.slot0
.slotReference0
if x
!= self
]
59 self
._slot
0._slotReference
0 = filtered
62 if self
._slot
0 is not None:
63 if self
not in self
._slot
0._slotReference
0:
64 self
._slot
0._slotReference
0.append(self
)
66 slot0
= property(getslot0
, setslot0
)
72 def setblock0(self
, value
):
73 for x
in self
._block
0:
74 x
.slotReference0
= None
76 y
._slotReference
0 = self
79 block0
= property(getblock0
, setblock0
)
81 def addblock0(self
, *block0
):
83 obj
.slotReference0
= self
85 def removeblock0(self
, *block0
):
87 obj
.slotReference0
= None
89 def getcompositeModel0(self
):
91 return self
._compositeModel
0
93 def setcompositeModel0(self
, value
):
94 for p
in self
._compositeModel
0:
95 filtered
= [q
for q
in p
.slotReference0
if q
!= self
]
96 self
._compositeModel
0._slotReference
0 = filtered
98 if self
not in r
._slotReference
0:
99 r
._slotReference
0.append(self
)
100 self
._compositeModel
0 = value
102 compositeModel0
= property(getcompositeModel0
, setcompositeModel0
)
104 def addcompositeModel0(self
, *compositeModel0
):
105 for obj
in compositeModel0
:
106 if self
not in obj
._slotReference
0:
107 obj
._slotReference
0.append(self
)
108 self
._compositeModel
0.append(obj
)
110 def removecompositeModel0(self
, *compositeModel0
):
111 for obj
in compositeModel0
:
112 if self
in obj
._slotReference
0:
113 obj
._slotReference
0.remove(self
)
114 self
._compositeModel
0.remove(obj
)