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 class
ValueRecorder.TrivialValueRecorderItem
-
Field Summary
Fields Modifier and Type Field Description private java.lang.String
desc
private java.util.List<IValueRecorderItem>
items
All the explanations and value changesprivate float
scale
private int
value
The 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 void
add(int v, java.lang.String r)
Augment the value.void
add(ValueRecorder v)
Augment the value.java.lang.String
getFull(java.lang.String prefix)
int
getValue()
Get the value.java.lang.String
getWhy(java.lang.String prefix)
boolean
isEmpty()
boolean
isReset()
void
resetTo(int v, java.lang.String r)
Reset the value to a specific value.void
setScale(float scale)
java.lang.String
toString()
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:
isReset
in 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:
getValue
in 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:
getWhy
in interfaceIValueRecorderItem
-
getFull
public java.lang.String getFull(java.lang.String prefix)
- Specified by:
getFull
in interfaceIValueRecorderItem
-
toString
public java.lang.String toString()
Get the detailed explanations and final value as String.- Overrides:
toString
in classjava.lang.Object
- Returns:
- The detailed explanations and final value.
-
-