|
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.visitor.CountingVisitor
@Participant(value="ConcreteVisitor") public class CountingVisitor
A counting visitor counts the different types of
value visitable sequences
encountered during traversal, and is thus independent
of any given scanner implementation.
A counting visitor does accumulate information about the visited
sequences, but does not require any arguments at execution time.
The result of the visitation can be fetched using the appropriate
getter methods, for example getIntegerValued() for
the number of sequences visited that delivered Integer
values. Each time a given sequence instance is visited, the count
will be increased, even if the sequence has already been visited.
Before reuse, a counting visitor must be reset
for the count to be accurate.
LoggingVisitor,
TypeVisitor,
SimpleScanner| Field Summary | |
|---|---|
private int |
composites
Number of visitable sequences that were composite sequences
with a specific value type. |
private int |
dateValued
Number of visitable sequences that delivered Date values. |
private int |
integerValued
Number of visitable sequences that delivered Integer values. |
private int |
longValued
Number of visitable sequences that delivered Long values. |
private int |
stringValued
Number of visitable sequences that delivered any type of CharSequence values. |
private int |
unknowns
Number of visitable sequences that delivered unknown values (excluding composites). |
| Constructor Summary | |
|---|---|
CountingVisitor()
No-arg constructor. |
|
| Method Summary | |
|---|---|
int |
getComposites()
Returns the number of value visitable
sequences that were composites and where the type of value was
unknown. |
int |
getDateValued()
Returns the number of value visitable
sequences that delivered Date values. |
int |
getIntegerValued()
Returns the number of value visitable
sequences that delivered Integer values. |
int |
getLongValued()
Returns the number of value visitable
sequences that delivered Long values. |
int |
getStringValued()
Returns the number of value visitable
sequences that delivered any type of CharSequence values. |
int |
getTotal()
Returns the total number of value
visitable sequences that were visited. |
int |
getUnknowns()
Returns the number of value visitable
sequences where the type of value was unknown, excluding composites. |
void |
reset()
Resets this visitor before re-scanning. |
String |
toString()
Returns the string representation of this visitor. |
void |
visitDateValued(Sequence<Date> sequence,
Void unused)
Visits a sequence that delivers Date
sequence values. |
void |
visitIntegerValued(Sequence<Integer> sequence,
Void unused)
Visits a sequence that delivers Integer
sequence values. |
void |
visitLongValued(Sequence<Long> sequence,
Void unused)
Visits a sequence that delivers Long
sequence values. |
void |
visitStringValued(Sequence<? extends CharSequence> sequence,
Void unused)
Visits a sequence that delivers any type of
value that implements the CharSequence interface,
including CharSequence it self. |
void |
visitUnknown(Sequence<?> sequence,
Void unused)
Visits a sequence that cannot be visited
by any other visitation methods declared by this visitor. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
private int composites
composite sequences
with a specific value type.
private int dateValued
Date values.
private int integerValued
Integer values.
private int longValued
Long values.
private int stringValued
CharSequence values.
private int unknowns
| Constructor Detail |
|---|
public CountingVisitor()
| Method Detail |
|---|
public int getComposites()
value visitable
sequences that were composites and where the type of value was
unknown.
public int getDateValued()
value visitable
sequences that delivered Date values.
public int getIntegerValued()
value visitable
sequences that delivered Integer values.
public int getLongValued()
value visitable
sequences that delivered Long values.
public int getStringValued()
value visitable
sequences that delivered any type of CharSequence values.
public int getTotal()
value
visitable sequences that were visited.
public int getUnknowns()
value visitable
sequences where the type of value was unknown, excluding composites.
public void reset()
public String toString()
toString in class Object
public void visitDateValued(Sequence<Date> sequence,
Void unused)
SequenceValueVisitorsequence that delivers Date
sequence values.
visitDateValued in interface SequenceValueVisitor<Void>sequence - The sequence to visit; never null.unused - A visitor-specified argument, if any; nullability
determined by the visitor implementation.
public void visitIntegerValued(Sequence<Integer> sequence,
Void unused)
SequenceValueVisitorsequence that delivers Integer
sequence values.
visitIntegerValued in interface SequenceValueVisitor<Void>sequence - The sequence to visit; never null.unused - A visitor-specified argument, if any; nullability
determined by the visitor implementation.
public void visitLongValued(Sequence<Long> sequence,
Void unused)
SequenceValueVisitorsequence that delivers Long
sequence values.
visitLongValued in interface SequenceValueVisitor<Void>sequence - The sequence to visit; never null.unused - A visitor-specified argument, if any; nullability
determined by the visitor implementation.
public void visitStringValued(Sequence<? extends CharSequence> sequence,
Void unused)
SequenceValueVisitorsequence that delivers any type of
value that implements the CharSequence interface,
including CharSequence it self.
visitStringValued in interface SequenceValueVisitor<Void>sequence - The sequence to visit; never null.unused - A visitor-specified argument, if any; nullability
determined by the visitor implementation.
public void visitUnknown(Sequence<?> sequence,
Void unused)
SequenceVisitorsequence that cannot be visited
by any other visitation methods declared by this visitor.
visitUnknown in interface SequenceVisitor<Void>sequence - The sequence to visit; never null.unused - A visitor-specified argument, if any; nullability
determined by the visitor implementation.
|
Gunni Rode / rode.dk | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||