Class Location.Set<D>

java.lang.Object
eu.bandm.tools.location.Location<D>
eu.bandm.tools.location.Location.Set<D>
All Implemented Interfaces:
Locatable<D>, Serializable, Cloneable
Enclosing class:
Location<D>

static class Location.Set<D> extends Location<D>
The third sub-class, representing regions with gaps, or even in different documents.
  • Constructor Details

    • Set

      Set(Collection<? extends Location<D>> regions)
      Construcor, not callable. The constructin goes viy the factors methods in Location
  • Method Details

    • mapDocumentId

      public <E> Location<E> mapDocumentId(Function<? super D,? extends E> f)
      Specified by:
      mapDocumentId in class Location<D>
      Returns:
      a new location, by applying "f" to the document id/ids therein.
    • isPoint

      public boolean isPoint()
      Description copied from class: Location
      Checks whether this location is a point. If this method returns true, then the reference point, begin point and end point of this location are all equal to this location.
      Specified by:
      isPoint in class Location<D>
      Returns:
      true if this location is a point, false if this location is an region or a set.
    • isRegion

      public boolean isRegion()
      Description copied from class: Location
      Checks whether this location is an Region. If this method returns true, then the region partition (as returned by Location.getRegions()) of this location contains a single location equal to this location.
      Specified by:
      isRegion in class Location<D>
      Returns:
      true if this location is a region, false if this location is a point or set.
    • getReferencePoint

      public Location<D> getReferencePoint()
      Description copied from class: Location
      Returns the reference point of this location. The reference point is a point. If this location is a point, then the reference point is equal to this location. If this location is an region, then the reference point lies within this location. If this location is a set, then the reference point lies within one of the member regions.
      Specified by:
      getReferencePoint in class Location<D>
      Returns:
      the reference point of this location.
    • getBeginPoint

      public Location<D> getBeginPoint()
      Description copied from class: Location
      Returns the begin point of this location. The begin point is a point. If this location is a point, then the begin point is equal to this location. If this location is an region, then the begin point lies at the beginning of this location. If this location is a set, then the begin point lies at the beginning of one of the member regions, such that there is no member region that lies in the same document and begins before the begin point.
      Specified by:
      getBeginPoint in class Location<D>
      Returns:
      the begin point of this location.
    • getEndPoint

      public Location<D> getEndPoint()
      Description copied from class: Location
      Returns the end point of this location. The end point is a point. If this location is a point, then the end point is equal to this location. If this location is an region, then the end point lies at the end of this location. If this location is a set, then the end point lies at the end of one of the member regions, such that there is no member region that lies in the same document and ends after the end point.
      Specified by:
      getEndPoint in class Location<D>
      Returns:
      the end point of this location.
    • getRegions

      public Collection<Location<D>> getRegions()
      Description copied from class: Location
      Returns every kind of Location as a collection of Point and Region instances. If this is a Point or Region, than only this is contained in that collection.
      Specified by:
      getRegions in class Location<D>
    • contains

      public boolean contains(Location<?> loc)
      Description copied from class: Location
      Whether the argument is contained in this Location. If this is a point, then this and loc must be identical. Otherwise for every Region or Point in loc there must be an Region or Point in this which completely contains it.
      Specified by:
      contains in class Location<D>
    • isContiguous

      public boolean isContiguous()
      Description copied from class: Location
      Whether this describes a set of characters in the same line. This is the case for every Point and possibly for an Region, but never for a Set.
      Specified by:
      isContiguous in class Location<D>
    • contiguousSize

      public int contiguousSize()
      Description copied from class: Location
      The number of spanned characters, if the Location Location.isContiguous()
      Specified by:
      contiguousSize in class Location<D>
    • abs2rel

      public int abs2rel(Location<D> loc)
      Description copied from class: Location
      Defined for Regions covering only one line: Delivers the relative offset (in column numbers) of the given position from the start of the region. And defined for two identic Points yielding 0.
      Specified by:
      abs2rel in class Location<D>
    • rel2abs

      public Location<D> rel2abs(int off)
      Description copied from class: Location
      Defined for Regions covering only one line: Delivers a point in the Region which has the given offset from the start of the region. And defined for a point and offset==0, yielding this point.
      Specified by:
      rel2abs in class Location<D>