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 ModelingAuthoritySet(IdentifiedObject
):
20 """A Modeling Authority Set is a group of objects in a network model where the data is supplied and maintained by the same Modeling Authority.
23 def __init__(self
, ModelingAuthority
=None, IdentifiedObjects
=None, *args
, **kw_args
):
24 """Initialises a new 'ModelingAuthoritySet' instance.
26 @param ModelingAuthority: A Modeling Authority set supplies and maintains the data for the objects in a Modeling Authority Set.
27 @param IdentifiedObjects: An IdentifiedObject belongs to a Modeling Authority Set for purposes of defining a group of data maintained by the same Modeling Authority.
29 self
._ModelingAuthority
= None
30 self
.ModelingAuthority
= ModelingAuthority
32 self
._IdentifiedObjects
= []
33 self
.IdentifiedObjects
= [] if IdentifiedObjects
is None else IdentifiedObjects
35 super(ModelingAuthoritySet
, self
).__init
__(*args
, **kw_args
)
41 _refs
= ["ModelingAuthority", "IdentifiedObjects"]
42 _many_refs
= ["IdentifiedObjects"]
44 def getModelingAuthority(self
):
45 """A Modeling Authority set supplies and maintains the data for the objects in a Modeling Authority Set.
47 return self
._ModelingAuthority
49 def setModelingAuthority(self
, value
):
50 if self
._ModelingAuthority
is not None:
51 filtered
= [x
for x
in self
.ModelingAuthority
.ModelingAuthoritySets
if x
!= self
]
52 self
._ModelingAuthority
._ModelingAuthoritySets
= filtered
54 self
._ModelingAuthority
= value
55 if self
._ModelingAuthority
is not None:
56 self
._ModelingAuthority
._ModelingAuthoritySets
.append(self
)
58 ModelingAuthority
= property(getModelingAuthority
, setModelingAuthority
)
60 def getIdentifiedObjects(self
):
61 """An IdentifiedObject belongs to a Modeling Authority Set for purposes of defining a group of data maintained by the same Modeling Authority.
63 return self
._IdentifiedObjects
65 def setIdentifiedObjects(self
, value
):
66 for x
in self
._IdentifiedObjects
:
67 x
._ModelingAuthoritySet
= None
69 y
._ModelingAuthoritySet
= self
70 self
._IdentifiedObjects
= value
72 IdentifiedObjects
= property(getIdentifiedObjects
, setIdentifiedObjects
)
74 def addIdentifiedObjects(self
, *IdentifiedObjects
):
75 for obj
in IdentifiedObjects
:
76 obj
._ModelingAuthoritySet
= self
77 self
._IdentifiedObjects
.append(obj
)
79 def removeIdentifiedObjects(self
, *IdentifiedObjects
):
80 for obj
in IdentifiedObjects
:
81 obj
._ModelingAuthoritySet
= None
82 self
._IdentifiedObjects
.remove(obj
)