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 MetaBlockSignal(IdentifiedObject
):
25 def __init__(self
, metaBlockSignal1
=None, metaBlockSignal
=None, MemberOf_MetaBlock
=None, From
=None, To
=None, *args
, **kw_args
):
26 """Initialises a new 'MetaBlockSignal' instance.
28 @param metaBlockSignal1:
29 @param metaBlockSignal:
30 @param MemberOf_MetaBlock:
34 self
._metaBlockSignal
1 = []
35 self
.metaBlockSignal1
= [] if metaBlockSignal1
is None else metaBlockSignal1
37 self
._metaBlockSignal
= []
38 self
.metaBlockSignal
= [] if metaBlockSignal
is None else metaBlockSignal
40 self
._MemberOf
_MetaBlock
= None
41 self
.MemberOf_MetaBlock
= MemberOf_MetaBlock
49 super(MetaBlockSignal
, self
).__init
__(*args
, **kw_args
)
55 _refs
= ["metaBlockSignal1", "metaBlockSignal", "MemberOf_MetaBlock", "From", "To"]
56 _many_refs
= ["metaBlockSignal1", "metaBlockSignal"]
58 def getmetaBlockSignal1(self
):
60 return self
._metaBlockSignal
1
62 def setmetaBlockSignal1(self
, value
):
63 for p
in self
._metaBlockSignal
1:
64 filtered
= [q
for q
in p
.metaBlockSignal
if q
!= self
]
65 self
._metaBlockSignal
1._metaBlockSignal
= filtered
67 if self
not in r
._metaBlockSignal
:
68 r
._metaBlockSignal
.append(self
)
69 self
._metaBlockSignal
1 = value
71 metaBlockSignal1
= property(getmetaBlockSignal1
, setmetaBlockSignal1
)
73 def addmetaBlockSignal1(self
, *metaBlockSignal1
):
74 for obj
in metaBlockSignal1
:
75 if self
not in obj
._metaBlockSignal
:
76 obj
._metaBlockSignal
.append(self
)
77 self
._metaBlockSignal
1.append(obj
)
79 def removemetaBlockSignal1(self
, *metaBlockSignal1
):
80 for obj
in metaBlockSignal1
:
81 if self
in obj
._metaBlockSignal
:
82 obj
._metaBlockSignal
.remove(self
)
83 self
._metaBlockSignal
1.remove(obj
)
85 def getmetaBlockSignal(self
):
87 return self
._metaBlockSignal
89 def setmetaBlockSignal(self
, value
):
90 for p
in self
._metaBlockSignal
:
91 filtered
= [q
for q
in p
.metaBlockSignal1
if q
!= self
]
92 self
._metaBlockSignal
._metaBlockSignal
1 = filtered
94 if self
not in r
._metaBlockSignal
1:
95 r
._metaBlockSignal
1.append(self
)
96 self
._metaBlockSignal
= value
98 metaBlockSignal
= property(getmetaBlockSignal
, setmetaBlockSignal
)
100 def addmetaBlockSignal(self
, *metaBlockSignal
):
101 for obj
in metaBlockSignal
:
102 if self
not in obj
._metaBlockSignal
1:
103 obj
._metaBlockSignal
1.append(self
)
104 self
._metaBlockSignal
.append(obj
)
106 def removemetaBlockSignal(self
, *metaBlockSignal
):
107 for obj
in metaBlockSignal
:
108 if self
in obj
._metaBlockSignal
1:
109 obj
._metaBlockSignal
1.remove(self
)
110 self
._metaBlockSignal
.remove(obj
)
112 def getMemberOf_MetaBlock(self
):
114 return self
._MemberOf
_MetaBlock
116 def setMemberOf_MetaBlock(self
, value
):
117 if self
._MemberOf
_MetaBlock
is not None:
118 filtered
= [x
for x
in self
.MemberOf_MetaBlock
.MetaBlockSignal
if x
!= self
]
119 self
._MemberOf
_MetaBlock
._MetaBlockSignal
= filtered
121 self
._MemberOf
_MetaBlock
= value
122 if self
._MemberOf
_MetaBlock
is not None:
123 if self
not in self
._MemberOf
_MetaBlock
._MetaBlockSignal
:
124 self
._MemberOf
_MetaBlock
._MetaBlockSignal
.append(self
)
126 MemberOf_MetaBlock
= property(getMemberOf_MetaBlock
, setMemberOf_MetaBlock
)
132 def setFrom(self
, value
):
133 if self
._From
is not None:
134 self
._From
._MetaBlockSignal
= None
137 if self
._From
is not None:
138 self
._From
.MetaBlockSignal
= None
139 self
._From
._MetaBlockSignal
= self
141 From
= property(getFrom
, setFrom
)
147 def setTo(self
, value
):
148 if self
._To
is not None:
149 filtered
= [x
for x
in self
.To
.MetaBlockSignal
if x
!= self
]
150 self
._To
._MetaBlockSignal
= filtered
153 if self
._To
is not None:
154 if self
not in self
._To
._MetaBlockSignal
:
155 self
._To
._MetaBlockSignal
.append(self
)
157 To
= property(getTo
, setTo
)