Package rasj

Class RasPoint

java.lang.Object
rasj.RasPoint

public class RasPoint extends Object

 PURPOSE:
 This class represents an n-dimensional point vector.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Default constructor.
    RasPoint(int dim)
    Constructor getting the dimensionality for stream initialization.
    RasPoint(long p1, long p2)
    Easy-to-use constructor for two dimensional points.
    RasPoint(long p1, long p2, long p3)
    Easy-to-use constructor for three dimensional points.
    RasPoint(long p1, long p2, long p3, long p4)
    Easy-to-use constructor for four dimensional points.
    RasPoint(long p1, long p2, long p3, long p4, long p5)
    Easy-to-use constructor for five dimensional points.
    RasPoint(String stringRep)
    constructor taking a string representation for this point (for example "[1, 2, 3]").
    Copy constructor that initializes this point with the values of the given one.
  • Method Summary

    Modifier and Type
    Method
    Description
    Method for vector addition.
    final int
    Compares this point to another point.
    int
    Gets the dimensionality of this point.
    boolean
    Method for testing equality of two points.
    Two points are equal if they have the same dimensionality and identic values in each dimension.
    long
    item(int i)
    Read access to the i-th coordinate.
    Method for vector multiplication.
    boolean
    Method for testing inequality.
    void
    setItem(int i, long value)
    write access to the i-th coordinate
    final RasPoint
    This method copies the values of the given point to the current point.
    stream(long newElement)
    Method for stream initialization of this point.
    Gives back the string representation of this point.

    Methods inherited from class java.lang.Object

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

    • RasPoint

      public RasPoint(int dim)
      Constructor getting the dimensionality for stream initialization.
      Parameters:
      dim - the dimensionality of this point
    • RasPoint

      public RasPoint(String stringRep)
      constructor taking a string representation for this point (for example "[1, 2, 3]").
      Parameters:
      stringRep - the string representation for this point
    • RasPoint

      public RasPoint(long p1, long p2)
      Easy-to-use constructor for two dimensional points.
      Parameters:
      p1 - the value of the first dimension
      p2 - the value of the second dimension
    • RasPoint

      public RasPoint(long p1, long p2, long p3)
      Easy-to-use constructor for three dimensional points.
      Parameters:
      p1 - the value of the first dimension
      p2 - the value of the second dimension
      p3 - the value of the third dimension
    • RasPoint

      public RasPoint(long p1, long p2, long p3, long p4)
      Easy-to-use constructor for four dimensional points.
      Parameters:
      p1 - the value of the first dimension
      p2 - the value of the second dimension
      p3 - the value of the third dimension
      p4 - the value of the fourth dimension
    • RasPoint

      public RasPoint(long p1, long p2, long p3, long p4, long p5)
      Easy-to-use constructor for five dimensional points.
      Parameters:
      p1 - the value of the first dimension
      p2 - the value of the second dimension
      p3 - the value of the third dimension
      p4 - the value of the fourth dimension
      p5 - the value of the fifth dimension
    • RasPoint

      public RasPoint()
      Default constructor.
    • RasPoint

      public RasPoint(RasPoint pt)
      Copy constructor that initializes this point with the values of the given one.
      Parameters:
      pt - the point used to copy the values from
  • Method Details

    • stream

      public RasPoint stream(long newElement) throws RasStreamInputOverflowException
      Method for stream initialization of this point.
      Parameters:
      newElement - a new dimension that is added to this point
      Throws:
      RasStreamInputOverflowException
    • item

      public long item(int i) throws RasIndexOutOfBoundsException
      Read access to the i-th coordinate.
      Parameters:
      i - the dimension that is to be read
      Returns:
      the value of the i-th coordinate
      Throws:
      RasIndexOutOfBoundsException
    • setItem

      public void setItem(int i, long value) throws RasIndexOutOfBoundsException
      write access to the i-th coordinate
      Parameters:
      i - the coordinate that is to be accessed
      value - the value that is to be assigned to the specified coordinate
      Throws:
      RasIndexOutOfBoundsException
    • setTo

      public final RasPoint setTo(RasPoint pt) throws RasIndexOutOfBoundsException
      This method copies the values of the given point to the current point. All previously defined values of the current point will be deleted.
      Parameters:
      pt - the point to be copied
      Returns:
      the current point with its new values
      Throws:
      RasIndexOutOfBoundsException
    • comparedWith

      public final int comparedWith(RasPoint p)
      Compares this point to another point.
      Parameters:
      p - the point to be compared
      Returns:
      -2 if the points have not the same dimensionality
      -1 if the current point is "lesser" than point p.
      In this context, "lesser" refers to the comparison of the coordinates in decreasing order of magnitude For example, the point (2,2,9) is "lesser" than the point (2,3,1).
      0 if the two points have an equal value
      1 if the current point is "greater" than point p ("greater" is the opposite of "lesser").
    • equals

      public boolean equals(RasPoint pt) throws RasDimensionMismatchException
      Method for testing equality of two points.
      Two points are equal if they have the same dimensionality and identic values in each dimension.
      Parameters:
      pt - the point that is compared to the current point
      Returns:
      true if the two points are equal
      Throws:
      RasDimensionMismatchException
    • notEquals

      public boolean notEquals(RasPoint pt) throws RasDimensionMismatchException
      Method for testing inequality. This is the negation of the equals method.
      Parameters:
      pt - the point that is compared to the current point
      Returns:
      true if the two points are not equal
      Throws:
      RasDimensionMismatchException
    • add

      Method for vector addition. The current point will be modified to contain the result of the addition.
      Parameters:
      pt - the point ot be added to the current point
      Returns:
      the current point after the addition
      Throws:
      RasDimensionMismatchException
    • mult

      Method for vector multiplication. The current point will be modified to contain the result of the multiplication.
      Parameters:
      pt - the point ot be multiplied to the current point
      Returns:
      the current point after the multiplication
      Throws:
      RasDimensionMismatchException
    • dimension

      public int dimension()
      Gets the dimensionality of this point.
      Returns:
      the dimensionality of this point
    • toString

      public String toString()
      Gives back the string representation of this point.
      Overrides:
      toString in class Object
      Returns:
      the string representation of this point