net.java.dev.moskito.core.stats.impl
Class IntValueHolder

java.lang.Object
  extended by net.java.dev.moskito.core.stats.impl.AbstractValueHolder
      extended by net.java.dev.moskito.core.stats.impl.IntValueHolder
All Implemented Interfaces:
IIntervalListener, ValueHolder

 class IntValueHolder
extends AbstractValueHolder

This class implements a ValueHolder that is able to process int values.

Author:
dvayanu
See Also:
ValueHolder

Field Summary
private  AtomicInteger currentValue
          This attribute stores the current value supporting concurrent access.
static int DEFAULT_DEFAULT_VALUE
          This is the value that will be used as defaultValue if no other one was specified.
private  int defaultValue
          This is the default value that this ValueHolder contains after a reset.
private  int lastValue
          The last value will be stored here.
 
Constructor Summary
IntValueHolder(Interval aInterval)
          The Constructor.
 
Method Summary
 void decrease()
          This method shall decrement the value by one.
 void decreaseByDouble(double aValue)
          This method shall decrement the current value by the given amount.
 void decreaseByInt(int aValue)
          This method shall decrement the current value by the given amount.
 void decreaseByLong(long aValue)
          This method shall decrement the current value by the given amount.
 double getCurrentValueAsDouble()
          This method shall return the current value as double for internal use only.
 int getCurrentValueAsInt()
          This method shall return the current value as int for internal use only.
 long getCurrentValueAsLong()
          This method shall return the current value as long for internal use only.
 int getLastValue()
          This method returns the lastValue.
 double getValueAsDouble()
          This method shall return the current value as double.
 int getValueAsInt()
          This method shall return the current value as int.
 long getValueAsLong()
          This method shall return the current value as long.
 void increase()
          This method shall increment the value by one.
 void increaseByDouble(double aValue)
          This method shall increment the current value by the given amount.
 void increaseByInt(int aValue)
          This method shall increment the current value by the given amount.
 void increaseByLong(long aValue)
          This method shall increment the current value by the given amount.
 void intervalUpdated(Interval aCaller)
          This method will be called if the time of the given Interval was elapsed.
 void reset()
          This method shall reset the ValueHolder.
 void setDefaultValueAsDouble(double aValue)
          This method shall set a new default value.
 void setDefaultValueAsInt(int aValue)
          This method shall set a new default value.
 void setDefaultValueAsLong(long aValue)
          This method shall set a new default value.
 void setValueAsDouble(double aValue)
          This method shall assign the given value to the current value.
 void setValueAsInt(int aValue)
          This method shall assign the given value to the current value.
 void setValueAsLong(long aValue)
          This method shall assign the given value to the current value.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_DEFAULT_VALUE

public static final int DEFAULT_DEFAULT_VALUE
This is the value that will be used as defaultValue if no other one was specified.

See Also:
Constant Field Values

currentValue

private AtomicInteger currentValue
This attribute stores the current value supporting concurrent access.


lastValue

private int lastValue
The last value will be stored here.


defaultValue

private int defaultValue
This is the default value that this ValueHolder contains after a reset.

Constructor Detail

IntValueHolder

public IntValueHolder(Interval aInterval)
The Constructor.

Parameters:
aInterval - this is the Interval this value will be updated
Method Detail

intervalUpdated

public void intervalUpdated(Interval aCaller)
Description copied from interface: IIntervalListener
This method will be called if the time of the given Interval was elapsed.

Parameters:
aCaller - The Interval that calls this method
See Also:
net.java.dev.moskito.core.stats.IIntervalListener#intervalUpdated(net.java.dev.moskito.core.stats.impl.IntervalImpl)

getLastValue

public int getLastValue()
This method returns the lastValue.

Returns:
the lastValue

toString

public String toString()
Overrides:
toString in class AbstractValueHolder
See Also:
AbstractValueHolder.toString()

decrease

public void decrease()
Description copied from interface: ValueHolder
This method shall decrement the value by one.

See Also:
ValueHolder.decrease()

increase

public void increase()
Description copied from interface: ValueHolder
This method shall increment the value by one.

See Also:
ValueHolder.increase()

decreaseByDouble

public void decreaseByDouble(double aValue)
Description copied from interface: ValueHolder
This method shall decrement the current value by the given amount.

Parameters:
aValue - the amount
See Also:
ValueHolder.decreaseByDouble(double)

decreaseByInt

public void decreaseByInt(int aValue)
Description copied from interface: ValueHolder
This method shall decrement the current value by the given amount.

Parameters:
aValue - the amount
See Also:
ValueHolder.decreaseByInt(int)

decreaseByLong

public void decreaseByLong(long aValue)
Description copied from interface: ValueHolder
This method shall decrement the current value by the given amount.

Parameters:
aValue - the amount
See Also:
ValueHolder.decreaseByLong(long)

getValueAsDouble

public double getValueAsDouble()
Description copied from interface: ValueHolder
This method shall return the current value as double.

Returns:
the current value
See Also:
ValueHolder.getValueAsDouble()

getValueAsInt

public int getValueAsInt()
Description copied from interface: ValueHolder
This method shall return the current value as int.

Returns:
the current value
See Also:
ValueHolder.getValueAsInt()

getValueAsLong

public long getValueAsLong()
Description copied from interface: ValueHolder
This method shall return the current value as long.

Returns:
the current value
See Also:
ValueHolder.getValueAsLong()

increaseByDouble

public void increaseByDouble(double aValue)
Description copied from interface: ValueHolder
This method shall increment the current value by the given amount.

Parameters:
aValue - the amount
See Also:
ValueHolder.increaseByDouble(double)

increaseByInt

public void increaseByInt(int aValue)
Description copied from interface: ValueHolder
This method shall increment the current value by the given amount.

Parameters:
aValue - the amount
See Also:
ValueHolder.increaseByInt(int)

increaseByLong

public void increaseByLong(long aValue)
Description copied from interface: ValueHolder
This method shall increment the current value by the given amount.

Parameters:
aValue - the amount
See Also:
ValueHolder.increaseByLong(long)

setValueAsDouble

public void setValueAsDouble(double aValue)
Description copied from interface: ValueHolder
This method shall assign the given value to the current value.

Parameters:
aValue - the new value
See Also:
ValueHolder.setValueAsDouble(double)

setValueAsInt

public void setValueAsInt(int aValue)
Description copied from interface: ValueHolder
This method shall assign the given value to the current value.

Parameters:
aValue - the new value
See Also:
ValueHolder.setValueAsInt(int)

setValueAsLong

public void setValueAsLong(long aValue)
Description copied from interface: ValueHolder
This method shall assign the given value to the current value.

Parameters:
aValue - the new value
See Also:
ValueHolder.setValueAsLong(long)

setDefaultValueAsLong

public void setDefaultValueAsLong(long aValue)
Description copied from interface: ValueHolder
This method shall set a new default value. The default value shall be set as current value if the reset method will be called.

Parameters:
aValue - the new default value
See Also:
ValueHolder.setDefaultValueAsLong(long)

setDefaultValueAsInt

public void setDefaultValueAsInt(int aValue)
Description copied from interface: ValueHolder
This method shall set a new default value. The default value shall be set as current value if the reset method will be called.

Parameters:
aValue - the new default value
See Also:
ValueHolder.setDefaultValueAsInt(int)

setDefaultValueAsDouble

public void setDefaultValueAsDouble(double aValue)
Description copied from interface: ValueHolder
This method shall set a new default value. The default value shall be set as current value if the reset method will be called.

Parameters:
aValue - the new default value
See Also:
ValueHolder.setDefaultValueAsDouble(double)

reset

public void reset()
Description copied from interface: ValueHolder
This method shall reset the ValueHolder. After calling reset() it must have the same state as directly after creation.

See Also:
ValueHolder.reset()

getCurrentValueAsDouble

public double getCurrentValueAsDouble()
Description copied from interface: ValueHolder
This method shall return the current value as double for internal use only.

Returns:
the current value
See Also:
ValueHolder.getCurrentValueAsDouble()

getCurrentValueAsInt

public int getCurrentValueAsInt()
Description copied from interface: ValueHolder
This method shall return the current value as int for internal use only.

Returns:
the current value
See Also:
ValueHolder.getCurrentValueAsInt()

getCurrentValueAsLong

public long getCurrentValueAsLong()
Description copied from interface: ValueHolder
This method shall return the current value as long for internal use only.

Returns:
the current value
See Also:
ValueHolder.getCurrentValueAsLong()


Copyright © 2006 MoSKito Project Team. All Rights Reserved.
MoSKito, the open source java monitoring framework