jadex.application.space.envsupport.math
Class Vector1Int

java.lang.Object
  extended by jadex.application.space.envsupport.math.Vector1Int
All Implemented Interfaces:
IVector1

public class Vector1Int
extends Object
implements IVector1


Field Summary
static IVector1 ZERO
          Zero vector
 
Constructor Summary
Vector1Int()
          Creates a new vector.
Vector1Int(int value)
          Creates a new Vector1int.
 
Method Summary
 IVector1 add(IVector1 vector)
          Adds another vector to this vector, adding individual components.
 Object clone()
          Generates a deep clone of the vector.
 IVector1 copy()
          Makes a copy of the vector without using the complex clone interface.
 IVector2 createVector2(IVector1 sec)
          Create a vector2 from this and another vector.
 boolean equals(IVector1 vector)
          Compares the vector to another vector.
 boolean equals(Object obj)
          Compares the vector to an object
 BigDecimal getAsBigDecimal()
          Returns the vector as BigDecimal.
 double getAsDouble()
          Returns the vector as double.
 float getAsFloat()
          Returns the vector as float.
 int getAsInteger()
          Returns the vector as integer.
 long getAsLong()
          Returns the vector as long.
 IVector1 getDistance(IVector1 vector)
          Returns the distance to another vector
 boolean greater(IVector1 vector)
          Tests if the vector is greater than another vector.
 int hashCode()
          Compute the hash code.
 boolean less(IVector1 vector)
          Tests if the vector is less than another vector.
 IVector1 mod(IVector1 mod)
          Calculate the modulo.
 IVector1 multiply(IVector1 vector)
          Performs a multiplication on the vector.
 IVector1 negate()
          Negates the vector by negating its components.
 void setAsInteger(int x)
           
 IVector1 sqrt()
          Calculate the square root.
 IVector1 subtract(IVector1 vector)
          Subtracts another vector to this vector, subtracting individual components.
 String toString()
           
 IVector1 zero()
          Sets the vector component to zero.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

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 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 Object clone()
             throws CloneNotSupportedException
Generates a deep clone of the vector.

Specified by:
clone in interface IVector1
Overrides:
clone in class Object
Returns:
clone of this vector
Throws:
CloneNotSupportedException

equals

public boolean equals(Object obj)
Compares the vector to an object

Specified by:
equals in interface IVector1
Overrides:
equals in class 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 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 String toString()
Overrides:
toString in class Object


Copyright © 2010. All Rights Reserved.