Fixing one-to-many bidirectional references.
[PyCIM.git] / CIM14 / Dynamics / MetaBlockInputReference.py
blob7dcc36d830e6816107f47a2468a31db1400421c5
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 MetaBlockInputReference(IdentifiedObject):
21 def __init__(self, positiveFlowIn=False, StandardControlBlock_MetaBlockConnectable=None, MemberOf_MetaBlockReference=None, MetaBlockSignal=None, MetaBlockConnectable=None, *args, **kw_args):
22 """Initialises a new 'MetaBlockInputReference' instance.
24 @param positiveFlowIn: If true then any flows associated with a terminal are referenced as positive from the system into the device.
25 @param StandardControlBlock_MetaBlockConnectable:
26 @param MemberOf_MetaBlockReference:
27 @param MetaBlockSignal:
28 @param MetaBlockConnectable:
29 """
30 #: If true then any flows associated with a terminal are referenced as positive from the system into the device.
31 self.positiveFlowIn = positiveFlowIn
33 self._StandardControlBlock_MetaBlockConnectable = None
34 self.StandardControlBlock_MetaBlockConnectable = StandardControlBlock_MetaBlockConnectable
36 self._MemberOf_MetaBlockReference = None
37 self.MemberOf_MetaBlockReference = MemberOf_MetaBlockReference
39 self._MetaBlockSignal = None
40 self.MetaBlockSignal = MetaBlockSignal
42 self._MetaBlockConnectable = None
43 self.MetaBlockConnectable = MetaBlockConnectable
45 super(MetaBlockInputReference, self).__init__(*args, **kw_args)
47 _attrs = ["positiveFlowIn"]
48 _attr_types = {"positiveFlowIn": bool}
49 _defaults = {"positiveFlowIn": False}
50 _enums = {}
51 _refs = ["StandardControlBlock_MetaBlockConnectable", "MemberOf_MetaBlockReference", "MetaBlockSignal", "MetaBlockConnectable"]
52 _many_refs = []
54 def getStandardControlBlock_MetaBlockConnectable(self):
56 return self._StandardControlBlock_MetaBlockConnectable
58 def setStandardControlBlock_MetaBlockConnectable(self, value):
59 if self._StandardControlBlock_MetaBlockConnectable is not None:
60 filtered = [x for x in self.StandardControlBlock_MetaBlockConnectable.StandardControlBlock_MetaBlockInputReference if x != self]
61 self._StandardControlBlock_MetaBlockConnectable._StandardControlBlock_MetaBlockInputReference = filtered
63 self._StandardControlBlock_MetaBlockConnectable = value
64 if self._StandardControlBlock_MetaBlockConnectable is not None:
65 if self not in self._StandardControlBlock_MetaBlockConnectable._StandardControlBlock_MetaBlockInputReference:
66 self._StandardControlBlock_MetaBlockConnectable._StandardControlBlock_MetaBlockInputReference.append(self)
68 StandardControlBlock_MetaBlockConnectable = property(getStandardControlBlock_MetaBlockConnectable, setStandardControlBlock_MetaBlockConnectable)
70 def getMemberOf_MetaBlockReference(self):
72 return self._MemberOf_MetaBlockReference
74 def setMemberOf_MetaBlockReference(self, value):
75 if self._MemberOf_MetaBlockReference is not None:
76 filtered = [x for x in self.MemberOf_MetaBlockReference.MetaBlockInputReference if x != self]
77 self._MemberOf_MetaBlockReference._MetaBlockInputReference = filtered
79 self._MemberOf_MetaBlockReference = value
80 if self._MemberOf_MetaBlockReference is not None:
81 if self not in self._MemberOf_MetaBlockReference._MetaBlockInputReference:
82 self._MemberOf_MetaBlockReference._MetaBlockInputReference.append(self)
84 MemberOf_MetaBlockReference = property(getMemberOf_MetaBlockReference, setMemberOf_MetaBlockReference)
86 def getMetaBlockSignal(self):
88 return self._MetaBlockSignal
90 def setMetaBlockSignal(self, value):
91 if self._MetaBlockSignal is not None:
92 self._MetaBlockSignal._From = None
94 self._MetaBlockSignal = value
95 if self._MetaBlockSignal is not None:
96 self._MetaBlockSignal.From = None
97 self._MetaBlockSignal._From = self
99 MetaBlockSignal = property(getMetaBlockSignal, setMetaBlockSignal)
101 def getMetaBlockConnectable(self):
103 return self._MetaBlockConnectable
105 def setMetaBlockConnectable(self, value):
106 if self._MetaBlockConnectable is not None:
107 filtered = [x for x in self.MetaBlockConnectable.MetaBlockInputReference if x != self]
108 self._MetaBlockConnectable._MetaBlockInputReference = filtered
110 self._MetaBlockConnectable = value
111 if self._MetaBlockConnectable is not None:
112 if self not in self._MetaBlockConnectable._MetaBlockInputReference:
113 self._MetaBlockConnectable._MetaBlockInputReference.append(self)
115 MetaBlockConnectable = property(getMetaBlockConnectable, setMetaBlockConnectable)