Package eu.bandm.tools.location
Class Spectrum
java.lang.Object
eu.bandm.tools.location.Spectrum
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 Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Add locations and merge them with others, if appropriate.void
add
(Collection<Location<?>> locs) Add locations and merge them with others, if appropriate.void
dump
(PrintStream p) Print a debugging output of all locations.Returns the set of all document ids occuring.getLocations
(Object docId) Returns the list of all locations in the given document.
-
Field Details
-
byDocId
List of all contained Locations, by the containing document Id.
-
-
Constructor Details
-
Spectrum
public Spectrum()Construct a new instance.
-
-
Method Details
-
getDocIds
Returns the set of all document ids occuring.- Returns:
- the set of all document ids occuring.
-
getLocations
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
Add locations and merge them with others, if appropriate.- Parameters:
locs
- Locations to be added.
-
add
Add locations and merge them with others, if appropriate.- Parameters:
locs
- Locations to be added.
-
dump
Print a debugging output of all locations.- Parameters:
p
- the target of the debug text output.
-