private class TotalAccumulator.Data extends java.lang.Object implements Accumulator.DataBundle
DataBundle
implementation which calculates a running
total, and returns it upon request.Modifier | Constructor and Description |
---|---|
private |
Data()
Construct an instance of this class, setting the starting total to
either unknown value or 0, depending upon whether the enclosing
accumulator is initialized for use.
|
Modifier and Type | Method and Description |
---|---|
void |
accumulate(BaseDataType datum)
Add the numeric value of
datum to the running total. |
void |
assign(Undoable value)
Sets the state of this instance based on the state of the passed instance.
|
BaseDataType |
calculate()
Return the current, running total.
|
Undoable |
deepCopy()
This is a form of a copy constructor that makes a deep copy of the
current instance and returns this copy as a new instance of the same
class.
|
void |
reset()
Reset (to zero) the total variable, in preparation for beginning a
new break group.
|
private decimal total
private Data()
public void reset()
reset
in interface Accumulator.DataBundle
public void accumulate(BaseDataType datum)
datum
to the running total.accumulate
in interface Accumulator.DataBundle
datum
- Datum to be accumulated; it is expected that this is a
numeric type. If this is unknown
then the
accumulated total will be unknown
.java.lang.ClassCastException
- if datum
cannot be cast to
NumberType
.public BaseDataType calculate()
calculate
in interface Accumulator.DataBundle
accumulate(com.goldencode.p2j.util.BaseDataType)
ever
occurred).public Undoable deepCopy()