|
Evaluating Software Design Patterns — the "Gang of Four" patterns implemented in Java 6 |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectdk.rode.thesis.iterator.LoggingValueProcessor
public class LoggingValueProcessor
A logging value processor logs the first X number of
sequence values during processing, where X is supplied
at construction time.
A logging processor can handle any type of sequence values.
Implementation notes:
This processor mimics the functionality of the internal iterator
described by Gamma et al. [Gamma95, p.268].
| Field Summary | |
|---|---|
private int |
count
The current number of processed sequence values. |
private int |
maximum
The maximum number of sequence values to log. |
| Constructor Summary | |
|---|---|
LoggingValueProcessor()
Constructor. |
|
LoggingValueProcessor(int maximum)
Constructor. |
|
| Method Summary | |
|---|---|
void |
initialise()
Resets the internal counter to zero. |
boolean |
process(Object value)
Process a given value and returns false if the processing is done, true if it must continue. |
String |
toString()
Returns the string representation of this processor. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
private int count
Range: 0 <= count <= min({@link #maximum}, size-of-sequence)
This count will be set to zero on initialisation.
private final int maximum
A value of Const.INFINITE means that the processing
will not be stopped by this processor.
| Constructor Detail |
|---|
public LoggingValueProcessor()
All sequence values will be logged.
public LoggingValueProcessor(int maximum)
maximum - The maximum number of sequence values to log;
must be larger than zero or Const.INFINITE.
NullPointerException - If maximum is illegal.| Method Detail |
|---|
public void initialise()
initialise in interface ValueProcessor<Object>public boolean process(Object value)
ValueProcessor
process in interface ValueProcessor<Object>value - The value to process; never null.
ProcessableSequence.process(ValueProcessor)public String toString()
toString in class Object
|
Gunni Rode / rode.dk | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||