Class SourceNodeImpl

    • Constructor Detail

      • SourceNodeImpl

        public SourceNodeImpl​(ICoverageNode.ElementType elementType,
                              java.lang.String name)
        Create a new source node implementation instance.
        Parameters:
        elementType - element type
        name - name of the element
    • Method Detail

      • ensureCapacity

        public void ensureCapacity​(int first,
                                   int last)
        Make sure that the internal buffer can keep lines from first to last. While the buffer is also incremented automatically, this method allows optimization in case the total range is known in advance.
        Parameters:
        first - first line number or ISourceNode.UNKNOWN_LINE
        last - last line number or ISourceNode.UNKNOWN_LINE
      • increment

        public void increment​(ISourceNode child)
        Increments all counters by the values of the given child. When incrementing the line counter it is assumed that the child refers to the same source file.
        Parameters:
        child - child node to add
      • increment

        public void increment​(ICounter instructions,
                              ICounter branches,
                              int line)
        Increments instructions and branches by the given counter values. If a optional line number is specified the instructions and branches are added to the given line. The line counter is incremented accordingly.
        Parameters:
        instructions - instructions to add
        branches - branches to add
        line - optional line number or ISourceNode.UNKNOWN_LINE
      • getFirstLine

        public int getFirstLine()
        Description copied from interface: ISourceNode
        The number of the first line coverage information is available for. If no line is contained, the method returns -1.
        Specified by:
        getFirstLine in interface ISourceNode
        Returns:
        number of the first line or ISourceNode.UNKNOWN_LINE
      • getLastLine

        public int getLastLine()
        Description copied from interface: ISourceNode
        The number of the last line coverage information is available for. If no line is contained, the method returns -1.
        Specified by:
        getLastLine in interface ISourceNode
        Returns:
        number of the last line or ISourceNode.UNKNOWN_LINE
      • getLine

        public LineImpl getLine​(int nr)
        Description copied from interface: ISourceNode
        Returns the line information for given line.
        Specified by:
        getLine in interface ISourceNode
        Parameters:
        nr - line number of interest
        Returns:
        line information