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
ConstructorDescriptionLazyAspectVariable
(IValueType<V> type, Supplier<PartTarget> targetSupplier, IAspectRead<V, ?> aspect) LazyAspectVariable
(IValueType<V> type, PartTarget target, IAspectRead<V, ?> aspect) Deprecated. -
Method Summary
Modifier and TypeMethodDescriptionprotected IAspectProperties
getValue()
abstract V
Calculate the current value for this variable.void
Called when a variable was invalidated.Methods inherited from class org.cyclops.integrateddynamics.api.evaluate.expression.VariableAdapter
addInvalidationListener
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.cyclops.integrateddynamics.api.part.aspect.IAspectVariable
getAspect
Methods inherited from interface org.cyclops.integrateddynamics.api.evaluate.variable.IVariable
addInvalidationListener, getType
-
Constructor Details
-
LazyAspectVariable
public LazyAspectVariable(IValueType<V> type, Supplier<PartTarget> targetSupplier, IAspectRead<V, ?> aspect) -
LazyAspectVariable
@Deprecated public LazyAspectVariable(IValueType<V> type, PartTarget target, IAspectRead<V, ?> aspect) Deprecated.
-
-
Method Details
-
getTarget
- Specified by:
getTarget
in interfaceIAspectVariable<V extends IValue>
- Returns:
- The target of this aspect variable.
-
invalidate
public void invalidate()Description copied from interface:IVariableInvalidateListener
Called when a variable was invalidated.- Specified by:
invalidate
in interfaceIVariableInvalidateListener
- Overrides:
invalidate
in classVariableAdapter<V extends IValue>
-
getValue
- Specified by:
getValue
in 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.
-