|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcom.sdm.quasar.client.core.data.structure.AbstractSimpleComputation
A base class for simple cases of computations. This implementation assumes that the computation simply needs the values of all source nodes to compute its own value.
Implementations using this class must implement #computeFromValues(Object[]), {@link Computation#getType()}, and {@link Computation#getSourceTypes()}. If the computation is reversable, {@link #supportsReverse()} and {@link #reverseComputationToValues(Object, Object[])} must be overridden.
Computations that need to manipulate the context or that don't need the values of all source nodes should not be derived from this class but instead implement {@link com.sdm.quasar.client.core.data.structure.Computation} directly.
| Constructor Summary | |
AbstractSimpleComputation()
|
|
| Method Summary | |
abstract java.lang.Object |
computeFromValues(java.lang.Object[] sourceValues)
Performs the computation. |
java.util.Set |
computeIndexSet(ComputationValueAccess sourceValuesAccess,
Context context)
Performs the computation of a Set of the index values. |
java.lang.Object |
computeValue(ComputationValueAccess sourceValuesAccess,
Context context)
Performs the computation with an context. This implementation retrieves all source values using #getValues(ComputationValueAccess)
and passes them on to computeFromValues(Object[]). |
java.lang.Object[] |
reverseComputationToValues(java.lang.Object targetValue,
java.lang.Object[] sourceValues)
Perform a reverse computation computes the correct source values with respect to the target value. |
void |
reverseValueComputation(java.lang.Object targetValue,
ComputationValueAccess sourceValuesAccess,
Context context)
Perform a reverse computation computes the correct source values with respect to the target value with a context. The resulting new source values must be set using the ComputationValueAccess.
This implementation retrieves all source values using #getValues(ComputationValueAccess)
and passes them to reverseComputationToValues(Object, Object[]).
|
boolean |
supportsReverse()
This implementation returns false. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface com.sdm.quasar.client.core.data.structure.Computation |
getSourceTypes, getType |
| Constructor Detail |
public AbstractSimpleComputation()
| Method Detail |
public final java.lang.Object computeValue(ComputationValueAccess sourceValuesAccess,
Context context)
#getValues(ComputationValueAccess)
and passes them on to computeFromValues(Object[]).
computeValue in interface ComputationsourceValuesAccess - the access source valuescontext - the context to be used
Computation.computeValue(com.sdm.quasar.client.core.data.structure.ComputationValueAccess, com.sdm.quasar.client.core.data.Context)
public final void reverseValueComputation(java.lang.Object targetValue,
ComputationValueAccess sourceValuesAccess,
Context context)
ComputationValueAccess.
This implementation retrieves all source values using #getValues(ComputationValueAccess)
and passes them to reverseComputationToValues(Object, Object[]).
The result of reverseComputationToValues(Object, Object[]) is set to
the ComputationValueAccess.
reverseValueComputation in interface ComputationtargetValue - the target valuesourceValuesAccess - the access current source valuescontext - the context to be usedComputation.reverseValueComputation(java.lang.Object, com.sdm.quasar.client.core.data.structure.ComputationValueAccess, com.sdm.quasar.client.core.data.Context)
public java.util.Set computeIndexSet(ComputationValueAccess sourceValuesAccess,
Context context)
Computation
computeIndexSet in interface ComputationsourceValuesAccess - the access source valuescontext - the context to be used
Computation.computeIndexSet(com.sdm.quasar.client.core.data.structure.ComputationValueAccess, com.sdm.quasar.client.core.data.Context)public abstract java.lang.Object computeFromValues(java.lang.Object[] sourceValues)
sourceValues - the source values
public boolean supportsReverse()
supportsReverse in interface ComputationComputation.supportsReverse()
public java.lang.Object[] reverseComputationToValues(java.lang.Object targetValue,
java.lang.Object[] sourceValues)
This implementation throws an UnsupportedOperationException.
Override this method if your computation is reversible.
targetValue - the target valuesourceValues - the current source values
java.lang.UnsupportedOperationException - if the reverse computation is not supported
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||