Class 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 Detail

      • CounterVisitor

        public CounterVisitor()
    • 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