Class CounterVisitor
- java.lang.Object
-
- pl.put.poznan.sqc.domain.visitors.CounterVisitor
-
- All Implemented Interfaces:
Visitor
- Direct Known Subclasses:
KeywordCounter
,StepCounter
public abstract class CounterVisitor extends Object implements Visitor
A shared class for concrete visitors that count something.This class contains an encapsulated counter and the methods to increment and access it. It is a piece of logic shared by concrete counters (based on the Visitor interface) that are meant to count something in a Scenario.
- See Also:
Visitor
,Scenario
,StepCounter
,KeywordCounter
-
-
Constructor Summary
Constructors Constructor Description CounterVisitor()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getCount()
Get the value of the counter.protected void
incrementCount()
Increment the counter.void
visit(Scenario scenario)
Visit a scenario.void
visit(StepList list)
Visit a list of steps.
-
-
-
Method Detail
-
incrementCount
protected void incrementCount()
Increment the counter.The value of the counter is incremented when some conditions in concrete visitors have been met.
It is
protected
because it should only be used by the concrete visitor based on this abstract class.
-
getCount
public int getCount()
Get the value of the counter.- Returns:
- the number of Scenario's elements that fulfill the conditions in concrete visitors
- See Also:
StepCounter
,KeywordCounter
-
visit
public void visit(Scenario scenario)
Visit a scenario.- Specified by:
visit
in interfaceVisitor
- Parameters:
scenario
- Scenario which will be analysed- See Also:
Scenario.accept(Visitor)
-
visit
public void visit(StepList list)
Visit a list of steps.- Specified by:
visit
in interfaceVisitor
- Parameters:
list
- StepList which will be analysed.- See Also:
StepList.accept(Visitor)
-
-