Class OperatorBuilder<O>
java.lang.Object
org.cyclops.integrateddynamics.core.evaluate.build.OperatorBuilder<O>
- Type Parameters:
O
- The current output type for value propagators.
Immutable builder for operators.
Appending the kinds "a", "b" and "c" for example will result in the base localization key of "operator.operators.MOD_ID.a.b.c.".
This base key then will be suffixed with {"name", "basename"}.
If the operator name would be "xyz", then you'll also need the localization keys "operator.operators.MOD_ID.a.b.c.xyz."{"name", "info"}.
The actual operator function can either be set by calling
function
or by
doing any number of calls to handle(IOperatorValuePropagator)
with value propagators.-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
static interface
-
Constructor Summary
ModifierConstructorDescriptionprotected
OperatorBuilder
(String symbol, String operatorName, String interactName, String globalInteractNamePrefix, boolean alsoPrefixLocalScope, IValueType[] inputTypes, IValueType outputType, OperatorBase.IFunction function, IConfigRenderPattern renderPattern, String modId, List<String> kinds, OperatorBuilder.IConditionalOutputTypeDeriver conditionalOutputTypeDeriver, OperatorBuilder.ITypeValidator typeValidator, List<IOperatorValuePropagator> valuePropagators) -
Method Summary
Modifier and TypeMethodDescriptionappendKind
(String kind) Append a localization key element.build()
Build an operator from the current builder state.conditionalOutputTypeDeriver
(OperatorBuilder.IConditionalOutputTypeDeriver conditionalOutputTypeDeriver) Set the conditional output type deriver.forType
(IValueType<?> outputType) Create a new builder with the given output type.function
(OperatorBase.IFunction function) Set the function the operator should use.<O2> OperatorBuilder<O2>
handle
(IOperatorValuePropagator<O, O2> valuePropagator) Add a value propagator.inputType
(IValueType inputType) Set a single input type.inputTypes
(int length, IValueType defaultType) Set input types to a given amount of the given value type.inputTypes
(IValueType... inputTypes) Set the input types for the operator.interactName
(String interactName) Set the unique interact name.interactName
(String interactName, String globalInteractNamePrefix, boolean alsoPrefixLocalScope) Set the unique interact name.Set the mod id, by default this will be the Integrated Dynamics mod id.operatorInteract
(String operatorInteract) Set the operator, and unique interact name to the given value.operatorName
(String operatorName) Set the operator name, used for localization.output
(IValueType outputType) Set the operator output value type.renderPattern
(IConfigRenderPattern renderPattern) Set the render pattern for this operator in guis.Set the operator symbol.symbolOperator
(String symbolOperator) Set the symbol and operator name to the given value.symbolOperatorInteract
(String symbolOperator) Set the symbol, operator, and unique interact name to the given value.typeValidator
(OperatorBuilder.ITypeValidator typeValidator) Set the type validator.
-
Constructor Details
-
OperatorBuilder
protected OperatorBuilder(String symbol, String operatorName, String interactName, String globalInteractNamePrefix, boolean alsoPrefixLocalScope, IValueType[] inputTypes, IValueType outputType, OperatorBase.IFunction function, IConfigRenderPattern renderPattern, String modId, List<String> kinds, OperatorBuilder.IConditionalOutputTypeDeriver conditionalOutputTypeDeriver, OperatorBuilder.ITypeValidator typeValidator, List<IOperatorValuePropagator> valuePropagators)
-
-
Method Details
-
output
Set the operator output value type.- Parameters:
outputType
- The output value type.- Returns:
- The builder instance.
-
symbol
Set the operator symbol.- Parameters:
symbol
- The symbol for the operator.- Returns:
- The builder instance.
-
operatorName
Set the operator name, used for localization.- Parameters:
operatorName
- The operator name.- Returns:
- The builder instance.
-
interactName
Set the unique interact name.- Parameters:
interactName
- The unique interact name.- Returns:
- The builder instance.
-
interactName
public OperatorBuilder<O> interactName(String interactName, String globalInteractNamePrefix, boolean alsoPrefixLocalScope) Set the unique interact name.- Parameters:
interactName
- The unique interact name.globalInteractNamePrefix
- The prefix to use for the global interact name.alsoPrefixLocalScope
- If the prefix should also be used for the local scope.- Returns:
- The builder instance.
-
symbolOperator
Set the symbol and operator name to the given value. The symbol is used for display while the operator name is used for localization.- Parameters:
symbolOperator
- The symbol and operator name.- Returns:
- The builder instance.
-
symbolOperatorInteract
Set the symbol, operator, and unique interact name to the given value. The symbol is used for display while the operator name is used for localization.- Parameters:
symbolOperator
- The symbol, operator, and unique name.- Returns:
- The builder instance.
-
operatorInteract
Set the operator, and unique interact name to the given value.- Parameters:
operatorInteract
- The operator and interact name.- Returns:
- The builder instance.
-
inputTypes
Set the input types for the operator.- Parameters:
inputTypes
- Array of value types.- Returns:
- The builder instance.
-
inputTypes
Set input types to a given amount of the given value type.- Parameters:
length
- The amount of input types.defaultType
- The input type to replicate `length` times.- Returns:
- The builder instance.
-
inputType
Set a single input type.- Parameters:
inputType
- The input type.- Returns:
- The builder instance.
-
function
Set the function the operator should use.- Parameters:
function
- The function.- Returns:
- The builder instance.
-
renderPattern
Set the render pattern for this operator in guis.- Parameters:
renderPattern
- The render pattern.- Returns:
- The builder instance.
-
modId
Set the mod id, by default this will be the Integrated Dynamics mod id.- Parameters:
modId
- The mod id.- Returns:
- The builder instance.
-
appendKind
Append a localization key element.- Parameters:
kind
- The string to append.- Returns:
- The builder instance.
-
conditionalOutputTypeDeriver
public OperatorBuilder<O> conditionalOutputTypeDeriver(OperatorBuilder.IConditionalOutputTypeDeriver conditionalOutputTypeDeriver) Set the conditional output type deriver.- Parameters:
conditionalOutputTypeDeriver
- The output type deriver based on certain input. This will be used forIOperator.getConditionalOutputType(IVariable[])
.- Returns:
- The builder instance.
-
typeValidator
Set the type validator.- Parameters:
typeValidator
- The type validator. This will be used forIOperator.validateTypes(IValueType[])
.- Returns:
- The builder instance.
-
handle
Add a value propagator.- Type Parameters:
O2
- The new output type for value propagators.- Parameters:
valuePropagator
- The value propagator.- Returns:
- The builder instance.
-
build
Build an operator from the current builder state.- Returns:
- The built operator
-
forType
Create a new builder with the given output type.- Parameters:
outputType
- The output type.- Returns:
- The builder instance.
-