java.lang.Object
xyz.ronella.trivial.command.logic.AbstractLogical
A partial implementation of the logic command.
- Since:
- 2.0.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected List<BooleanSupplier>A list of BooleanSupplier.protected SinkThe default false logic.protected SinkThe default truth logic -
Constructor Summary
ConstructorsConstructorDescriptionAbstractLogical(BooleanSupplier... conditions) Creates an instance of AbstractLogical.AbstractLogical(List<BooleanSupplier> conditions) Creates an instance of AbstractLogical.AbstractLogical(List<BooleanSupplier> conditions, Sink defaultTruthLogic) Creates an instance of AbstractLogical.AbstractLogical(List<BooleanSupplier> conditions, Sink defaultTruthLogic, Sink defaultFalseLogic) Creates an instance of AbstractLogical.AbstractLogical(Sink defaultTruthLogic, BooleanSupplier... conditions) Creates an instance of AbstractLogical.AbstractLogical(Sink defaultTruthLogic, Sink defaultFalseLogic, BooleanSupplier... conditions) Creates an instance of AbstractLogical. -
Method Summary
Modifier and TypeMethodDescriptionvoidThe default implementation is just passing to the BiConsumer implementation.voidCalculates if the truthLogic or falseLogic must be executed.abstract booleangetTruthCondition(List<BooleanSupplier> conditions) Determines the truth condition.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.function.BiConsumer
andThen
-
Field Details
-
conditions
A list of BooleanSupplier. -
defaultTruthLogic
The default truth logic -
defaultFalseLogic
The default false logic.
-
-
Constructor Details
-
AbstractLogical
public AbstractLogical(List<BooleanSupplier> conditions, Sink defaultTruthLogic, Sink defaultFalseLogic) Creates an instance of AbstractLogical.- Parameters:
conditions- A list of BooleanSupplier.defaultTruthLogic- The default truth logic.defaultFalseLogic- The default false logic.
-
AbstractLogical
Creates an instance of AbstractLogical.- Parameters:
conditions- A list of BooleanSupplier.defaultTruthLogic- The default truth logic.
-
AbstractLogical
Creates an instance of AbstractLogical.- Parameters:
conditions- A list of BooleanSupplier.
-
AbstractLogical
public AbstractLogical(Sink defaultTruthLogic, Sink defaultFalseLogic, BooleanSupplier... conditions) Creates an instance of AbstractLogical.- Parameters:
defaultTruthLogic- The default truth logic.defaultFalseLogic- The default false logic.conditions- An array of BooleanSupplier.
-
AbstractLogical
Creates an instance of AbstractLogical.- Parameters:
defaultTruthLogic- The default truth logic.conditions- An array of BooleanSupplier.
-
AbstractLogical
Creates an instance of AbstractLogical.- Parameters:
conditions- An array of BooleanSupplier.
-
-
Method Details
-
accept
The default implementation is just passing to the BiConsumer implementation. -
getTruthCondition
Determines the truth condition.- Parameters:
conditions- The list of conditions- Returns:
- True when the truthLogic must be called.
-
accept
Calculates if the truthLogic or falseLogic must be executed.- Specified by:
acceptin interfaceBiConsumer<Sink,Sink> - Parameters:
truthLogic- The logic to be executed when all the conditions are true.falseLogic- The logic to be executed when at least one condition is false.
-