Interface IVariable<V extends IValue>
- All Superinterfaces:
IVariableInvalidateListener
- All Known Subinterfaces:
IAspectVariable<V>, IExpression<V>, IPositionedVariable<V>
- All Known Implementing Classes:
DummyVariable, DummyVariableBlock, DummyVariableEntity, DummyVariableFluidStack, DummyVariableIngredients, DummyVariableItemStack, DummyVariableRecipe, LazyAspectVariable, LazyExpression, UpdatingAspectVariable, Variable, VariableAdapter
Facade through which a value can be retrieved.
-
Method Summary
Modifier and TypeMethodDescriptionvoidaddInvalidationListener(IVariableInvalidateListener invalidateListener) Add a dependency relation.getType()getValue()voidremoveInvalidationListener(IVariableInvalidateListener invalidateListener) Remove a dependency relation.Methods inherited from interface IVariableInvalidateListener
invalidate
-
Method Details
-
getType
IValueType<V> getType()- Returns:
- The type of value this variable provides.
-
getValue
- Returns:
- The current value of this variable.
- Throws:
EvaluationException- If something went wrong while evaluating
-
addInvalidationListener
Add a dependency relation. This makes it so that when this variable gets invalidated, the given listener/variables also becomes invalidated. This invalidation should happen recursively for variables. This listener will be removed after the first invalidation. If needed, the listener can be re-attached after that.- Parameters:
invalidateListener- A listener for invalidations.
-
removeInvalidationListener
Remove a dependency relation.- Parameters:
invalidateListener- A listener for invalidations.
-