Package net.sf.colossus.util
Class ValueRecorder
- java.lang.Object
-
- net.sf.colossus.util.ValueRecorder
-
- All Implemented Interfaces:
IValueRecorderItem
public class ValueRecorder extends java.lang.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
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private classValueRecorder.TrivialValueRecorderItem
-
Field Summary
Fields Modifier and Type Field Description private java.lang.Stringdescprivate java.util.List<IValueRecorderItem>itemsAll the explanations and value changesprivate floatscaleprivate intvalueThe current value
-
Constructor Summary
Constructors Constructor Description ValueRecorder()ValueRecorder(java.lang.String desc)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(int v, java.lang.String r)Augment the value.voidadd(ValueRecorder v)Augment the value.java.lang.StringgetFull(java.lang.String prefix)intgetValue()Get the value.java.lang.StringgetWhy(java.lang.String prefix)booleanisEmpty()booleanisReset()voidresetTo(int v, java.lang.String r)Reset the value to a specific value.voidsetScale(float scale)java.lang.StringtoString()Get the detailed explanations and final value as String.
-
-
-
Field Detail
-
value
private int value
The current value
-
scale
private float scale
-
desc
private final java.lang.String desc
-
items
private final java.util.List<IValueRecorderItem> items
All the explanations and value changes
-
-
Method Detail
-
isReset
public boolean isReset()
- Specified by:
isResetin interfaceIValueRecorderItem
-
add
public void add(int v, java.lang.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, java.lang.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:
getValuein interfaceIValueRecorderItem- Returns:
- The current value.
-
setScale
public void setScale(float scale)
-
isEmpty
public boolean isEmpty()
-
getWhy
public java.lang.String getWhy(java.lang.String prefix)
- Specified by:
getWhyin interfaceIValueRecorderItem
-
getFull
public java.lang.String getFull(java.lang.String prefix)
- Specified by:
getFullin interfaceIValueRecorderItem
-
toString
public java.lang.String toString()
Get the detailed explanations and final value as String.- Overrides:
toStringin classjava.lang.Object- Returns:
- The detailed explanations and final value.
-
-