Update README.rst
[PyCIM.git] / CIM14 / IEC61970 / Informative / InfCore / ModelingAuthoritySet.py
blobf649c50bc622395e4389cff7de3824e6773cc1c4
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 ModelingAuthoritySet(IdentifiedObject):
24 """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.
25 """
27 def __init__(self, ModelingAuthority=None, IdentifiedObjects=None, *args, **kw_args):
28 """Initialises a new 'ModelingAuthoritySet' instance.
30 @param ModelingAuthority: A Modeling Authority set supplies and maintains the data for the objects in a Modeling Authority Set.
31 @param IdentifiedObjects: An IdentifiedObject belongs to a Modeling Authority Set for purposes of defining a group of data maintained by the same Modeling Authority.
32 """
33 self._ModelingAuthority = None
34 self.ModelingAuthority = ModelingAuthority
36 self._IdentifiedObjects = []
37 self.IdentifiedObjects = [] if IdentifiedObjects is None else IdentifiedObjects
39 super(ModelingAuthoritySet, self).__init__(*args, **kw_args)
41 _attrs = []
42 _attr_types = {}
43 _defaults = {}
44 _enums = {}
45 _refs = ["ModelingAuthority", "IdentifiedObjects"]
46 _many_refs = ["IdentifiedObjects"]
48 def getModelingAuthority(self):
49 """A Modeling Authority set supplies and maintains the data for the objects in a Modeling Authority Set.
50 """
51 return self._ModelingAuthority
53 def setModelingAuthority(self, value):
54 if self._ModelingAuthority is not None:
55 filtered = [x for x in self.ModelingAuthority.ModelingAuthoritySets if x != self]
56 self._ModelingAuthority._ModelingAuthoritySets = filtered
58 self._ModelingAuthority = value
59 if self._ModelingAuthority is not None:
60 if self not in self._ModelingAuthority._ModelingAuthoritySets:
61 self._ModelingAuthority._ModelingAuthoritySets.append(self)
63 ModelingAuthority = property(getModelingAuthority, setModelingAuthority)
65 def getIdentifiedObjects(self):
66 """An IdentifiedObject belongs to a Modeling Authority Set for purposes of defining a group of data maintained by the same Modeling Authority.
67 """
68 return self._IdentifiedObjects
70 def setIdentifiedObjects(self, value):
71 for x in self._IdentifiedObjects:
72 x.ModelingAuthoritySet = None
73 for y in value:
74 y._ModelingAuthoritySet = self
75 self._IdentifiedObjects = value
77 IdentifiedObjects = property(getIdentifiedObjects, setIdentifiedObjects)
79 def addIdentifiedObjects(self, *IdentifiedObjects):
80 for obj in IdentifiedObjects:
81 obj.ModelingAuthoritySet = self
83 def removeIdentifiedObjects(self, *IdentifiedObjects):
84 for obj in IdentifiedObjects:
85 obj.ModelingAuthoritySet = None