Class PointList

java.lang.Object
com.mta.tehreer.collections.PointList
All Implemented Interfaces:
Primitive

public abstract class PointList extends Object implements Primitive
Represents a primitive list of points.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    abstract void
    copyTo(float[] array, int atIndex)
    Copies all of the points in this list to an array, starting at the specified index of the target array.
    boolean
     
    abstract float
    getX(int index)
    Returns the x- coordinate of the point at the specified index in this list.
    abstract float
    getY(int index)
    Returns the y- coordinate of the point at the specified index in this list.
    int
     
    static PointList
    of(float... values)
    Returns a point list whose elements are the specified values.
    abstract int
    Returns the number of points in this list.
    abstract PointList
    subList(int fromIndex, int toIndex)
    Returns a view of the portion of this list between the specified fromIndex, inclusive, and toIndex, exclusive.
    float[]
    Returns a new array containing all of the elements in this list in proper sequence (from first to last element).
     

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • PointList

      public PointList()
  • Method Details

    • of

      @NonNull public static PointList of(@Size(multiple=2L) float... values)
      Returns a point list whose elements are the specified values. Even numbered entries will become the x- coordinates while odd numbered entries will become the y- coordinates.
      Parameters:
      values - The elements of the point list.
      Returns:
      A new point list.
    • size

      public abstract int size()
      Returns the number of points in this list.
      Returns:
      The number of points in this list.
    • getX

      public abstract float getX(int index)
      Returns the x- coordinate of the point at the specified index in this list.
      Parameters:
      index - Index of the point whose x- coordinate is returned.
      Returns:
      The x- coordinate of the point at the specified index in this list.
      Throws:
      IndexOutOfBoundsException - if the index is out of range (index < 0 || index >= size()).
    • getY

      public abstract float getY(int index)
      Returns the y- coordinate of the point at the specified index in this list.
      Parameters:
      index - Index of the point whose y- coordinate is returned.
      Returns:
      The y- coordinate of the point at the specified index in this list.
      Throws:
      IndexOutOfBoundsException - if the index is out of range (index < 0 || index >= size()).
    • copyTo

      public abstract void copyTo(@NonNull float[] array, int atIndex)
      Copies all of the points in this list to an array, starting at the specified index of the target array. Each x- coordinate will be followed by y- coordinate of the point in the target array.
      Parameters:
      array - The array into which the points of this list are to be copied.
      atIndex - The index in the target array at which copying begins.
      Throws:
      NullPointerException - if array is null.
      IndexOutOfBoundsException - for an illegal endpoint index value (atIndex < 0 || (array.length - atIndex) < size() * 2).
    • subList

      @NonNull public abstract PointList subList(int fromIndex, int toIndex)
      Returns a view of the portion of this list between the specified fromIndex, inclusive, and toIndex, exclusive.
      Parameters:
      fromIndex - Low endpoint (inclusive) of the sub list.
      toIndex - High endpoint (exclusive) of the sub list.
      Returns:
      A view of the specified range within this list.
      Throws:
      IndexOutOfBoundsException - for an illegal endpoint index value (fromIndex < 0 || toIndex > size() || fromIndex > toIndex).
    • toArray

      @NonNull @Size(multiple=2L) public float[] toArray()
      Returns a new array containing all of the elements in this list in proper sequence (from first to last element). Even numbered array entries will be the x- coordinates while odd numbered array entries will be the y- coordinates.
      Returns:
      A new array containing all of the elements in this list in proper sequence.
    • equals

      public boolean equals(@Nullable Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      @NonNull public String toString()
      Overrides:
      toString in class Object