예제 #1
0
 def comparator(cls,et,etOrderList):
     etType = et.getType()
     if etType in etOrderList:
         # if the type being compared is in the orderList, return it's position
         return etOrderList.index(etType)
     # otherwise return a value greater than the last position of the orderList
     return len(etOrderList)+1
예제 #2
0
 def __getattr__(self,type):
     for et in self:
         if et.getType() == type:
             return et
     raise EnumeratedTypeError("unable to find %s" % str(type))