Package eu.ciechanowiec.conditional
Class ActionsList
- java.lang.Object
-
- eu.ciechanowiec.conditional.ActionsList
-
public class ActionsList extends Object
-
-
Constructor Summary
Constructors Constructor Description ActionsList()Constructs an instance of anActionsListthat storesActions and provides basic API pertaining to the stored elements.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) <T> voidadd(Action<T> actionToAdd)Adds the passedActionto this actions list.(package private) voidclear()Removes allActions from this actions list.(package private) voidexecuteAll()Executes, subsequently and starting from the first one, allActions stored in this actions list.List<Action<?>>getAll()Retrieves by reference all instances ofActions stored in this actions list.(package private) Action<?>getFirst()Retrieves, but does not remove, the firstActionfrom this actions list.(package private) booleanisExactlyOneActionInList()Informs, whether this actions list stores exactly one action.
-
-
-
Constructor Detail
-
ActionsList
ActionsList()
Constructs an instance of anActionsListthat storesActions and provides basic API pertaining to the stored elements.Actions are stored in an internal
List.
-
-
Method Detail
-
add
<T> void add(Action<T> actionToAdd)
- Type Parameters:
T- type of value returned in the result of submitted action execution- Parameters:
actionToAdd-Actionto add to this actions list
-
getFirst
Action<?> getFirst()
Retrieves, but does not remove, the firstActionfrom this actions list.- Returns:
- the first element of this actions list
- Throws:
NoSuchElementException- if this actions list is empty
-
isExactlyOneActionInList
boolean isExactlyOneActionInList()
Informs, whether this actions list stores exactly one action.- Returns:
trueif this actions list stores exactly one action;falseotherwise
-
clear
void clear()
Removes allActions from this actions list.The list will be empty after this call returns.
-
getAll
@Nonnull public List<Action<?>> getAll()
Retrieves by reference all instances ofActions stored in this actions list.
-
executeAll
void executeAll()
Executes, subsequently and starting from the first one, allActions stored in this actions list.Execution is performed by calling an
Action.execute()method of an executedAction.
-
-