Class MappingOperationChain
java.lang.Object
me.datafox.dfxengine.values.operation.MappingOperationChain
- All Implemented Interfaces:
BiFunction<Numeral,,Numeral[], Numeral> Operation
An extension of the
OperationChain which offers more flexible ways for routing parameters. There are two main
changes. Firstly, inputs are now counted as regular parameters. This means that Operation.getParameterCount() now
returns the number of parameters for all specified Operations, plus the amount of operations
themselves. The second change is the inclusion of the MappingOperationChain.SpecialNumeral, which is used to request the source
Numeral and the result of any prior operation as an arbitrary parameter. Two static methods are provided for
these, sourceNumeral() and resultNumeral(int), but you can also instantiate a SpecialNumeral
manually with SpecialNumeral(int), where -1 refers to the source and any positive value refers
to the operation with that index. Referring to an operation that has yet to be executed results in an
IllegalArgumentException.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classA Builder forMappingOperationChain.static classA specialMappingOperationChain-specific extension ofNumeralthat is used to refer to the source numeral and the result numerals ofOperations. -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.function.BiFunction
andThenMethods inherited from interface me.datafox.dfxengine.values.api.operation.Operation
getParameterCount
-
Constructor Details
-
MappingOperationChain
- Parameters:
operations-Operationsto associate with this operation
-
-
Method Details
-
sourceNumeral
- Returns:
MappingOperationChain.SpecialNumeralthat refers to the sourceNumeral
-
resultNumeral
- Parameters:
operationIndex- index of theOperationto refer to- Returns:
MappingOperationChain.SpecialNumeralthat refers to the result of the specifiedOperation
-
apply
- Specified by:
applyin interfaceBiFunction<Numeral,Numeral[], Numeral> - Specified by:
applyin interfaceOperation- Parameters:
source- sourceNumeralfor this operationparameters- parameterNumeralsfor this operation- Returns:
- resulting
Numeralof this operation - Throws:
IllegalArgumentException- if the amount of parameters is not equal toOperation.getParameterCount()
-
builder
- Returns:
MappingOperationChain.Builderinstance
-