public abstract class Triggerable extends java.lang.Object implements Externalizable
Modifier and Type | Field and Description |
---|---|
private TreeReference |
contextRef
Current reference which is the "Basis" of the trigerrables being evaluated.
|
private IConditionExpr |
expr
The expression which will be evaluated to produce a result
|
private java.util.HashSet<QuickTriggerable> |
immediateCascades |
private TreeReference |
originalContextRef
The first context provided to this triggerable before reducing to the common root.
|
private java.util.List<TreeReference> |
targets
References to all of the (non-contextualized) nodes which should be
updated by the result of this triggerable
|
static java.util.Comparator<Triggerable> |
triggerablesRootOrdering |
private int |
waveCount |
Constructor and Description |
---|
Triggerable() |
Triggerable(IConditionExpr expr,
TreeReference contextRef) |
Triggerable(IConditionExpr expr,
TreeReference contextRef,
java.util.ArrayList<TreeReference> targets) |
Modifier and Type | Method and Description |
---|---|
void |
addTarget(TreeReference target) |
java.util.List<EvaluationResult> |
apply(FormInstance mainInstance,
EvaluationContext parentContext,
TreeReference context)
Not for re-implementation, dispatches all of the evaluation
|
protected abstract void |
apply(TreeReference ref,
java.lang.Object result,
FormInstance mainInstance) |
abstract boolean |
canCascade() |
void |
changeContextRefToIntersectWithTriggerable(Triggerable t) |
TreeReference |
contextualizeContextRef(TreeReference anchorRef) |
boolean |
equals(java.lang.Object o) |
protected abstract java.lang.Object |
eval(FormInstance instance,
EvaluationContext ec) |
(package private) java.lang.Boolean |
evalPredicate(FormInstance model,
EvaluationContext evalContext) |
(package private) java.lang.Object |
evalRaw(FormInstance model,
EvaluationContext evalContext) |
java.util.List<TreeReference> |
findAffectedTriggers(java.util.Map<TreeReference,java.util.List<TreeReference>> firedAnchorsMap)
Searches in the triggers of this Triggerable, trying to find the ones that are
contained in the given list of contextualized refs.
|
IConditionExpr |
getExpr() |
java.util.HashSet<QuickTriggerable> |
getImmediateCascades() |
java.util.List<TreeReference> |
getTargets() |
java.util.Set<TreeReference> |
getTriggers() |
boolean |
isCascadingToChildren()
This should return true if this triggerable's targets will implicity modify the
value of their children.
|
void |
print(java.io.OutputStreamWriter w) |
void |
readExternal(java.io.DataInputStream in,
PrototypeFactory pf) |
void |
setImmediateCascades(java.util.HashSet<QuickTriggerable> cascades) |
void |
setWaveCount(int waveCount) |
java.lang.String |
toString() |
void |
writeExternal(java.io.DataOutputStream out) |
public static final java.util.Comparator<Triggerable> triggerablesRootOrdering
private IConditionExpr expr
private java.util.List<TreeReference> targets
private TreeReference contextRef
private TreeReference originalContextRef
private int waveCount
private java.util.HashSet<QuickTriggerable> immediateCascades
public Triggerable()
public Triggerable(IConditionExpr expr, TreeReference contextRef, java.util.ArrayList<TreeReference> targets)
public Triggerable(IConditionExpr expr, TreeReference contextRef)
public void setImmediateCascades(java.util.HashSet<QuickTriggerable> cascades)
public java.util.HashSet<QuickTriggerable> getImmediateCascades()
protected abstract java.lang.Object eval(FormInstance instance, EvaluationContext ec)
protected abstract void apply(TreeReference ref, java.lang.Object result, FormInstance mainInstance)
public abstract boolean canCascade()
public final java.util.List<EvaluationResult> apply(FormInstance mainInstance, EvaluationContext parentContext, TreeReference context)
mainInstance
- parentContext
- context
- public IConditionExpr getExpr()
public void addTarget(TreeReference target)
public java.util.List<TreeReference> getTargets()
public void setWaveCount(int waveCount)
public boolean isCascadingToChildren()
public java.util.Set<TreeReference> getTriggers()
java.lang.Boolean evalPredicate(FormInstance model, EvaluationContext evalContext)
java.lang.Object evalRaw(FormInstance model, EvaluationContext evalContext)
public void changeContextRefToIntersectWithTriggerable(Triggerable t)
public TreeReference contextualizeContextRef(TreeReference anchorRef)
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public void readExternal(java.io.DataInputStream in, PrototypeFactory pf) throws java.io.IOException, DeserializationException
readExternal
in interface Externalizable
java.io.IOException
DeserializationException
public void writeExternal(java.io.DataOutputStream out) throws java.io.IOException
writeExternal
in interface Externalizable
java.io.IOException
public java.lang.String toString()
toString
in class java.lang.Object
public void print(java.io.OutputStreamWriter w) throws java.io.IOException
java.io.IOException
public java.util.List<TreeReference> findAffectedTriggers(java.util.Map<TreeReference,java.util.List<TreeReference>> firedAnchorsMap)
firedAnchorsMap
- a map of absolute refs