Class Spectrum

java.lang.Object
eu.bandm.tools.location.Spectrum

public class Spectrum extends Object
A sequence of ascending non-overlapping, non-adjacent locations, maintained seperately for each document id. Points and Regions can be added. They will be merged as far as possible.

NB: The class has no length information about the lines of the target documents, so one region ending at "(docX, line n, column 1000)" and the other starting at "(docX, line n+1, 0)" cannot be merged.

  • Field Details

  • Constructor Details

    • Spectrum

      public Spectrum()
      Construct a new instance.
  • Method Details

    • getDocIds

      public Set<Object> getDocIds()
      Returns the set of all document ids occuring.
      Returns:
      the set of all document ids occuring.
    • getLocations

      @Opt public @Opt List<Location<Object>> getLocations(Object docId)
      Returns the list of all locations in the given document. Is sorted ascending.
      Parameters:
      docId - the document id for which all locations are returned.
      Returns:
      list of all Location with the given documentId.
    • add

      public void add(Location<?>... locs)
      Add locations and merge them with others, if appropriate.
      Parameters:
      locs - Locations to be added.
    • add

      public void add(Collection<Location<?>> locs)
      Add locations and merge them with others, if appropriate.
      Parameters:
      locs - Locations to be added.
    • dump

      public void dump(PrintStream p)
      Print a debugging output of all locations.
      Parameters:
      p - the target of the debug text output.