|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface GeometricVector<T extends java.lang.Number>
Interface for classes that represent n-dimensional vector in a module (i.e. a commutative ring, e.g. reals, integers, complex,...)
Note that a GeometricVector represents an *immutable* data structure. Hence appropriate constructors should be provided to set the dimension and components of a vector.
Field Summary | |
---|---|
static int |
X_DIM
|
static int |
Y_DIM
|
static int |
Z_DIM
|
Method Summary | |
---|---|
GeometricVector<T> |
add(GeometricVector<T> theVector)
add returns a *new* vector, equal to the vector sum of this vector and the argument. |
boolean |
equals(java.lang.Object obj)
Implementing classes should override equals in suitable fashion, e.g. |
T |
getComponent(int theDimension)
Returns the component in the specified dimension. |
T[] |
getComponents()
Returns the components as an array |
int |
getDimension()
Return the dimension of this vector. |
double |
getLength()
Returns the length (norm) of this vector as a double. |
int |
hashCode()
Implementing classes should override hashCode() to synchronize with equals() |
java.util.Iterator<T> |
iterator()
Returns an iterator over the components of the vector. |
GeometricVector<T> |
multiply(T theScalar)
multiply returns a *new* vector, equal to the scalar multiple of this vector and the argument. |
java.lang.String |
toString()
Implementing classes should override toString() to produce a simple string representation, e.g. |
Field Detail |
---|
static final int X_DIM
static final int Y_DIM
static final int Z_DIM
Method Detail |
---|
boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
obj
-
int hashCode()
hashCode
in class java.lang.Object
java.lang.String toString()
toString
in class java.lang.Object
GeometricVector<T> add(GeometricVector<T> theVector)
Performs a component-by-component addition
theVector
- the vector to add, which must be of equal or lesser dimension
GeometricVector<T> multiply(T theScalar)
Performs a component-by-component scalar multiplication
theScalar
- the scalar to multiply by (may be < 1, or indeed < 0)java.util.Iterator<T> iterator()
iterator
in interface java.lang.Iterable<T extends java.lang.Number>
double getLength()
int getDimension()
T getComponent(int theDimension)
theDimension
- specifies which component to retrieveT[] getComponents()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |