This commit is contained in:
Vincent Jacques
2012-02-22 20:13:54 +00:00
parent 80e316ac85
commit b87495734d
+12 -17
View File
@@ -2,23 +2,6 @@ import itertools
import ArgumentsChecker
class ListOfReferences:
def __init__( self, attributeName, type, addable = False, removable = False, hasable = False, getParameters = [] ):
self.__capacities = list()
self.attributeName = attributeName
self.type = type
self.__capacities.append( ListGetable( [], getParameters ) )
if addable:
self.__capacities.append( ElementAddable() )
if removable:
self.__capacities.append( ElementRemoveable() )
if hasable:
self.__capacities.append( ElementHasable() )
def apply( self, cls ):
for capacity in self.__capacities:
capacity.apply( self, cls )
class ElementAddable:
def apply( self, list, cls ):
self.__type = list.type
@@ -102,3 +85,15 @@ class ListOfObjects:
def apply( self, cls ):
for capacity in self.__capacities:
capacity.apply( self, cls )
class ListOfReferences( ListOfObjects ):
def __init__( self, attributeName, type, addable = False, removable = False, hasable = False, getParameters = [] ):
capacities = list()
capacities.append( ListGetable( [], getParameters ) )
if addable:
capacities.append( ElementAddable() )
if removable:
capacities.append( ElementRemoveable() )
if hasable:
capacities.append( ElementHasable() )
ListOfObjects.__init__( self, attributeName, type, *capacities )