Class Vector1Int

  • All Implemented Interfaces:
    IVector1

    public class Vector1Int
    extends java.lang.Object
    implements IVector1
    • Field Detail

      • ZERO

        public static final IVector1 ZERO
        Zero vector
    • Constructor Detail

      • Vector1Int

        public Vector1Int​(int value)
        Creates a new Vector1int.
        Parameters:
        value - vector value
      • Vector1Int

        public Vector1Int()
        Creates a new vector.
    • Method Detail

      • add

        public IVector1 add​(IVector1 vector)
        Adds another vector to this vector, adding individual components.
        Specified by:
        add in interface IVector1
        Parameters:
        vector - the vector to add to this vector
        Returns:
        a reference to the called vector (NOT a copy)
      • subtract

        public IVector1 subtract​(IVector1 vector)
        Subtracts another vector to this vector, subtracting individual components.
        Specified by:
        subtract in interface IVector1
        Parameters:
        vector - the vector to subtract from this vector
        Returns:
        a reference to the called vector (NOT a copy)
      • multiply

        public IVector1 multiply​(IVector1 vector)
        Performs a multiplication on the vector.
        Specified by:
        multiply in interface IVector1
        Parameters:
        vector - vector
        Returns:
        a reference to the called vector (NOT a copy)
      • zero

        public IVector1 zero()
        Sets the vector component to zero.
        Specified by:
        zero in interface IVector1
        Returns:
        a reference to the called vector (NOT a copy)
      • negate

        public IVector1 negate()
        Negates the vector by negating its components.
        Specified by:
        negate in interface IVector1
        Returns:
        a reference to the called vector (NOT a copy)
      • sqrt

        public IVector1 sqrt()
        Calculate the square root.
        Specified by:
        sqrt in interface IVector1
        Returns:
        The square root.
      • mod

        public IVector1 mod​(IVector1 mod)
        Calculate the modulo.
        Specified by:
        mod in interface IVector1
        Returns:
        The modulo value.
      • getDistance

        public IVector1 getDistance​(IVector1 vector)
        Returns the distance to another vector
        Specified by:
        getDistance in interface IVector1
        Parameters:
        vector - other vector
        Returns:
        distance
      • getAsInteger

        public int getAsInteger()
        Returns the vector as integer.
        Specified by:
        getAsInteger in interface IVector1
        Returns:
        vector as integer
      • setAsInteger

        public void setAsInteger​(int x)
      • getAsLong

        public long getAsLong()
        Returns the vector as long.
        Specified by:
        getAsLong in interface IVector1
        Returns:
        vector as long
      • getAsFloat

        public float getAsFloat()
        Returns the vector as float.
        Specified by:
        getAsFloat in interface IVector1
        Returns:
        vector as float
      • getAsDouble

        public double getAsDouble()
        Returns the vector as double.
        Specified by:
        getAsDouble in interface IVector1
        Returns:
        vector as double
      • getAsBigDecimal

        public java.math.BigDecimal getAsBigDecimal()
        Returns the vector as BigDecimal.
        Specified by:
        getAsBigDecimal in interface IVector1
        Returns:
        vector as BigDecimal
      • copy

        public IVector1 copy()
        Makes a copy of the vector without using the complex clone interface.
        Specified by:
        copy in interface IVector1
        Returns:
        copy of the vector
      • clone

        public java.lang.Object clone()
                               throws java.lang.CloneNotSupportedException
        Generates a deep clone of the vector.
        Specified by:
        clone in interface IVector1
        Overrides:
        clone in class java.lang.Object
        Returns:
        clone of this vector
        Throws:
        java.lang.CloneNotSupportedException
      • equals

        public boolean equals​(java.lang.Object obj)
        Compares the vector to an object
        Specified by:
        equals in interface IVector1
        Overrides:
        equals in class java.lang.Object
        Parameters:
        obj - the object
        Returns:
        always returns false unless the object is an IVector2, in which case it is equivalent to equals(IVector vector)
      • hashCode

        public int hashCode()
        Compute the hash code.
        Overrides:
        hashCode in class java.lang.Object
        Returns:
        The hash code.
      • equals

        public boolean equals​(IVector1 vector)
        Compares the vector to another vector. The vectors are equal if the components are equal.
        Specified by:
        equals in interface IVector1
        Parameters:
        vector - the other vector
        Returns:
        true if the vectors are equal
      • greater

        public boolean greater​(IVector1 vector)
        Tests if the vector is greater than another vector.
        Specified by:
        greater in interface IVector1
        Parameters:
        vector - the other vector
        Returns:
        true if the vector is greater than the given vector.
      • less

        public boolean less​(IVector1 vector)
        Tests if the vector is less than another vector.
        Specified by:
        less in interface IVector1
        Parameters:
        vector - the other vector
        Returns:
        true if the vector is less than the given vector.
      • createVector2

        public IVector2 createVector2​(IVector1 sec)
        Create a vector2 from this and another vector.
        Specified by:
        createVector2 in interface IVector1
        Parameters:
        sec - The second vector.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • cbrt

        public IVector1 cbrt()
        Description copied from interface: IVector1
        Calculate the cube root.
        Specified by:
        cbrt in interface IVector1
        Returns:
        The cube root.