Class ItemCountFunction

    • Constructor Detail

      • ItemCountFunction

        public ItemCountFunction()
        Constructs an unnamed function.

        This constructor is intended for use by the SAX handler class only.

      • ItemCountFunction

        public ItemCountFunction​(String name)
        Constructs an item count report function.
        Parameters:
        name - The name of the function.
        Throws:
        NullPointerException - if the name is null
    • Method Detail

      • clear

        protected void clear()
      • getGroup

        public String getGroup()
        Returns the name of the group (possibly null) for this function. The item count is reset to zero at the start of each instance of this group.
        Specified by:
        getGroup in interface AggregationFunction
        Returns:
        the group name.
      • setGroup

        public void setGroup​(String group)
        Setss the name of the group for this function. The item count is reset to zero at the start of each instance of this group. If the name is null, all items in the report are counted.
        Specified by:
        setGroup in interface AggregationFunction
        Parameters:
        group - The group name.
      • groupStarted

        public void groupStarted​(ReportEvent event)
        Receives notification that a new group is about to start. Checks to see if the group that is starting is the same as the group defined for this function...if so, the item count is reset to zero.
        Specified by:
        groupStarted in interface ReportListener
        Overrides:
        groupStarted in class AbstractFunction
        Parameters:
        event - Information about the event.
      • getValue

        public Object getValue()
        Returns the number of items counted (so far) by the function. This is either the number of items in the report, or the group (if a group has been defined for the function).
        Specified by:
        getValue in interface Expression
        Returns:
        The item count.
      • clone

        public Object clone()
        Description copied from class: AbstractExpression
        Clones the expression. The expression should be reinitialized after the cloning.

        Expressions maintain no state, cloning is done at the beginning of the report processing to disconnect the expression from any other object space.

        Specified by:
        clone in interface Expression
        Overrides:
        clone in class AbstractExpression
        Returns:
        a clone of this expression.