source: mauRepo/MolesManager/trunk/src/ea_model/iso_19130_sensor_data/parameter_model/sd_group.py @ 8197

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/mauRepo/MolesManager/trunk/src/ea_model/iso_19130_sensor_data/parameter_model/sd_group.py@8197
Revision 8197, 2.5 KB checked in by mnagni, 8 years ago (diff)

New database schema where URL class is a string and MO_Project.subProject use CEDA_Project as subType

Line 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21from ascore.utils import has_value, collectionProofHash
22
23'''
24Created on 30-Mar-2012 16:45:24
25
26@author: mnagni
27'''
28
29class SD_Group(object):
30    '''
31        Represents a data entity defined in a UML diagram and supposed to
32        be persisted in a relational database.
33 
34        This class has been genererated automatically using the Apache Velocity project.
35    '''
36    '''
37        Please note that any access to the inner attributes should be done using
38        the given get/set methods and NOT accessing them directly.
39    '''
40    def __init__(self):
41
42        self.fieldOfView = None
43        self.subGroupTime = None
44        self.lineParameters = []
45        self.lowFrequencyScanDirection = None
46        self.isAGroupOf = []
47        self.lowFequencyScanSize = None
48        self._intraSubGroupTime_tm_periodduration = None
49        self._intraSubGroupTime_tm_intervallength = None
50        self.groupIdentifier = None
51        super(SD_Group, self).__init__()
52
53    @property
54    def intraSubGroupTime(self):       
55        if(has_value(self._intraSubGroupTime_tm_periodduration)):
56            return self._intraSubGroupTime_tm_periodduration
57        if(has_value(self._intraSubGroupTime_tm_intervallength)):
58            return self._intraSubGroupTime_tm_intervallength
59        return  None
60
61    @intraSubGroupTime.setter
62    def intraSubGroupTime(self, value): 
63        valueClass = "%s.%s" % (type(value).__module__,type(value).__name__)
64        if valueClass == "ea_model.iso_19108_2006_temporal_schema.temporal_objects.tm_periodduration.TM_PeriodDuration":
65            self._intraSubGroupTime_tm_periodduration = value
66            self._intraSubGroupTime_tm_intervallength = None
67        if valueClass == "ea_model.iso_19108_2006_temporal_schema.temporal_objects.tm_intervallength.TM_IntervalLength":
68            self._intraSubGroupTime_tm_intervallength = value
69            self._intraSubGroupTime_tm_periodduration = None
70
71    def __key(self):
72        return (self.fieldOfView, self.subGroupTime, self.lineParameters, self.lowFrequencyScanDirection, self.isAGroupOf, self.lowFequencyScanSize, self.intraSubGroupTime, self.groupIdentifier)
73
74    def __eq__(self, y):
75        if type(self) != type(y):
76            return False
77        '''
78        Cannot compare classes which do not define a "__key" attribute
79        '''
80        if hasattr(self, '_%s__key' % (type(self).__name__)) and hasattr(y, '_%s__key' % (type(y).__name__)):
81            return self.__key() == y.__key()
82        return id(self) == id(y)
83
84    def __hash__(self):
85        return collectionProofHash(self.__key())
Note: See TracBrowser for help on using the repository browser.