Class Vector

  • All Implemented Interfaces:
    java.io.Serializable

    public class Vector
    extends java.lang.Object
    implements java.io.Serializable
    A vector.
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private double x
      The vector x.
      private double y
      The vector y.
    • Constructor Summary

      Constructors 
      Constructor Description
      Vector​(double x, double y)
      Creates a new instance of Vector.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object obj)
      Tests this vector for equality with an arbitrary object.
      double getAngle()
      Returns the angle of the vector.
      double getLength()
      Returns the length of the vector.
      double getX()
      Returns the x-value.
      double getY()
      Returns the y-value.
      int hashCode()
      Returns a hash code for this instance.
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • x

        private double x
        The vector x.
      • y

        private double y
        The vector y.
    • Constructor Detail

      • Vector

        public Vector​(double x,
                      double y)
        Creates a new instance of Vector.
        Parameters:
        x - the x-component.
        y - the y-component.
    • Method Detail

      • getX

        public double getX()
        Returns the x-value.
        Returns:
        The x-value.
      • getY

        public double getY()
        Returns the y-value.
        Returns:
        The y-value.
      • getLength

        public double getLength()
        Returns the length of the vector.
        Returns:
        The vector length.
      • getAngle

        public double getAngle()
        Returns the angle of the vector.
        Returns:
        The angle of the vector.
      • equals

        public boolean equals​(java.lang.Object obj)
        Tests this vector for equality with an arbitrary object.
        Overrides:
        equals in class java.lang.Object
        Parameters:
        obj - the object (null not permitted).
        Returns:
        A boolean.
      • hashCode

        public int hashCode()
        Returns a hash code for this instance.
        Overrides:
        hashCode in class java.lang.Object
        Returns:
        A hash code.