org.eclipse.xtend.util.stdlib
Class CounterExtensions

java.lang.Object
  extended by org.eclipse.xtend.util.stdlib.AbstractStatefulExtensions<java.lang.Integer>
      extended by org.eclipse.xtend.util.stdlib.CounterExtensions
All Implemented Interfaces:
IExecutionContextAware

public class CounterExtensions
extends AbstractStatefulExtensions<java.lang.Integer>

A Counter (integer) associated to any object.


Field Summary
 
Fields inherited from class org.eclipse.xtend.util.stdlib.AbstractStatefulExtensions
exeCtx
 
Constructor Summary
CounterExtensions()
           
 
Method Summary
 int counterDec(java.lang.Object o)
          Decrements the counter
 int counterGet(java.lang.Object o)
          Returns the counter.
 int counterInc(java.lang.Object o)
          Increments the counter.
 int counterReset(java.lang.Object o)
          resets the counter to '0'.
 int counterSet(java.lang.Object o, int value)
          Sets the counter
protected  java.lang.Integer getDefault(java.lang.Object o)
           
 
Methods inherited from class org.eclipse.xtend.util.stdlib.AbstractStatefulExtensions
get, getKey, getVars, newMap, set, setExecutionContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CounterExtensions

public CounterExtensions()
Method Detail

counterReset

public int counterReset(java.lang.Object o)
resets the counter to '0'.

Parameters:
o - The context object for this counter.
Returns:
0

counterInc

public int counterInc(java.lang.Object o)
Increments the counter.

Parameters:
o - The context object for this counter.
Returns:
the incremented counter.

counterDec

public int counterDec(java.lang.Object o)
Decrements the counter

Parameters:
o - - context object
Returns:
the decremented counter.

counterSet

public int counterSet(java.lang.Object o,
                      int value)
Sets the counter

Parameters:
o - - context object
value - - the counter value to be set

counterGet

public int counterGet(java.lang.Object o)
Returns the counter.

Parameters:
o - - context object

getDefault

protected java.lang.Integer getDefault(java.lang.Object o)
Overrides:
getDefault in class AbstractStatefulExtensions<java.lang.Integer>