|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--sos.reports.ArrayBreakWeightRecorder
An implementation of BreakWeightRecorder
that uses an array
to record weights.
The final break position is determined as follows:
Field Summary |
Fields inherited from interface sos.reports.BreakWeightRecorder |
BAD_BREAK_WEIGHT, EXCELLENT_BREAK_WEIGHT, FORCED_BREAK_WEIGHT, GOOD_BREAK_WEIGHT, UNDEFINED_BREAK_WEIGHT |
Constructor Summary | |
ArrayBreakWeightRecorder(int length)
Creates an ArrayBreakWeightRecorder with the specified length. |
Method Summary | |
BreakWeightRecorder |
createView(int index,
int length)
Returns a view of this recorder. |
void |
fill(int weight)
Fills the entire clip range with the specified weight. |
void |
fill(int index,
int length,
int weight)
Fills the specified range with the specified weight. |
void |
fillEnd(int index,
int weight)
Fills the end portion with the specified weight. |
int |
getBestWeight()
Returns the best, or highest, break weight in the clip range. |
int |
getBreakIndex()
Returns the best place to break within the clip range, or -1 if such a place does not exist. |
int |
getFirstIndexOfWeight(int weight)
Returns the index of the first bit in the clip range with the specified weight. |
int |
getFirstIndexOfWeightAtLeast(int weight)
Returns the index of the first bit in the clip range with a weight greater than or equal to the specified weight. |
int |
getLastIndexOfWeight(int weight)
Returns the index of the last bit in the clip range with the specified weight. |
int |
getLastIndexOfWeightAtLeast(int weight)
Returns the index of the last bit in the clip range with a weight greater than or equal to the specified weight. |
int |
getRangeLength()
Returns the length of the clip range. |
int |
getRangeStart()
Returns the starting index of the clip range. |
int |
getWeight(int index)
Returns the weight at the specified index. |
void |
setRange(int index,
int length)
Sets this recorder's clip range. |
void |
setWeight(int index,
int weight)
Sets the weight at the specified index. |
java.lang.String |
toString()
Returns a string representation of this object. |
java.lang.String |
toString(int index,
int length)
Returns a string representation of this recorder over the specified range. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public ArrayBreakWeightRecorder(int length)
ArrayBreakWeightRecorder
with the specified length.
length
- total number of bitsMethod Detail |
public BreakWeightRecorder createView(int index, int length)
BreakWeightRecorder
length - 1
. Index 0 in the view corresponds to
index
in this recorder,
and index length - 1
corresponds to index + length - 1
.
Operations on the view within its range propagate to this recorder.The specified index and length are bound by this recorder's current range. That is, they are adjusted so that the view cannot operate outside this recorder's range.
createView
in interface BreakWeightRecorder
index
- index of this recorder to get mapped to index 0 of the returned viewlength
- number of indices to be in the view
length
indices and
translated by index
public void fill(int weight)
BreakWeightRecorder
fill
in interface BreakWeightRecorder
weight
- maximum weight that each bit in the clip range should havepublic void fill(int index, int length, int weight)
BreakWeightRecorder
The range is bound by this recorder's current clip range. That is, bits outside the clip range are ignored.
fill
in interface BreakWeightRecorder
index
- start index at which to set the weightlength
- number of bits for which to set the wieghtweight
- maximum weight that each bit in the specified range should haveBreakWeightRecorder.fill(int)
,
BreakWeightRecorder.fillEnd(int, int)
public void fillEnd(int index, int weight)
BreakWeightRecorder
The range is bound by this recorder's current clip range. That is, bits outside the clip range are ignored.
fillEnd
in interface BreakWeightRecorder
index
- start index at which to set the weightweight
- maximum weight that each bit in the specified range should havepublic int getBestWeight()
BreakWeightRecorder
getBestWeight
in interface BreakWeightRecorder
public int getBreakIndex()
BreakWeightRecorder
BAD_BREAK_WEIGHT
.
getBreakIndex
in interface BreakWeightRecorder
public int getFirstIndexOfWeight(int weight)
BreakWeightRecorder
getFirstIndexOfWeight
in interface BreakWeightRecorder
weight
- weight to seek
public int getFirstIndexOfWeightAtLeast(int weight)
BreakWeightRecorder
getFirstIndexOfWeightAtLeast
in interface BreakWeightRecorder
weight
- minimum weight to seek
public int getLastIndexOfWeight(int weight)
BreakWeightRecorder
getLastIndexOfWeight
in interface BreakWeightRecorder
weight
- weight to seek
public int getLastIndexOfWeightAtLeast(int weight)
BreakWeightRecorder
getLastIndexOfWeightAtLeast
in interface BreakWeightRecorder
weight
- minimum weight to seek
public int getRangeLength()
BreakWeightRecorder
getRangeLength
in interface BreakWeightRecorder
BreakWeightRecorder.getRangeStart()
,
BreakWeightRecorder.setRange(int, int)
public int getRangeStart()
BreakWeightRecorder
getRangeStart
in interface BreakWeightRecorder
BreakWeightRecorder.getRangeLength()
,
BreakWeightRecorder.setRange(int, int)
public int getWeight(int index)
BreakWeightRecorder
getWeight
in interface BreakWeightRecorder
index
- index at which to fetch the weight
index
public void setRange(int index, int length)
BreakWeightRecorder
The range is bound by this recorder's current clip range. That is, bits outside the clip range are ignored.
setRange
in interface BreakWeightRecorder
index
- start index of range to cliplength
- length of range to clippublic void setWeight(int index, int weight)
BreakWeightRecorder
index
is the minimum of the current weight and the
specified weight.
setWeight
in interface BreakWeightRecorder
index
- index at which to set the weightweight
- weight of a potential break at index
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String toString(int index, int length)
index
- index at which to start generating the stringlength
- number of bits to include in the string
java.lang.IllegalArgumentException
- if length < 0
java.lang.IndexOutOfBoundsException
- if index < 0
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |