Class PointLocation

  • All Implemented Interfaces:
    java.io.Serializable, Location

    public class PointLocation
    extends AbstractRangeLocation
    implements Location, java.io.Serializable
    A location representing a single point. This can be considered as the singleton set of one integer.

    min and max are always equal for this implementation

    Author:
    Matthew Pocock
    See Also:
    Serialized Form
    • Constructor Detail

      • PointLocation

        public PointLocation​(int point)
    • Method Detail

      • getMin

        public int getMin()
        Description copied from interface: Location
        The minimum position contained.

        WARNING: The location will not contain every point between getMin() and getMax() if isContiguous() is false. If isContiguous() does return false you should use the Iterator returned by blockIterator() to iterate over the minimum set of contiguous blocks that make up this Location

        Specified by:
        getMin in interface Location
        Returns:
        the minimum position contained
      • getMax

        public int getMax()
        Description copied from interface: Location
        The maximum position contained.

        WARNING: The location will not contain every point between getMin() and getMax() if isContiguous() is false. If isContiguous() does return false you should use the Iterator returned by blockIterator() to iterate over the minimum set of contiguous blocks that make up this Location

        Specified by:
        getMax in interface Location
        Returns:
        the maximum position contained
      • contains

        public boolean contains​(int p)
        Description copied from interface: Location
        Checks if this location contains a point.
        Specified by:
        contains in interface Location
        Overrides:
        contains in class AbstractRangeLocation
        Parameters:
        p - the point to check
        Returns:
        true if this contains p, otherwise false
      • translate

        public Location translate​(int dist)
        Description copied from interface: Location
        Create a location that is a translation of this location.
        Specified by:
        translate in interface Location
        Parameters:
        dist - the distance to translate (to the right)
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object