Adding class meta-data attributes.
[PyCIM.git] / schemata / CIM14 / IEC61970 / Core / PsrList.py
blob2b2d7f06a2e2ef76351d902a717ed6c31638510b
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 PsrList(IdentifiedObject):
20 """Arbitrary list of PowerSystemResources. Can be used for various purposes, including grouping for report generation.
21 """
23 def __init__(self, typePSRList='', PowerSystemResources=None, *args, **kw_args):
24 """Initialises a new 'PsrList' instance.
26 @param typePSRList: Type of power system resources in this list.
27 @param PowerSystemResources:
28 """
29 #: Type of power system resources in this list.
30 self.typePSRList = typePSRList
32 self._PowerSystemResources = []
33 self.PowerSystemResources = [] if PowerSystemResources is None else PowerSystemResources
35 super(PsrList, self).__init__(*args, **kw_args)
37 _attrs = ["typePSRList"]
38 _attr_types = {"typePSRList": str}
39 _defaults = {"typePSRList": ''}
40 _enums = {}
41 _refs = ["PowerSystemResources"]
42 _many_refs = ["PowerSystemResources"]
44 def getPowerSystemResources(self):
46 return self._PowerSystemResources
48 def setPowerSystemResources(self, value):
49 for p in self._PowerSystemResources:
50 filtered = [q for q in p.PsrLists if q != self]
51 self._PowerSystemResources._PsrLists = filtered
52 for r in value:
53 if self not in r._PsrLists:
54 r._PsrLists.append(self)
55 self._PowerSystemResources = value
57 PowerSystemResources = property(getPowerSystemResources, setPowerSystemResources)
59 def addPowerSystemResources(self, *PowerSystemResources):
60 for obj in PowerSystemResources:
61 if self not in obj._PsrLists:
62 obj._PsrLists.append(self)
63 self._PowerSystemResources.append(obj)
65 def removePowerSystemResources(self, *PowerSystemResources):
66 for obj in PowerSystemResources:
67 if self in obj._PsrLists:
68 obj._PsrLists.remove(self)
69 self._PowerSystemResources.remove(obj)