java.lang.Object
visitorDemoExercises.listFWVisitorExercises.model.ListDemoModel
ListFW demo app model
- Author:
- swong
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate IObjectLoader<IAccumulator>
Dynamic loader for accumulator classesprivate IListAlgo
The fold left algoprivate IListAlgo
The fold right algoprivate IList
Instance of first available hostprivate IList
Instance of second available hostprivate IList
Instance of third available hostprivate ILogger
logger to useprivate IViewAdapter
Adapter to the viewprivate IObjectLoader<IListAlgo>
Dynamic loader for visitor classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionRun the FoldLAlgo visitor on the given list using the given IAccumulatorRun the FoldRAlgo visitor on the given list using the given IAccumulatorrunListAlgo(IList list, String classname, String param)
Returns the result of a host list executing the given visitor with the given parametervoid
start()
Start the model
-
Field Details
-
logger
logger to use -
view
Adapter to the view -
list0
Instance of first available host -
list1
Instance of second available host -
list2
Instance of third available host -
accLoader
Dynamic loader for accumulator classes -
visLoader
Dynamic loader for visitor classes -
foldr
The fold right algo -
foldl
The fold left algo
-
-
Constructor Details
-
ListDemoModel
Constructor for the class- Parameters:
view
- The view adapter
-
-
Method Details
-
start
public void start()Start the model -
runListAlgo
Returns the result of a host list executing the given visitor with the given parameter- Parameters:
list
- The host list objectclassname
- The class name of the visitor to use, without the leading "listFW.visitor."param
- An input parameter for the visitor execution- Returns:
- The result of the visitor execution by the list.
-
runFoldR
Run the FoldRAlgo visitor on the given list using the given IAccumulator- Parameters:
list
- The host list objectclassname
- The class name of the accumulator to use, without the leading "listFW.visitor."param
- A constructor parameter for an accumulator object. Must be a String that the constructor can then convert to whatever it needs.- Returns:
- The result of the foldr visitor execution by the list.
-
runFoldL
Run the FoldLAlgo visitor on the given list using the given IAccumulator- Parameters:
list
- The host list objectclassname
- The class name of the accumulator to use, without the leading "listFW.visitor."param
- A constructor parameter for an accumulator object. Must be a String that the constructor can then convert to whatever it needs.- Returns:
- The result of the foldl visitor execution by the list.
-