Ignore:
Timestamp:
13/03/12 13:32:01 (8 years ago)
Author:
mnagni
Message:

This new DB library adds better hash algorithm and a bug fix for the classes eq method

Location:
mauRepo/MolesManager/trunk/src/ea_model/iso_19129_2009_igcd/igcd_framework
Files:
20 edited

Legend:

Unmodified
Added
Removed
  • mauRepo/MolesManager/trunk/src/ea_model/iso_19129_2009_igcd/igcd_framework/if_aquisitionmetadata.py

    r8091 r8160  
    1919 
    2020 
    21 from ascore.utils import has_value 
     21from ascore.utils import has_value, collectionProofHash 
    2222 
    2323''' 
    24 Created on 16-Feb-2012 16:18:07 
     24Created on 13-Mar-2012 11:08:08 
    2525 
    2626@author: mnagni 
     
    4646 
    4747    def __eq__(self, y): 
     48        if type(self) != type(y): 
     49            return False 
    4850        ''' 
    4951        Cannot compare classes which do not define a "__key" attribute  
     
    5456 
    5557    def __hash__(self): 
    56         return hash(self.__key()) 
     58        return collectionProofHash(self.__key()) 
  • mauRepo/MolesManager/trunk/src/ea_model/iso_19129_2009_igcd/igcd_framework/if_cellvaluepair.py

    r8091 r8160  
    2020 
    2121from ea_model.iso_19123_2005_coverages.coverages.discrete_coverages.cv_surfacevaluepair import  CV_SurfaceValuePair  
    22 from ascore.utils import has_value 
     22from ascore.utils import has_value, collectionProofHash 
    2323 
    2424''' 
    25 Created on 16-Feb-2012 16:18:09 
     25Created on 13-Mar-2012 11:08:07 
    2626 
    2727@author: mnagni 
     
    4444        self._collection_cv_discretegridpointcoverage = [] 
    4545        self._collection_cvt_discretetimeinstantcoverage = [] 
    46         self._collection_cv_discretesurfacecoverage = [] 
     46        self._collection_cv_discretesolidcoverage = [] 
    4747        self._collection_cv_discretecurvecoverage = [] 
    4848        self._collection_cv_discretepointcoverage = [] 
    49         self._collection_cv_discretesolidcoverage = [] 
     49        self._collection_cv_discretesurfacecoverage = [] 
    5050        self.collection = [] 
    5151        self.value = None 
    5252        self.geometry = None 
    53         self._extension_cv_valuehexagon = [] 
    54         self._extension_cv_gridvaluecell = [] 
    55         self._extension_cv_valuecurve = [] 
    5653        self._extension_cv_valuetriangle = [] 
    5754        self._extension_cv_thiessenvaluepolygon = [] 
     55        self._extension_cv_valuehexagon = [] 
     56        self._extension_cv_valuecurve = [] 
     57        self._extension_cv_gridvaluecell = [] 
    5858        super(IF_CellValuePair, self).__init__() 
    59  
    60     @property 
    61     def collection(self):        
    62         return self._cv_surfacevaluepair.collection 
    63  
    64     @collection.setter 
    65     def collection(self, value):         
    66             self._cv_surfacevaluepair.collection = value 
    6759 
    6860    @property 
     
    8678 
    8779    def __eq__(self, y): 
     80        if type(self) != type(y): 
     81            return False 
    8882        ''' 
    8983        Cannot compare classes which do not define a "__key" attribute  
     
    9488 
    9589    def __hash__(self): 
    96         return hash(self.__key()) 
     90        return collectionProofHash(self.__key()) 
  • mauRepo/MolesManager/trunk/src/ea_model/iso_19129_2009_igcd/igcd_framework/if_classificationattributetype.py

    r8091 r8160  
    2020 
    2121from ea_model.iso_19109_2005_application_schema.general_feature_model.gf_attributetype import  GF_AttributeType  
    22 from ascore.utils import has_value 
     22from ascore.utils import has_value, collectionProofHash 
    2323 
    2424''' 
    25 Created on 16-Feb-2012 16:18:01 
     25Created on 13-Mar-2012 11:08:12 
    2626 
    2727@author: mnagni 
     
    4444        self.propertyTypeMetadata = [] 
    4545        self.valueDomain = None 
     46        self._characterizeBy_gf_locationalattributetype = [] 
     47        self._characterizeBy_gf_metadataattributetype = [] 
     48        self._characterizeBy_gf_thematicattributetype = [] 
     49        self._characterizeBy_gf_temporalattributetype = [] 
    4650        self._characterizeBy_gf_spatialattributetype = [] 
    4751        self._characterizeBy_if_classificationattributetype = [] 
    48         self._characterizeBy_gf_thematicattributetype = [] 
    49         self._characterizeBy_gf_metadataattributetype = [] 
    50         self._characterizeBy_gf_locationalattributetype = [] 
    51         self._characterizeBy_gf_temporalattributetype = [] 
    5252        self.featureAttributeMetadata = [] 
    5353        self.constrainedBy = [] 
    5454        self.memberName = None 
    5555        self.valueType = None 
     56        self.theGF_FeatureType = None 
    5657        self.definition = None 
    57         self.theGF_FeatureType = None 
     58        self.cardinality = None 
     59        self._characterize_gf_locationalattributetype = None 
     60        self._characterize_gf_metadataattributetype = None 
     61        self._characterize_gf_thematicattributetype = None 
     62        self._characterize_gf_temporalattributetype = None 
    5863        self._characterize_gf_spatialattributetype = None 
    5964        self._characterize_if_classificationattributetype = None 
    60         self._characterize_gf_thematicattributetype = None 
    61         self._characterize_gf_metadataattributetype = None 
    62         self._characterize_gf_locationalattributetype = None 
    63         self._characterize_gf_temporalattributetype = None 
    64         self.cardinality = None 
    6565        super(IF_ClassificationAttributeType, self).__init__() 
    6666 
     
    122122 
    123123    @property 
     124    def theGF_FeatureType(self):         
     125        return self._gf_attributetype.theGF_FeatureType 
     126 
     127    @theGF_FeatureType.setter 
     128    def theGF_FeatureType(self, value):  
     129            self._gf_attributetype.theGF_FeatureType = value 
     130 
     131    @property 
    124132    def definition(self):        
    125133        return self._gf_attributetype.definition 
     
    130138 
    131139    @property 
    132     def theGF_FeatureType(self):         
    133         return self._gf_attributetype.theGF_FeatureType 
     140    def cardinality(self):       
     141        return self._gf_attributetype.cardinality 
    134142 
    135     @theGF_FeatureType.setter 
    136     def theGF_FeatureType(self, value):  
    137             self._gf_attributetype.theGF_FeatureType = value 
     143    @cardinality.setter 
     144    def cardinality(self, value):        
     145            self._gf_attributetype.cardinality = value 
    138146 
    139147    @property 
     
    145153            self._gf_attributetype.characterize = value 
    146154 
    147     @property 
    148     def cardinality(self):       
    149         return self._gf_attributetype.cardinality 
    150  
    151     @cardinality.setter 
    152     def cardinality(self, value):        
    153             self._gf_attributetype.cardinality = value 
    154  
    155155    def __key(self): 
    156         return (self.propertyTypeMetadata, self.valueDomain, self.characterizeBy, self.featureAttributeMetadata, self.constrainedBy, self.memberName, self.valueType, self.definition, self.theGF_FeatureType, self.characterize, self.cardinality) 
     156        return (self.propertyTypeMetadata, self.valueDomain, self.characterizeBy, self.featureAttributeMetadata, self.constrainedBy, self.memberName, self.valueType, self.theGF_FeatureType, self.definition, self.cardinality, self.characterize) 
    157157 
    158158    def __eq__(self, y): 
     159        if type(self) != type(y): 
     160            return False 
    159161        ''' 
    160162        Cannot compare classes which do not define a "__key" attribute  
     
    165167 
    166168    def __hash__(self): 
    167         return hash(self.__key()) 
     169        return collectionProofHash(self.__key()) 
  • mauRepo/MolesManager/trunk/src/ea_model/iso_19129_2009_igcd/igcd_framework/if_collection.py

    r8091 r8160  
    1919 
    2020 
    21 from ascore.utils import has_value 
     21from ascore.utils import has_value, collectionProofHash 
    2222 
    2323''' 
    24 Created on 16-Feb-2012 16:18:09 
     24Created on 13-Mar-2012 11:08:04 
    2525 
    2626@author: mnagni 
     
    4747 
    4848    def __eq__(self, y): 
     49        if type(self) != type(y): 
     50            return False 
    4951        ''' 
    5052        Cannot compare classes which do not define a "__key" attribute  
     
    5557 
    5658    def __hash__(self): 
    57         return hash(self.__key()) 
     59        return collectionProofHash(self.__key()) 
  • mauRepo/MolesManager/trunk/src/ea_model/iso_19129_2009_igcd/igcd_framework/if_collectionmetadata.py

    r8091 r8160  
    1919 
    2020 
    21 from ascore.utils import has_value 
     21from ascore.utils import has_value, collectionProofHash 
    2222 
    2323''' 
    24 Created on 16-Feb-2012 16:18:06 
     24Created on 13-Mar-2012 11:08:07 
    2525 
    2626@author: mnagni 
     
    4747 
    4848    def __eq__(self, y): 
     49        if type(self) != type(y): 
     50            return False 
    4951        ''' 
    5052        Cannot compare classes which do not define a "__key" attribute  
     
    5557 
    5658    def __hash__(self): 
    57         return hash(self.__key()) 
     59        return collectionProofHash(self.__key()) 
  • mauRepo/MolesManager/trunk/src/ea_model/iso_19129_2009_igcd/igcd_framework/if_coveragedata.py

    r8091 r8160  
    1919 
    2020 
    21 from ascore.utils import has_value 
     21from ascore.utils import has_value, collectionProofHash 
    2222 
    2323''' 
    24 Created on 16-Feb-2012 16:18:07 
     24Created on 13-Mar-2012 11:08:09 
    2525 
    2626@author: mnagni 
     
    4646 
    4747    def __eq__(self, y): 
     48        if type(self) != type(y): 
     49            return False 
    4850        ''' 
    4951        Cannot compare classes which do not define a "__key" attribute  
     
    5456 
    5557    def __hash__(self): 
    56         return hash(self.__key()) 
     58        return collectionProofHash(self.__key()) 
  • mauRepo/MolesManager/trunk/src/ea_model/iso_19129_2009_igcd/igcd_framework/if_dataset.py

    r8091 r8160  
    1919 
    2020 
    21 from ascore.utils import has_value 
     21from ascore.utils import has_value, collectionProofHash 
    2222 
    2323''' 
    24 Created on 16-Feb-2012 16:18:11 
     24Created on 13-Mar-2012 11:08:12 
    2525 
    2626@author: mnagni 
     
    4646 
    4747    def __eq__(self, y): 
     48        if type(self) != type(y): 
     49            return False 
    4850        ''' 
    4951        Cannot compare classes which do not define a "__key" attribute  
     
    5456 
    5557    def __hash__(self): 
    56         return hash(self.__key()) 
     58        return collectionProofHash(self.__key()) 
  • mauRepo/MolesManager/trunk/src/ea_model/iso_19129_2009_igcd/igcd_framework/if_discoverymetadata.py

    r8091 r8160  
    1919 
    2020 
    21 from ascore.utils import has_value 
     21from ascore.utils import has_value, collectionProofHash 
    2222 
    2323''' 
    24 Created on 16-Feb-2012 16:18:09 
     24Created on 13-Mar-2012 11:08:12 
    2525 
    2626@author: mnagni 
     
    4646 
    4747    def __eq__(self, y): 
     48        if type(self) != type(y): 
     49            return False 
    4850        ''' 
    4951        Cannot compare classes which do not define a "__key" attribute  
     
    5456 
    5557    def __hash__(self): 
    56         return hash(self.__key()) 
     58        return collectionProofHash(self.__key()) 
  • mauRepo/MolesManager/trunk/src/ea_model/iso_19129_2009_igcd/igcd_framework/if_discretepointcoverage.py

    r8091 r8160  
    2020 
    2121from ea_model.iso_19129_2009_igcd.igcd_framework.if_coveragedata import  IF_CoverageData  
    22 from ascore.utils import has_value 
     22from ascore.utils import has_value, collectionProofHash 
    2323 
    2424''' 
    25 Created on 16-Feb-2012 16:18:04 
     25Created on 13-Mar-2012 11:08:08 
    2626 
    2727@author: mnagni 
     
    5050 
    5151    def __eq__(self, y): 
     52        if type(self) != type(y): 
     53            return False 
    5254        ''' 
    5355        Cannot compare classes which do not define a "__key" attribute  
     
    5860 
    5961    def __hash__(self): 
    60         return hash(self.__key()) 
     62        return collectionProofHash(self.__key()) 
  • mauRepo/MolesManager/trunk/src/ea_model/iso_19129_2009_igcd/igcd_framework/if_discretesurfacegridcoverage.py

    r8091 r8160  
    2020 
    2121from ea_model.iso_19129_2009_igcd.igcd_framework.if_coveragedata import  IF_CoverageData  
    22 from ascore.utils import has_value 
     22from ascore.utils import has_value, collectionProofHash 
    2323 
    2424''' 
    25 Created on 16-Feb-2012 16:18:03 
     25Created on 13-Mar-2012 11:08:14 
    2626 
    2727@author: mnagni 
     
    5151 
    5252    def __eq__(self, y): 
     53        if type(self) != type(y): 
     54            return False 
    5355        ''' 
    5456        Cannot compare classes which do not define a "__key" attribute  
     
    5961 
    6062    def __hash__(self): 
    61         return hash(self.__key()) 
     63        return collectionProofHash(self.__key()) 
  • mauRepo/MolesManager/trunk/src/ea_model/iso_19129_2009_igcd/igcd_framework/if_feature.py

    r8091 r8160  
    1919 
    2020 
    21 from ascore.utils import has_value 
     21from ascore.utils import has_value, collectionProofHash 
    2222 
    2323''' 
    24 Created on 16-Feb-2012 16:18:10 
     24Created on 13-Mar-2012 11:08:05 
    2525 
    2626@author: mnagni 
     
    4848 
    4949    def __eq__(self, y): 
     50        if type(self) != type(y): 
     51            return False 
    5052        ''' 
    5153        Cannot compare classes which do not define a "__key" attribute  
     
    5658 
    5759    def __hash__(self): 
    58         return hash(self.__key()) 
     60        return collectionProofHash(self.__key()) 
  • mauRepo/MolesManager/trunk/src/ea_model/iso_19129_2009_igcd/igcd_framework/if_gridcoverage.py

    r8091 r8160  
    2020 
    2121from ea_model.iso_19129_2009_igcd.igcd_framework.if_coveragedata import  IF_CoverageData  
    22 from ascore.utils import has_value 
     22from ascore.utils import has_value, collectionProofHash 
    2323 
    2424''' 
    25 Created on 16-Feb-2012 16:18:03 
     25Created on 13-Mar-2012 11:08:11 
    2626 
    2727@author: mnagni 
     
    4848 
    4949    def __eq__(self, y): 
     50        if type(self) != type(y): 
     51            return False 
    5052        ''' 
    5153        Cannot compare classes which do not define a "__key" attribute  
     
    5658 
    5759    def __hash__(self): 
    58         return hash(self.__key()) 
     60        return collectionProofHash(self.__key()) 
  • mauRepo/MolesManager/trunk/src/ea_model/iso_19129_2009_igcd/igcd_framework/if_quadgriddeddata.py

    r8091 r8160  
    2020 
    2121from ea_model.iso_19129_2009_igcd.igcd_framework.if_gridcoverage import  IF_GridCoverage  
    22 from ascore.utils import has_value 
     22from ascore.utils import has_value, collectionProofHash 
    2323 
    2424''' 
    25 Created on 16-Feb-2012 16:18:04 
     25Created on 13-Mar-2012 11:08:07 
    2626 
    2727@author: mnagni 
     
    4242        self._if_gridcoverage = IF_GridCoverage()        
    4343 
     44        self.domainExtent = [] 
    4445        self.interpolationType = None 
    45         self.domainExtent = [] 
    4646        self.commonPointRule = None 
    4747        self.rangeType = None 
     
    5050 
    5151    def __key(self): 
    52         return (self.interpolationType, self.domainExtent, self.commonPointRule, self.rangeType, self.interpolationParametersType) 
     52        return (self.domainExtent, self.interpolationType, self.commonPointRule, self.rangeType, self.interpolationParametersType) 
    5353 
    5454    def __eq__(self, y): 
     55        if type(self) != type(y): 
     56            return False 
    5557        ''' 
    5658        Cannot compare classes which do not define a "__key" attribute  
     
    6163 
    6264    def __hash__(self): 
    63         return hash(self.__key()) 
     65        return collectionProofHash(self.__key()) 
  • mauRepo/MolesManager/trunk/src/ea_model/iso_19129_2009_igcd/igcd_framework/if_qualitymetadata.py

    r8091 r8160  
    1919 
    2020 
    21 from ascore.utils import has_value 
     21from ascore.utils import has_value, collectionProofHash 
    2222 
    2323''' 
    24 Created on 16-Feb-2012 16:18:07 
     24Created on 13-Mar-2012 11:08:04 
    2525 
    2626@author: mnagni 
     
    4646 
    4747    def __eq__(self, y): 
     48        if type(self) != type(y): 
     49            return False 
    4850        ''' 
    4951        Cannot compare classes which do not define a "__key" attribute  
     
    5456 
    5557    def __hash__(self): 
    56         return hash(self.__key()) 
     58        return collectionProofHash(self.__key()) 
  • mauRepo/MolesManager/trunk/src/ea_model/iso_19129_2009_igcd/igcd_framework/if_riemanngriddeddata.py

    r8091 r8160  
    2020 
    2121from ea_model.iso_19129_2009_igcd.igcd_framework.if_gridcoverage import  IF_GridCoverage  
    22 from ascore.utils import has_value 
     22from ascore.utils import has_value, collectionProofHash 
    2323 
    2424''' 
    25 Created on 16-Feb-2012 16:18:07 
     25Created on 13-Mar-2012 11:08:14 
    2626 
    2727@author: mnagni 
     
    4242        self._if_gridcoverage = IF_GridCoverage()        
    4343 
     44        self.domainExtent = [] 
    4445        self.interpolationType = None 
    45         self.domainExtent = [] 
    4646        self.commonPointRule = None 
    4747        self.rangeType = None 
     
    5050 
    5151    def __key(self): 
    52         return (self.interpolationType, self.domainExtent, self.commonPointRule, self.rangeType, self.interpolationParametersType) 
     52        return (self.domainExtent, self.interpolationType, self.commonPointRule, self.rangeType, self.interpolationParametersType) 
    5353 
    5454    def __eq__(self, y): 
     55        if type(self) != type(y): 
     56            return False 
    5557        ''' 
    5658        Cannot compare classes which do not define a "__key" attribute  
     
    6163 
    6264    def __hash__(self): 
    63         return hash(self.__key()) 
     65        return collectionProofHash(self.__key()) 
  • mauRepo/MolesManager/trunk/src/ea_model/iso_19129_2009_igcd/igcd_framework/if_structuralmetadata.py

    r8091 r8160  
    1919 
    2020 
    21 from ascore.utils import has_value 
     21from ascore.utils import has_value, collectionProofHash 
    2222 
    2323''' 
    24 Created on 16-Feb-2012 16:18:06 
     24Created on 13-Mar-2012 11:08:10 
    2525 
    2626@author: mnagni 
     
    4646 
    4747    def __eq__(self, y): 
     48        if type(self) != type(y): 
     49            return False 
    4850        ''' 
    4951        Cannot compare classes which do not define a "__key" attribute  
     
    5456 
    5557    def __hash__(self): 
    56         return hash(self.__key()) 
     58        return collectionProofHash(self.__key()) 
  • mauRepo/MolesManager/trunk/src/ea_model/iso_19129_2009_igcd/igcd_framework/if_surface.py

    r8091 r8160  
    1919 
    2020 
    21 from ascore.utils import has_value 
     21from ascore.utils import has_value, collectionProofHash 
    2222 
    2323''' 
    24 Created on 16-Feb-2012 16:18:09 
     24Created on 13-Mar-2012 11:08:12 
    2525 
    2626@author: mnagni 
     
    5050 
    5151    def __eq__(self, y): 
     52        if type(self) != type(y): 
     53            return False 
    5254        ''' 
    5355        Cannot compare classes which do not define a "__key" attribute  
     
    5860 
    5961    def __hash__(self): 
    60         return hash(self.__key()) 
     62        return collectionProofHash(self.__key()) 
  • mauRepo/MolesManager/trunk/src/ea_model/iso_19129_2009_igcd/igcd_framework/if_tiling.py

    r8091 r8160  
    1919 
    2020 
    21 from ascore.utils import has_value 
     21from ascore.utils import has_value, collectionProofHash 
    2222 
    2323''' 
    24 Created on 16-Feb-2012 16:18:03 
     24Created on 13-Mar-2012 11:08:11 
    2525 
    2626@author: mnagni 
     
    4646 
    4747    def __eq__(self, y): 
     48        if type(self) != type(y): 
     49            return False 
    4850        ''' 
    4951        Cannot compare classes which do not define a "__key" attribute  
     
    5456 
    5557    def __hash__(self): 
    56         return hash(self.__key()) 
     58        return collectionProofHash(self.__key()) 
  • mauRepo/MolesManager/trunk/src/ea_model/iso_19129_2009_igcd/igcd_framework/if_tincoverage.py

    r8091 r8160  
    2020 
    2121from ea_model.iso_19129_2009_igcd.igcd_framework.if_coveragedata import  IF_CoverageData  
    22 from ascore.utils import has_value 
     22from ascore.utils import has_value, collectionProofHash 
    2323 
    2424''' 
    25 Created on 16-Feb-2012 16:18:06 
     25Created on 13-Mar-2012 11:08:09 
    2626 
    2727@author: mnagni 
     
    4242        self._if_coveragedata = IF_CoverageData()        
    4343 
     44        self.domainExtent = [] 
    4445        self.interpolationType = None 
    45         self.domainExtent = [] 
     46        self.commonPointRule = None 
    4647        self.geometry = None 
    47         self.commonPointRule = None 
    4848        self.rangeType = None 
    4949        self.interpolationParametersType = None 
     
    5151 
    5252    def __key(self): 
    53         return (self.interpolationType, self.domainExtent, self.geometry, self.commonPointRule, self.rangeType, self.interpolationParametersType) 
     53        return (self.domainExtent, self.interpolationType, self.commonPointRule, self.geometry, self.rangeType, self.interpolationParametersType) 
    5454 
    5555    def __eq__(self, y): 
     56        if type(self) != type(y): 
     57            return False 
    5658        ''' 
    5759        Cannot compare classes which do not define a "__key" attribute  
     
    6264 
    6365    def __hash__(self): 
    64         return hash(self.__key()) 
     66        return collectionProofHash(self.__key()) 
  • mauRepo/MolesManager/trunk/src/ea_model/iso_19129_2009_igcd/igcd_framework/if_transmittal.py

    r8091 r8160  
    1919 
    2020 
    21 from ascore.utils import has_value 
     21from ascore.utils import has_value, collectionProofHash 
    2222 
    2323''' 
    24 Created on 16-Feb-2012 16:18:02 
     24Created on 13-Mar-2012 11:08:08 
    2525 
    2626@author: mnagni 
     
    4646 
    4747    def __eq__(self, y): 
     48        if type(self) != type(y): 
     49            return False 
    4850        ''' 
    4951        Cannot compare classes which do not define a "__key" attribute  
     
    5456 
    5557    def __hash__(self): 
    56         return hash(self.__key()) 
     58        return collectionProofHash(self.__key()) 
Note: See TracChangeset for help on using the changeset viewer.