Adding class meta-data attributes.
[PyCIM.git] / schemata / CIM14 / IEC61970 / Core / SubGeographicalRegion.py
blob2bb3cfa6c6cc981495baca7be2afd15714c9b661
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 SubGeographicalRegion(IdentifiedObject):
20 """A subset of a geographical region of a power system network model.
21 """
23 def __init__(self, Region=None, Substations=None, Lines=None, *args, **kw_args):
24 """Initialises a new 'SubGeographicalRegion' instance.
26 @param Region: The association is used in the naming hierarchy.
27 @param Substations: The association is used in the naming hierarchy.
28 @param Lines: A Line can be contained by a SubGeographical Region.
29 """
30 self._Region = None
31 self.Region = Region
33 self._Substations = []
34 self.Substations = [] if Substations is None else Substations
36 self._Lines = []
37 self.Lines = [] if Lines is None else Lines
39 super(SubGeographicalRegion, self).__init__(*args, **kw_args)
41 _attrs = []
42 _attr_types = {}
43 _defaults = {}
44 _enums = {}
45 _refs = ["Region", "Substations", "Lines"]
46 _many_refs = ["Substations", "Lines"]
48 def getRegion(self):
49 """The association is used in the naming hierarchy.
50 """
51 return self._Region
53 def setRegion(self, value):
54 if self._Region is not None:
55 filtered = [x for x in self.Region.Regions if x != self]
56 self._Region._Regions = filtered
58 self._Region = value
59 if self._Region is not None:
60 self._Region._Regions.append(self)
62 Region = property(getRegion, setRegion)
64 def getSubstations(self):
65 """The association is used in the naming hierarchy.
66 """
67 return self._Substations
69 def setSubstations(self, value):
70 for x in self._Substations:
71 x._Region = None
72 for y in value:
73 y._Region = self
74 self._Substations = value
76 Substations = property(getSubstations, setSubstations)
78 def addSubstations(self, *Substations):
79 for obj in Substations:
80 obj._Region = self
81 self._Substations.append(obj)
83 def removeSubstations(self, *Substations):
84 for obj in Substations:
85 obj._Region = None
86 self._Substations.remove(obj)
88 def getLines(self):
89 """A Line can be contained by a SubGeographical Region.
90 """
91 return self._Lines
93 def setLines(self, value):
94 for x in self._Lines:
95 x._Region = None
96 for y in value:
97 y._Region = self
98 self._Lines = value
100 Lines = property(getLines, setLines)
102 def addLines(self, *Lines):
103 for obj in Lines:
104 obj._Region = self
105 self._Lines.append(obj)
107 def removeLines(self, *Lines):
108 for obj in Lines:
109 obj._Region = None
110 self._Lines.remove(obj)