Class ValueRecorder

java.lang.Object
net.sf.colossus.util.ValueRecorder
All Implemented Interfaces:
IValueRecorderItem

public class ValueRecorder extends Object implements IValueRecorderItem
An integer value, along with a detailed record of how and why the value has the value it has.
Author:
Romain Dolbeau
  • Field Details

    • value

      private int value
      The current value
    • scale

      private float scale
    • desc

      private final String desc
    • items

      private final List<IValueRecorderItem> items
      All the explanations and value changes
  • Constructor Details

    • ValueRecorder

      public ValueRecorder()
    • ValueRecorder

      public ValueRecorder(String desc)
  • Method Details

    • isReset

      public boolean isReset()
      Specified by:
      isReset in interface IValueRecorderItem
    • add

      public void add(int v, String r)
      Augment the value.
      Parameters:
      v - By how much the value change.
      r - The reason of the change.
    • add

      public void add(ValueRecorder v)
      Augment the value.
      Parameters:
      v - By how much the value change, and why
    • resetTo

      public void resetTo(int v, String r)
      Reset the value to a specific value.
      Parameters:
      v - The new value to use.
      r - The reason of the change.
    • getValue

      public int getValue()
      Get the value.
      Specified by:
      getValue in interface IValueRecorderItem
      Returns:
      The current value.
    • setScale

      public void setScale(float scale)
    • isEmpty

      public boolean isEmpty()
    • getWhy

      public String getWhy(String prefix)
      Specified by:
      getWhy in interface IValueRecorderItem
    • getFull

      public String getFull(String prefix)
      Specified by:
      getFull in interface IValueRecorderItem
    • toString

      public String toString()
      Get the detailed explanations and final value as String.
      Overrides:
      toString in class Object
      Returns:
      The detailed explanations and final value.