Package rasj

Class RasPoint


  • public class RasPoint
    extends java.lang.Object
    
     PURPOSE:
     This class represents an n-dimensional point vector.
    • Constructor Summary

      Constructors 
      Constructor Description
      RasPoint()
      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​(java.lang.String stringRep)
      constructor taking a string representation for this point (for example "[1, 2, 3]").
      RasPoint​(RasPoint pt)
      Copy constructor that initializes this point with the values of the given one.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      RasPoint add​(RasPoint pt)
      Method for vector addition.
      int comparedWith​(RasPoint p)
      Compares this point to another point.
      int dimension()
      Gets the dimensionality of this point.
      boolean equals​(RasPoint pt)
      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.
      RasPoint mult​(RasPoint pt)
      Method for vector multiplication.
      boolean notEquals​(RasPoint pt)
      Method for testing inequality.
      void setItem​(int i, long value)
      write access to the i-th coordinate
      RasPoint setTo​(RasPoint pt)
      This method copies the values of the given point to the current point.
      RasPoint stream​(long newElement)
      Method for stream initialization of this point.
      java.lang.String toString()
      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 Detail

      • RasPoint

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

        public RasPoint​(java.lang.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 Detail

      • 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
      • 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
      • dimension

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

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