Fixing website and API documentation links
[PyCIM.git] / CIM14 / IEC61970 / Dynamics / SlotReference.py
blob3940b5afd3cdebabe21ac16f808a3a7f5ca540c3
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
19 # IN THE SOFTWARE.
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.
25 """
27 def __init__(self, slot0=None, block0=None, compositeModel0=None, *args, **kw_args):
28 """Initialises a new 'SlotReference' instance.
30 @param slot0:
31 @param block0:
32 @param compositeModel0:
33 """
34 self._slot0 = None
35 self.slot0 = slot0
37 self._block0 = []
38 self.block0 = [] if block0 is None else block0
40 self._compositeModel0 = []
41 self.compositeModel0 = [] if compositeModel0 is None else compositeModel0
43 super(SlotReference, self).__init__(*args, **kw_args)
45 _attrs = []
46 _attr_types = {}
47 _defaults = {}
48 _enums = {}
49 _refs = ["slot0", "block0", "compositeModel0"]
50 _many_refs = ["block0", "compositeModel0"]
52 def getslot0(self):
54 return self._slot0
56 def setslot0(self, value):
57 if self._slot0 is not None:
58 filtered = [x for x in self.slot0.slotReference0 if x != self]
59 self._slot0._slotReference0 = filtered
61 self._slot0 = value
62 if self._slot0 is not None:
63 if self not in self._slot0._slotReference0:
64 self._slot0._slotReference0.append(self)
66 slot0 = property(getslot0, setslot0)
68 def getblock0(self):
70 return self._block0
72 def setblock0(self, value):
73 for x in self._block0:
74 x.slotReference0 = None
75 for y in value:
76 y._slotReference0 = self
77 self._block0 = value
79 block0 = property(getblock0, setblock0)
81 def addblock0(self, *block0):
82 for obj in block0:
83 obj.slotReference0 = self
85 def removeblock0(self, *block0):
86 for obj in block0:
87 obj.slotReference0 = None
89 def getcompositeModel0(self):
91 return self._compositeModel0
93 def setcompositeModel0(self, value):
94 for p in self._compositeModel0:
95 filtered = [q for q in p.slotReference0 if q != self]
96 self._compositeModel0._slotReference0 = filtered
97 for r in value:
98 if self not in r._slotReference0:
99 r._slotReference0.append(self)
100 self._compositeModel0 = value
102 compositeModel0 = property(getcompositeModel0, setcompositeModel0)
104 def addcompositeModel0(self, *compositeModel0):
105 for obj in compositeModel0:
106 if self not in obj._slotReference0:
107 obj._slotReference0.append(self)
108 self._compositeModel0.append(obj)
110 def removecompositeModel0(self, *compositeModel0):
111 for obj in compositeModel0:
112 if self in obj._slotReference0:
113 obj._slotReference0.remove(self)
114 self._compositeModel0.remove(obj)