Class LazyAspectVariable<V extends IValue>
java.lang.Object
org.cyclops.integrateddynamics.api.evaluate.expression.VariableAdapter<V>
org.cyclops.integrateddynamics.core.part.aspect.LazyAspectVariable<V>
- All Implemented Interfaces:
IVariable<V>,IVariableInvalidateListener,IAspectVariable<V>
public abstract class LazyAspectVariable<V extends IValue>
extends VariableAdapter<V>
implements IAspectVariable<V>
Variable for a specific aspect from a part that calculates its target value only maximum once per ticking interval.
No calculations will be done if the value of this variable is not called.
-
Constructor Summary
ConstructorsConstructorDescriptionLazyAspectVariable(IValueType<V> type, Supplier<PartTarget> targetSupplier, IAspectRead<V, ?> aspect) -
Method Summary
Modifier and TypeMethodDescriptionprotected IAspectPropertiesgetValue()abstract VCalculate the current value for this variable.voidCalled when a variable was invalidated.Methods inherited from class org.cyclops.integrateddynamics.api.evaluate.expression.VariableAdapter
addInvalidationListener, removeInvalidationListenerMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.cyclops.integrateddynamics.api.part.aspect.IAspectVariable
getAspectMethods inherited from interface org.cyclops.integrateddynamics.api.evaluate.variable.IVariable
addInvalidationListener, getType, removeInvalidationListener
-
Constructor Details
-
LazyAspectVariable
public LazyAspectVariable(IValueType<V> type, Supplier<PartTarget> targetSupplier, IAspectRead<V, ?> aspect)
-
-
Method Details
-
getTarget
- Specified by:
getTargetin interfaceIAspectVariable<V extends IValue>- Returns:
- The target of this aspect variable.
-
invalidate
public void invalidate()Description copied from interface:IVariableInvalidateListenerCalled when a variable was invalidated.- Specified by:
invalidatein interfaceIVariableInvalidateListener- Overrides:
invalidatein classVariableAdapter<V extends IValue>
-
getValue
- Specified by:
getValuein interfaceIVariable<V extends IValue>- Returns:
- The current value of this variable.
- Throws:
EvaluationException- If something went wrong while evaluating
-
getAspectProperties
-
getValueLazy
Calculate the current value for this variable. It will only be called when required.- Returns:
- The current value of this variable.
- Throws:
EvaluationException- If evaluation has gone wrong.
-