Class Vector<F extends Field<F>>

    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected Vector()
      Default constructor (for sub-classes).
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      abstract Vector<F> copy()
      Returns a copy of this vector allocated by the calling thread (possibly on the stack).
      Vector<F> cross​(Vector<F> that)
      Returns the cross product of two 3-dimensional vectors.
      boolean equals​(Object that)
      Indicates if this vector is equal to the object specified.
      boolean equals​(Vector<F> that, Comparator<F> cmp)
      Indicates if this vector can be considered equals to the one specified using the specified comparator when testing for element equality.
      abstract F get​(int i)
      Returns a single element from this vector.
      abstract int getDimension()
      Returns the number of elements held by this vector.
      int hashCode()
      Returns a hash code value for this vector.
      Vector<F> minus​(Vector<F> that)
      Returns the difference between this vector and the one specified.
      abstract Vector<F> opposite()
      Returns the negation of this vector.
      abstract Vector<F> plus​(Vector<F> that)
      Returns the sum of this vector with the one specified.
      abstract Vector<F> times​(F k)
      Returns the product of this vector with the specified coefficient.
      abstract F times​(Vector<F> that)
      Returns the dot product of this vector with the one specified.
      String toString()
      Returns the text representation of this vector as a java.lang.String.
      javolution.text.Text toText()
      Returns the text representation of this vector.
    • Constructor Detail

      • Vector

        protected Vector()
        Default constructor (for sub-classes).
    • Method Detail

      • getDimension

        public abstract int getDimension()
        Returns the number of elements held by this vector.
        Returns:
        this vector dimension.
      • get

        public abstract F get​(int i)
        Returns a single element from this vector.
        Parameters:
        i - the element index (range [0..n[).
        Returns:
        the element at i.
        Throws:
        IndexOutOfBoundsException - (i < 0) || (i >= size())
      • plus

        public abstract Vector<F> plus​(Vector<F> that)
        Returns the sum of this vector with the one specified.
        Specified by:
        plus in interface GroupAdditive<F extends Field<F>>
        Parameters:
        that - the vector to be added.
        Returns:
        this + that.
        Throws:
        DimensionException - is vectors dimensions are different.
      • minus

        public Vector<F> minus​(Vector<F> that)
        Returns the difference between this vector and the one specified.
        Parameters:
        that - the vector to be subtracted.
        Returns:
        this - that.
      • times

        public abstract Vector<F> times​(F k)
        Returns the product of this vector with the specified coefficient.
        Specified by:
        times in interface VectorSpace<Vector<F extends Field<F>>,​F extends Field<F>>
        Parameters:
        k - the coefficient multiplier.
        Returns:
        this · k
      • times

        public abstract F times​(Vector<F> that)
        Returns the dot product of this vector with the one specified.
        Parameters:
        that - the vector multiplier.
        Returns:
        this · that
        Throws:
        DimensionException - if this.dimension() != that.dimension()
        See Also:
        Wikipedia: Dot Product
      • cross

        public Vector<F> cross​(Vector<F> that)
        Returns the cross product of two 3-dimensional vectors.
        Parameters:
        that - the vector multiplier.
        Returns:
        this x that
        Throws:
        DimensionException - if (this.getDimension() != 3) && (that.getDimension() != 3)
      • toText

        public javolution.text.Text toText()
        Returns the text representation of this vector.
        Specified by:
        toText in interface javolution.lang.Realtime
        Returns:
        the text representation of this vector.
      • toString

        public final String toString()
        Returns the text representation of this vector as a java.lang.String.
        Overrides:
        toString in class Object
        Returns:
        toText().toString()
      • equals

        public boolean equals​(Vector<F> that,
                              Comparator<F> cmp)
        Indicates if this vector can be considered equals to the one specified using the specified comparator when testing for element equality. The specified comparator may allow for some tolerance in the difference between the vector elements.
        Parameters:
        that - the vector to compare for equality.
        cmp - the comparator to use when testing for element equality.
        Returns:
        true if this vector and the specified matrix are both vector with equal elements according to the specified comparator; false otherwise.
      • equals

        public boolean equals​(Object that)
        Indicates if this vector is equal to the object specified.
        Overrides:
        equals in class Object
        Parameters:
        that - the object to compare for equality.
        Returns:
        true if this vector and the specified object are both vectors with equal elements; false otherwise.
      • copy

        public abstract Vector<F> copy()
        Returns a copy of this vector allocated by the calling thread (possibly on the stack).
        Specified by:
        copy in interface javolution.lang.ValueType
        Returns:
        an identical and independant copy of this matrix.