|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object xdc.services.getset.Group
public class Group
A group of Fxn
s that are executed atomically. When any one of
them runs, the others are given a chance to run before anything else
happens. Allows atomic updates among a group of related fields,
so that code outside the Group should never see any inconsistency.
Constructor Summary | |
---|---|
Group()
Create a new Group governed by the given scheduler |
Method Summary | |
---|---|
Fxn |
add(Fxn fxn)
Add a new Fxn to the group, and execute it once. |
AutoFxn |
addAuto(org.mozilla.javascript.Callable body)
Wrap the given function body as an AutoFxn and add it to the group. |
void |
addStale(Fxn fxn)
Indicate that a Fxn in the group needs to be run. |
static int |
getMaxIterations()
Get the maximum number of iterations allowed in each group, as a debugging aid. |
Fxn |
getRunning()
|
boolean |
getScheduled()
Ask if the Group has already been scheduled to be run |
boolean |
getStale()
Ask if the group needs to be run. |
Fxn |
onSet(xdc.services.intern.xsr.Value.Observable obj,
int index,
org.mozilla.javascript.Callable body)
|
Fxn |
onSet(xdc.services.intern.xsr.Value.Observable obj,
java.lang.String name,
org.mozilla.javascript.Callable body)
Wrap the given function body as a Fxn and specify one input to fire on. |
void |
removeStale(Fxn fxn)
Indicate that a Fxn in the group no longer needs to be run. |
void |
run()
Run all the Fxns in the Group that need it. |
void |
schedule(Fxn fxn)
Mark the given Fxn as stale, and schedule the whole group to be run at the next opportunity. |
static void |
setMaxIterations(int maxIterations)
Get the maximum number of iterations allowed in each group, as a debugging aid. |
void |
setScheduled(boolean scheduled)
Indicate that the Group has now been scheduled to be run |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Group()
Method Detail |
---|
public Fxn onSet(xdc.services.intern.xsr.Value.Observable obj, java.lang.String name, org.mozilla.javascript.Callable body)
public Fxn onSet(xdc.services.intern.xsr.Value.Observable obj, int index, org.mozilla.javascript.Callable body)
public AutoFxn addAuto(org.mozilla.javascript.Callable body)
group.addAuto(function bToA(){ x.a = y.b; }); group.addAuto(function aToB(){ y.b = x.a; });This example constrains x.a and y.b to have the same value. Whenever one of them changes, one AutoFxn in the Group runs and copies the change to the other field. The Group is responsible for deciding when to execute each AutoFxn, based on examining its inputs and outputs.
public Fxn add(Fxn fxn)
public boolean getStale()
public void addStale(Fxn fxn)
public void removeStale(Fxn fxn)
public void setScheduled(boolean scheduled)
public boolean getScheduled()
public Fxn getRunning()
public void run()
public void schedule(Fxn fxn)
public static int getMaxIterations()
public static void setMaxIterations(int maxIterations)
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |