Class ExpressionVariableFacade
java.lang.Object
org.cyclops.integrateddynamics.core.item.VariableFacadeBase
org.cyclops.integrateddynamics.core.item.ExpressionVariableFacade
- All Implemented Interfaces:
IExpressionVariableFacade, IVariableFacade
public class ExpressionVariableFacade
extends VariableFacadeBase
implements IExpressionVariableFacade
Variable facade for variables defined by an expression tree.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classVariable that holds an expression operator, and propagates invalidation of referenced variables.Nested classes/interfaces inherited from interface IVariableFacade
IVariableFacade.IValidator -
Constructor Summary
ConstructorsConstructorDescriptionExpressionVariableFacade(boolean generateId, Expression expression) ExpressionVariableFacade(boolean generateId, Expression expression, Map<Integer, IValueType<?>> referenceTypes, String text) ExpressionVariableFacade(int id, Expression expression) ExpressionVariableFacade(int id, Expression expression, Map<Integer, IValueType<?>> referenceTypes, String text) -
Method Summary
Modifier and TypeMethodDescriptionvoidappendHoverText(Consumer<net.minecraft.network.chat.Component> tooltipAdder, net.minecraft.world.item.Item.TooltipContext context) Add information about this variable facade to the list.protected IVariable<?> buildVariable(INetwork network, IPartNetwork partNetwork) protected IVariableFacadeClientbooleanIValueType<?> protected IVariable<?> getReferencedVariable(INetwork network, IPartNetwork partNetwork, int variableId) Map<Integer, IValueType<?>> IValueType<?> getText()getVariable(INetwork network, IPartNetwork partNetwork) Get the variable.inthashCode()booleanisValid()voidvalidate(INetwork network, IPartNetwork partNetwork, IVariableFacade.IValidator validator, IValueType containingValueType) Check if this facade is valid, otherwise notify the validator of any errors.Methods inherited from class VariableFacadeBase
canEqual, generateId, getClient, getId, getLabel, getReferenceDisplay, setClient, toStringMethods inherited from interface IVariableFacade
getClient, getId, getLabel
-
Constructor Details
-
ExpressionVariableFacade
-
ExpressionVariableFacade
-
ExpressionVariableFacade
public ExpressionVariableFacade(boolean generateId, @Nullable Expression expression, Map<Integer, IValueType<?>> referenceTypes, @Nullable String text) -
ExpressionVariableFacade
public ExpressionVariableFacade(int id, @Nullable Expression expression, Map<Integer, IValueType<?>> referenceTypes, @Nullable String text)
-
-
Method Details
-
getReferenceTypes
- Specified by:
getReferenceTypesin interfaceIExpressionVariableFacade- Returns:
- The output types of the referenced variables, by variable id, as far as they were known when this card was written. This is only used when editing the card, evaluation always uses the actual variables.
-
getText
- Specified by:
getTextin interfaceIExpressionVariableFacade- Returns:
- The text the expression was typed as, or null if it was not typed or is printed. This is only used when editing the card, and only while the text still reads as the expression.
-
getExpression
- Specified by:
getExpressionin interfaceIExpressionVariableFacade- Returns:
- The expression, or null if the facade is invalid.
-
isValid
public boolean isValid()- Specified by:
isValidin interfaceIVariableFacade- Returns:
- If this is a valid reference.
-
getReferencedVariable
@Nullable protected IVariable<?> getReferencedVariable(INetwork network, IPartNetwork partNetwork, int variableId) -
getVariable
Description copied from interface:IVariableFacadeGet the variable.- Specified by:
getVariablein interfaceIVariableFacade- Type Parameters:
V- The value type.- Parameters:
network- The network used to look for the variable.partNetwork- The part network used to look for the variable.- Returns:
- The variable.
-
buildVariable
-
validate
public void validate(INetwork network, IPartNetwork partNetwork, IVariableFacade.IValidator validator, IValueType containingValueType) Description copied from interface:IVariableFacadeCheck if this facade is valid, otherwise notify the validator of any errors.- Specified by:
validatein interfaceIVariableFacade- Parameters:
network- The network used to look for the variable.partNetwork- The part network used to look for the variable.validator- The object to notify errors to.containingValueType- The value type in which this variable facade is being used.
-
getRootOutputType
- Returns:
- The output type of the root, inferred without knowledge of referenced variables.
-
getKnownRootOutputType
- Returns:
- The output type of the root, inferred with the types that referenced variables had when the card was written.
-
getOutputType
- Specified by:
getOutputTypein interfaceIVariableFacade- Returns:
- The output type of this variable facade.
-
printExpression
- Returns:
- The expression pretty-printed with labels.
-
constructClient
- Specified by:
constructClientin classVariableFacadeBase
-
appendHoverText
public void appendHoverText(Consumer<net.minecraft.network.chat.Component> tooltipAdder, net.minecraft.world.item.Item.TooltipContext context) Description copied from interface:IVariableFacadeAdd information about this variable facade to the list.- Specified by:
appendHoverTextin interfaceIVariableFacade- Overrides:
appendHoverTextin classVariableFacadeBase- Parameters:
tooltipAdder- The list to add lines to.context- The context.
-
equals
- Overrides:
equalsin classVariableFacadeBase
-
hashCode
public int hashCode()- Overrides:
hashCodein classVariableFacadeBase
-
getRootOperator
- Returns:
- The root operator if the root is an operator node, otherwise null.
-