|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object cz.cuni.amis.utils.flag.Flag.DoInSync<T>
T
- public abstract static class Flag.DoInSync<T>
Usage of this abstract class is as simple as it could be ... all you have to do is to instantiate it (using anonymous objects).
Example:
flag.inSync(
new Flag.DoInSync<Integer>(flag) {
public abstract void execute(Integer flagValue) {
setFlag(flagValue+1);
}
}
);
Flag<Integer> flag = new Flag<Integer>(10);
No need to do anything else! The class will submit itself to the flag upon construction.
Use it to create correct counters (or use directly FlagInteger class).
Constructor Summary | |
---|---|
Flag.DoInSync()
|
Method Summary | |
---|---|
abstract void |
execute(T flagValue)
|
protected T |
getFlag()
|
protected boolean |
isImmutable()
Tells you whether you operate over immutable flag (can't call setFlag() then) or not. |
protected void |
setFlag(T value)
Set value in sync. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Flag.DoInSync()
Method Detail |
---|
protected boolean isImmutable()
protected void setFlag(T value)
protected T getFlag()
public abstract void execute(T flagValue)
flag
-
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |