Implementing RDF/XML serialisation using meta-data attributes.
[PyCIM.git] / schemata / CIM14 / Dynamics / SlotReference.py
blob234c0e28acde32903713eb763bd74a05b4f706ae
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 SlotReference(IdentifiedObject):
20 """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.
21 """
23 def __init__(self, slot0=None, block0=None, compositeModel0=None, *args, **kw_args):
24 """Initialises a new 'SlotReference' instance.
26 @param slot0:
27 @param block0:
28 @param compositeModel0:
29 """
30 self._slot0 = None
31 self.slot0 = slot0
33 self._block0 = []
34 self.block0 = [] if block0 is None else block0
36 self._compositeModel0 = []
37 self.compositeModel0 = [] if compositeModel0 is None else compositeModel0
39 super(SlotReference, self).__init__(*args, **kw_args)
41 _attrs = []
42 _attr_types = {}
43 _defaults = {}
44 _enums = {}
45 _refs = ["slot0", "block0", "compositeModel0"]
46 _many_refs = ["block0", "compositeModel0"]
48 def getslot0(self):
50 return self._slot0
52 def setslot0(self, value):
53 if self._slot0 is not None:
54 filtered = [x for x in self.slot0.slotReference0 if x != self]
55 self._slot0._slotReference0 = filtered
57 self._slot0 = value
58 if self._slot0 is not None:
59 self._slot0._slotReference0.append(self)
61 slot0 = property(getslot0, setslot0)
63 def getblock0(self):
65 return self._block0
67 def setblock0(self, value):
68 for x in self._block0:
69 x._slotReference0 = None
70 for y in value:
71 y._slotReference0 = self
72 self._block0 = value
74 block0 = property(getblock0, setblock0)
76 def addblock0(self, *block0):
77 for obj in block0:
78 obj._slotReference0 = self
79 self._block0.append(obj)
81 def removeblock0(self, *block0):
82 for obj in block0:
83 obj._slotReference0 = None
84 self._block0.remove(obj)
86 def getcompositeModel0(self):
88 return self._compositeModel0
90 def setcompositeModel0(self, value):
91 for p in self._compositeModel0:
92 filtered = [q for q in p.slotReference0 if q != self]
93 self._compositeModel0._slotReference0 = filtered
94 for r in value:
95 if self not in r._slotReference0:
96 r._slotReference0.append(self)
97 self._compositeModel0 = value
99 compositeModel0 = property(getcompositeModel0, setcompositeModel0)
101 def addcompositeModel0(self, *compositeModel0):
102 for obj in compositeModel0:
103 if self not in obj._slotReference0:
104 obj._slotReference0.append(self)
105 self._compositeModel0.append(obj)
107 def removecompositeModel0(self, *compositeModel0):
108 for obj in compositeModel0:
109 if self in obj._slotReference0:
110 obj._slotReference0.remove(self)
111 self._compositeModel0.remove(obj)