Class Tuple2d<RT extends Tuple2d<? super RT>>

    • Field Summary

      Fields 
      Modifier and Type Field Description
      (package private) double x
      x coordinate.
      (package private) double y
      y coordinate.
    • Constructor Summary

      Constructors 
      Constructor Description
      Tuple2d()
      Construct a zero tuple.
      Tuple2d​(double[] tuple)
      Constructor.
      Tuple2d​(double x, double y)
      Construct a tuple with the given coordinates.
      Tuple2d​(int[] tuple)
      Constructor.
      Tuple2d​(int x, int y)
      Construct a tuple with the given coordinates.
      Tuple2d​(Tuple2D<?> tuple)
      Constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void absolute()
      Sets each component of this tuple to its absolute value.
      void absolute​(Tuple2D<?> tuple)
      Sets each component of the tuple parameter to its absolute value and places the modified values into this tuple.
      void add​(double x, double y)
      Sets the value of this tuple to the sum of itself and x and y.
      void add​(int x, int y)
      Sets the value of this tuple to the sum of itself and x and y.
      void addX​(double x)
      Sets the x value of this tuple to the sum of itself and x.
      void addX​(int x)
      Sets the x value of this tuple to the sum of itself and x.
      void addY​(double y)
      Sets the y value of this tuple to the sum of itself and y.
      void addY​(int y)
      Sets the y value of this tuple to the sum of itself and y.
      RT clone()
      Clone this point.
      boolean equals​(Object t1)
      Returns true if the Object t1 is of type Tuple2D and all of the data members of t1 are equal to the corresponding data members in this Tuple2D.
      double getX()
      Get the x coordinate.
      double getY()
      Get the y coordinate.
      int hashCode()
      Returns a hash code value based on the data values in this object.
      int ix()
      Get the x coordinate.
      int iy()
      Get the y coordinate.
      void negate()
      Negates the value of this tuple in place.
      void negate​(Tuple2D<?> tuple)
      Sets the value of this tuple to the negation of tuple t1.
      void scale​(double scale)
      Sets the value of this tuple to the scalar multiplication of the scale factor with this.
      void scale​(double scale, Tuple2D<?> tuple)
      Sets the value of this tuple to the scalar multiplication of tuple t1.
      void scale​(int scale)
      Sets the value of this tuple to the scalar multiplication of the scale factor with this.
      void scale​(int scale, Tuple2D<?> tuple)
      Sets the value of this tuple to the scalar multiplication of tuple t1.
      void set​(double[] tuple)
      Sets the value of this tuple from the 2 values specified in the array.
      void set​(double x, double y)
      Sets the value of this tuple to the specified x and y coordinates.
      void set​(int[] tuple)
      Sets the value of this tuple from the 2 values specified in the array.
      void set​(int x, int y)
      Sets the value of this tuple to the specified x and y coordinates.
      void set​(Tuple2D<?> tuple)
      Sets the value of this tuple to the value of tuple t1.
      void setX​(double x)
      Set the x coordinate.
      void setX​(int x)
      Set the x coordinate.
      void setY​(double y)
      Set the y coordinate.
      void setY​(int y)
      Set the y coordinate.
      void sub​(double x, double y)
      Sets the value of this tuple to the difference of itself and x and y.
      void sub​(int x, int y)
      Sets the value of this tuple to the difference of itself and x and y.
      void subX​(double x)
      Sets the x value of this tuple to the difference of itself and x.
      void subX​(int x)
      Sets the x value of this tuple to the difference of itself and x.
      void subY​(double y)
      Sets the y value of this tuple to the difference of itself and y.
      void subY​(int y)
      Sets the y value of this tuple to the difference of itself and y.
      void toJson​(JsonBuffer buffer)
      Replies the Json representation of this node.
      String toString()  
    • Field Detail

      • x

        double x
        x coordinate.
      • y

        double y
        y coordinate.
    • Constructor Detail

      • Tuple2d

        public Tuple2d()
        Construct a zero tuple.
      • Tuple2d

        public Tuple2d​(Tuple2D<?> tuple)
        Constructor.
        Parameters:
        tuple - is the tuple to copy.
      • Tuple2d

        public Tuple2d​(int[] tuple)
        Constructor.
        Parameters:
        tuple - is the tuple to copy.
      • Tuple2d

        public Tuple2d​(double[] tuple)
        Constructor.
        Parameters:
        tuple - is the tuple to copy.
      • Tuple2d

        public Tuple2d​(int x,
                       int y)
        Construct a tuple with the given coordinates.
        Parameters:
        x - x coordinate.
        y - y coordinate.
      • Tuple2d

        public Tuple2d​(double x,
                       double y)
        Construct a tuple with the given coordinates.
        Parameters:
        x - x coordinate.
        y - y coordinate.
    • Method Detail

      • clone

        @Pure
        public RT clone()
        Description copied from interface: Tuple2D
        Clone this point.
        Specified by:
        clone in interface Tuple2D<RT extends Tuple2d<? super RT>>
        Overrides:
        clone in class Object
        Returns:
        the clone.
      • absolute

        public void absolute()
        Description copied from interface: Tuple2D
        Sets each component of this tuple to its absolute value.
        Specified by:
        absolute in interface Tuple2D<RT extends Tuple2d<? super RT>>
      • absolute

        public void absolute​(Tuple2D<?> tuple)
        Description copied from interface: Tuple2D
        Sets each component of the tuple parameter to its absolute value and places the modified values into this tuple.
        Specified by:
        absolute in interface Tuple2D<RT extends Tuple2d<? super RT>>
        Parameters:
        tuple - the source tuple, which will not be modified
      • add

        public void add​(int x,
                        int y)
        Description copied from interface: Tuple2D
        Sets the value of this tuple to the sum of itself and x and y.
        Specified by:
        add in interface Tuple2D<RT extends Tuple2d<? super RT>>
        Parameters:
        x - x coordinate to add.
        y - y coordinate to add.
      • add

        public void add​(double x,
                        double y)
        Description copied from interface: Tuple2D
        Sets the value of this tuple to the sum of itself and x and y.
        Specified by:
        add in interface Tuple2D<RT extends Tuple2d<? super RT>>
        Parameters:
        x - x coordinate to add.
        y - y coordinate to add.
      • addX

        public void addX​(int x)
        Description copied from interface: Tuple2D
        Sets the x value of this tuple to the sum of itself and x.
        Specified by:
        addX in interface Tuple2D<RT extends Tuple2d<? super RT>>
        Parameters:
        x - x coordinate to add.
      • addX

        public void addX​(double x)
        Description copied from interface: Tuple2D
        Sets the x value of this tuple to the sum of itself and x.
        Specified by:
        addX in interface Tuple2D<RT extends Tuple2d<? super RT>>
        Parameters:
        x - x coordinate to add.
      • addY

        public void addY​(int y)
        Description copied from interface: Tuple2D
        Sets the y value of this tuple to the sum of itself and y.
        Specified by:
        addY in interface Tuple2D<RT extends Tuple2d<? super RT>>
        Parameters:
        y - y coordinate to add.
      • addY

        public void addY​(double y)
        Description copied from interface: Tuple2D
        Sets the y value of this tuple to the sum of itself and y.
        Specified by:
        addY in interface Tuple2D<RT extends Tuple2d<? super RT>>
        Parameters:
        y - y coordinate to add.
      • negate

        public void negate​(Tuple2D<?> tuple)
        Description copied from interface: Tuple2D
        Sets the value of this tuple to the negation of tuple t1.
        Specified by:
        negate in interface Tuple2D<RT extends Tuple2d<? super RT>>
        Parameters:
        tuple - the source tuple
      • negate

        public void negate()
        Description copied from interface: Tuple2D
        Negates the value of this tuple in place.
        Specified by:
        negate in interface Tuple2D<RT extends Tuple2d<? super RT>>
      • scale

        public void scale​(int scale,
                          Tuple2D<?> tuple)
        Description copied from interface: Tuple2D
        Sets the value of this tuple to the scalar multiplication of tuple t1.
        Specified by:
        scale in interface Tuple2D<RT extends Tuple2d<? super RT>>
        Parameters:
        scale - the scalar value
        tuple - the source tuple
      • scale

        public void scale​(double scale,
                          Tuple2D<?> tuple)
        Description copied from interface: Tuple2D
        Sets the value of this tuple to the scalar multiplication of tuple t1.
        Specified by:
        scale in interface Tuple2D<RT extends Tuple2d<? super RT>>
        Parameters:
        scale - the scalar value
        tuple - the source tuple
      • scale

        public void scale​(int scale)
        Description copied from interface: Tuple2D
        Sets the value of this tuple to the scalar multiplication of the scale factor with this.
        Specified by:
        scale in interface Tuple2D<RT extends Tuple2d<? super RT>>
        Parameters:
        scale - the scalar value
      • scale

        public void scale​(double scale)
        Description copied from interface: Tuple2D
        Sets the value of this tuple to the scalar multiplication of the scale factor with this.
        Specified by:
        scale in interface Tuple2D<RT extends Tuple2d<? super RT>>
        Parameters:
        scale - the scalar value
      • set

        public void set​(Tuple2D<?> tuple)
        Description copied from interface: Tuple2D
        Sets the value of this tuple to the value of tuple t1.
        Specified by:
        set in interface Tuple2D<RT extends Tuple2d<? super RT>>
        Parameters:
        tuple - the tuple to be copied
      • set

        public void set​(int x,
                        int y)
        Description copied from interface: Tuple2D
        Sets the value of this tuple to the specified x and y coordinates.
        Specified by:
        set in interface Tuple2D<RT extends Tuple2d<? super RT>>
        Parameters:
        x - the x coordinate
        y - the y coordinate
      • set

        public void set​(double x,
                        double y)
        Description copied from interface: Tuple2D
        Sets the value of this tuple to the specified x and y coordinates.
        Specified by:
        set in interface Tuple2D<RT extends Tuple2d<? super RT>>
        Parameters:
        x - the x coordinate
        y - the y coordinate
      • set

        public void set​(int[] tuple)
        Description copied from interface: Tuple2D
        Sets the value of this tuple from the 2 values specified in the array.
        Specified by:
        set in interface Tuple2D<RT extends Tuple2d<? super RT>>
        Parameters:
        tuple - the array of length 2 containing xy in order
      • set

        public void set​(double[] tuple)
        Description copied from interface: Tuple2D
        Sets the value of this tuple from the 2 values specified in the array.
        Specified by:
        set in interface Tuple2D<RT extends Tuple2d<? super RT>>
        Parameters:
        tuple - the array of length 2 containing xy in order
      • getX

        @Pure
        public double getX()
        Description copied from interface: Tuple2D
        Get the x coordinate.
        Specified by:
        getX in interface Tuple2D<RT extends Tuple2d<? super RT>>
        Returns:
        the x coordinate.
      • ix

        @Pure
        public int ix()
        Description copied from interface: Tuple2D
        Get the x coordinate.
        Specified by:
        ix in interface Tuple2D<RT extends Tuple2d<? super RT>>
        Returns:
        the x coordinate.
      • setX

        public void setX​(int x)
        Description copied from interface: Tuple2D
        Set the x coordinate.
        Specified by:
        setX in interface Tuple2D<RT extends Tuple2d<? super RT>>
        Parameters:
        x - value to x coordinate.
      • setX

        public void setX​(double x)
        Description copied from interface: Tuple2D
        Set the x coordinate.
        Specified by:
        setX in interface Tuple2D<RT extends Tuple2d<? super RT>>
        Parameters:
        x - value to x coordinate.
      • getY

        @Pure
        public double getY()
        Description copied from interface: Tuple2D
        Get the y coordinate.
        Specified by:
        getY in interface Tuple2D<RT extends Tuple2d<? super RT>>
        Returns:
        the y coordinate.
      • iy

        @Pure
        public int iy()
        Description copied from interface: Tuple2D
        Get the y coordinate.
        Specified by:
        iy in interface Tuple2D<RT extends Tuple2d<? super RT>>
        Returns:
        the y coordinate.
      • setY

        public void setY​(int y)
        Description copied from interface: Tuple2D
        Set the y coordinate.
        Specified by:
        setY in interface Tuple2D<RT extends Tuple2d<? super RT>>
        Parameters:
        y - value to y coordinate.
      • setY

        public void setY​(double y)
        Description copied from interface: Tuple2D
        Set the y coordinate.
        Specified by:
        setY in interface Tuple2D<RT extends Tuple2d<? super RT>>
        Parameters:
        y - value to y coordinate.
      • sub

        public void sub​(int x,
                        int y)
        Description copied from interface: Tuple2D
        Sets the value of this tuple to the difference of itself and x and y.
        Specified by:
        sub in interface Tuple2D<RT extends Tuple2d<? super RT>>
        Parameters:
        x - x coordinate to substract.
        y - y coordinate to substract.
      • sub

        public void sub​(double x,
                        double y)
        Description copied from interface: Tuple2D
        Sets the value of this tuple to the difference of itself and x and y.
        Specified by:
        sub in interface Tuple2D<RT extends Tuple2d<? super RT>>
        Parameters:
        x - x coordinate to substract.
        y - y coordinate to substract.
      • subX

        public void subX​(int x)
        Description copied from interface: Tuple2D
        Sets the x value of this tuple to the difference of itself and x.
        Specified by:
        subX in interface Tuple2D<RT extends Tuple2d<? super RT>>
        Parameters:
        x - x coordinate to substract.
      • subX

        public void subX​(double x)
        Description copied from interface: Tuple2D
        Sets the x value of this tuple to the difference of itself and x.
        Specified by:
        subX in interface Tuple2D<RT extends Tuple2d<? super RT>>
        Parameters:
        x - x coordinate to substract.
      • subY

        public void subY​(int y)
        Description copied from interface: Tuple2D
        Sets the y value of this tuple to the difference of itself and y.
        Specified by:
        subY in interface Tuple2D<RT extends Tuple2d<? super RT>>
        Parameters:
        y - y coordinate to substract.
      • subY

        public void subY​(double y)
        Description copied from interface: Tuple2D
        Sets the y value of this tuple to the difference of itself and y.
        Specified by:
        subY in interface Tuple2D<RT extends Tuple2d<? super RT>>
        Parameters:
        y - y coordinate to substract.
      • equals

        @Pure
        public boolean equals​(Object t1)
        Description copied from interface: Tuple2D
        Returns true if the Object t1 is of type Tuple2D and all of the data members of t1 are equal to the corresponding data members in this Tuple2D.
        Specified by:
        equals in interface Tuple2D<RT extends Tuple2d<? super RT>>
        Overrides:
        equals in class Object
        Parameters:
        t1 - the object with which the comparison is made
        Returns:
        true or false
      • hashCode

        @Pure
        public int hashCode()
        Description copied from interface: Tuple2D
        Returns a hash code value based on the data values in this object. Two different Tuple2D objects with identical data values (i.e., Tuple2D.equals(Object) returns true) will return the same hash code value. Two objects with different data members may return the same hash value, although this is not likely.
        Specified by:
        hashCode in interface Tuple2D<RT extends Tuple2d<? super RT>>
        Overrides:
        hashCode in class Object
        Returns:
        the integer hash code value
      • toJson

        public void toJson​(JsonBuffer buffer)
        Description copied from interface: JsonableObject
        Replies the Json representation of this node.
        Specified by:
        toJson in interface JsonableObject
        Parameters:
        buffer - the Json buffer.