public abstract class Stat<T>
extends java.lang.Object
implements java.lang.Cloneable, java.io.Serializable
Modifier and Type | Field and Description |
---|---|
protected StatDefinition |
definition |
static java.text.DecimalFormat |
FORMAT |
Constructor and Description |
---|
Stat(StatGroup group,
StatDefinition definition)
A stat registers itself with an owning group.
|
Modifier and Type | Method and Description |
---|---|
abstract void |
add(Stat<T> other)
Add the value of "other" to this stat.
|
abstract void |
clear()
Initialize the stat to the proper value at startup, or reset the
stat when copyAndClear() is called.
|
Stat<T> |
copy() |
Stat<T> |
copyAndClear()
Return a copy of this stat, and clear the stat's value.
|
abstract T |
get() |
StatDefinition |
getDefinition() |
protected abstract java.lang.String |
getFormattedValue()
Return a string with the stat value formatted as appropriate for
its type.
|
abstract boolean |
isNotSet()
Returns true if this stat is zero or null, as is appropriate for its
type.
|
abstract void |
set(T newValue)
Set the stat value.
|
java.lang.String |
toString() |
java.lang.String |
toStringVerbose()
Includes the per-stat description in the output string.
|
public static final java.text.DecimalFormat FORMAT
protected final StatDefinition definition
Stat(StatGroup group, StatDefinition definition)
public abstract T get()
public abstract void set(T newValue)
public abstract void clear()
public StatDefinition getDefinition()
protected abstract java.lang.String getFormattedValue()
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String toStringVerbose()
public abstract boolean isNotSet()
Copyright (c) 2004-2012 Oracle. All rights reserved.