|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.openmali.vecmath2.TupleNi<T>
public abstract class TupleNi<T extends TupleNi<T>>
A simple N-dimensional tuple implementation. Inspired by Kenji Hiranabe's implementation
| Field Summary | |
|---|---|
protected boolean[] |
isDirty
|
protected int |
N
|
protected int |
roTrick
|
protected int[] |
values
|
| Constructor Summary | |
|---|---|
protected |
TupleNi(boolean readOnly,
int n)
Creates a new TupleNi instance. |
protected |
TupleNi(boolean readOnly,
int[] values,
boolean[] isDirty,
int n,
boolean copy)
Creates a new TupleNi instance. |
protected |
TupleNi(boolean readOnly,
int[] values,
int n)
Creates a new TupleNf instance. |
protected |
TupleNi(boolean readOnly,
TupleNi<?> that)
Creates a new TupleNi instance. |
|
TupleNi(int n)
Creates a new TupleNi instance. |
|
TupleNi(int[] values,
int n)
Creates a new TupleNi instance. |
|
TupleNi(TupleNi<?> that)
Creates a new TupleNi instance. |
| Method Summary | |
|---|---|
T |
absolute()
Sets each component of the tuple parameter to its absolute value and places the modified values into this tuple. |
T |
absolute(T tuple)
Sets each component of the tuple parameter to its absolute value and places the modified values into this tuple. |
T |
add(T tuple2)
Sets the value of this tuple to the vector sum of itself and tuple t1. |
T |
add(T tuple1,
T tuple2)
Sets the value of this tuple to the vector sum of tuples t1 and t2. |
abstract T |
asReadOnly()
|
T |
clamp(int min,
int max)
Clamps this tuple to the range [min, max]. |
T |
clamp(int min,
int max,
T tuple)
Clamps the tuple parameter to the range [min, max] and places the values into this tuple. |
T |
clampMax(int max)
Clamps the maximum value of this tuple to the max parameter. |
T |
clampMax(int max,
T tuple)
Clamps the maximum value of the tuple parameter to the max parameter and places the values into this tuple. |
T |
clampMin(int min)
Clamps the minimum value of this tuple to the min parameter. |
T |
clampMin(int min,
T tuple)
Clamps the minimum value of the tuple parameter to the min parameter and places the values into this tuple. |
int |
deserialize(int pos,
byte[] buffer)
Deserializes this instanc'es data from the byte array. |
boolean |
equals(java.lang.Object tuple2)
Returns true if the Object t1 is of type Tuple3f and all of the data members of t1 are equal to the corresponding data members in this Tuple2f. |
boolean |
equals(T t2)
Returns true if all of the data members of GVector vector1 are equal to the corresponding data members in this GVector. |
T |
get(int[] buffer)
Writes all values of this Tuple to the specified buffer. |
T |
get(int[] buffer,
int offset)
Writes all values of this Tuple to the specified buffer. |
T |
get(T buffer)
Writes all values of this Tuple to the specified buffer Tuple. |
abstract T |
getReadOnly()
|
protected int |
getSerializationBufferSize()
|
int |
getSize()
|
int |
getValue(int i)
|
abstract int |
hashCode()
Returns a hash number based on the data values in this object. |
boolean |
isDirty()
|
boolean |
isReadOnly()
|
T |
negate()
Negates the value of this vector in place. |
T |
negate(T tuple)
Sets the value of this tuple to the negation of tuple that. |
void |
readExternal(java.io.ObjectInput in)
|
T |
scale(int factor)
Sets the value of this tuple to the scalar multiplication of itself. |
T |
scale(int factor,
T tuple)
Sets the value of this tuple to the scalar multiplication of tuple t1. |
T |
scaleAdd(int factor,
T tuple2)
Sets the value of this tuple to the scalar multiplication of itself and then adds tuple t1 (this = s*this + t1). |
T |
scaleAdd(int factor,
T tuple1,
T tuple2)
Sets the value of this tuple to the scalar multiplication of tuple t1 and then adds tuple t2 (this = s*t1 + t2). |
int |
serialize(int pos,
byte[] buffer)
Serializes this instanc'es data into the byte array. |
T |
set(int[] values)
Sets all values of this Tuple to the specified ones. |
T |
set(int[] values,
int offset)
Sets all values of this Tuple to the specified ones. |
T |
set(T tuple)
Sets all three values of this Tuple to the specified ones. |
boolean |
setClean()
Marks this tuple non-dirty. |
T |
setValue(int i,
int v)
Sets the value of the i-th element of this tuple. |
T |
setZero()
Sets all components to zero. |
T |
sub(T tuple2)
Sets the value of this tuple to the vector difference of itself and tuple t1 (this = this - t1). |
T |
sub(T tuple1,
T tuple2)
Sets the value of this tuple to the vector difference of tuple t1 and t2 (this = t1 - t2). |
abstract java.lang.String |
toString()
Returns a string that contains the values of this Tuple2f. |
void |
writeExternal(java.io.ObjectOutput out)
|
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected final int N
protected final int[] values
protected final int roTrick
protected final boolean[] isDirty
| Constructor Detail |
|---|
protected TupleNi(boolean readOnly,
int n)
readOnly - n - the number of elements
protected TupleNi(boolean readOnly,
int[] values,
boolean[] isDirty,
int n,
boolean copy)
readOnly - values - the values array (must be at least size n)isDirty - the isDirty-valuen - the number of elementscopy - copy the array?
protected TupleNi(boolean readOnly,
int[] values,
int n)
readOnly - values - the values array (must be at least size n)n - the number of elements to copy
protected TupleNi(boolean readOnly,
TupleNi<?> that)
readOnly - that - the TupleNi to copy the values frompublic TupleNi(int n)
n - the number of elements
public TupleNi(int[] values,
int n)
values - the values array (must be at least size n)n - the number of elements to copypublic TupleNi(TupleNi<?> that)
that - the TupleNi to copy the values from| Method Detail |
|---|
public final boolean isReadOnly()
public final boolean setClean()
public final boolean isDirty()
public final int getSize()
public final T setValue(int i,
int v)
i - v -
public final int getValue(int i)
public final T set(int[] values,
int offset)
values - the values array (must be at least size 3)offset - the offset int the (source) values array
public final T set(int[] values)
values - the values array (must be at least size 3)
public final T set(T tuple)
tuple - the tuple to be copied
public final T get(int[] buffer,
int offset)
buffer - the buffer array to write the values tooffset - the offset in the (target) buffer array
public final T get(int[] buffer)
buffer - the buffer array to write the values to
public final T get(T buffer)
buffer - the buffer Tuple to write the values to
public final T setZero()
public final T negate(T tuple)
tuple - the source vector
public final T negate()
public final T absolute()
public final T absolute(T tuple)
tuple - the source tuple, which will not be modified
public final T add(T tuple1,
T tuple2)
tuple1 - the first tupletuple2 - the second tuple
public final T add(T tuple2)
tuple2 - the other tuple
public final T sub(T tuple1,
T tuple2)
tuple1 - the first tupletuple2 - the second tuple
public final T sub(T tuple2)
tuple2 - the other tuple
public final T scale(int factor,
T tuple)
factor - the scalar valuetuple - the source tuple
public final T scale(int factor)
factor - the scalar value
public final T scaleAdd(int factor,
T tuple1,
T tuple2)
factor - the scalar valuetuple1 - the tuple to be multipledtuple2 - the tuple to be added
public final T scaleAdd(int factor,
T tuple2)
factor - the scalar valuetuple2 - the tuple to be added
public final T clampMin(int min)
min - the lowest value in this tuple after clamping
public final T clampMax(int max)
max - the highest value in the tuple after clamping
public final T clamp(int min,
int max)
min - the lowest value in this tuple after clampingmax - the highest value in this tuple after clamping
public final T clamp(int min,
int max,
T tuple)
min - the lowest value in the tuple after clampingmax - the highest value in the tuple after clampingtuple - the source tuple, which will not be modified
public final T clampMin(int min,
T tuple)
min - the lowest value in the tuple after clampingtuple - the source tuple, which will not be modified
public final T clampMax(int max,
T tuple)
max - the highest value in the tuple after clampingtuple - the source tuple, which will not be modified
public abstract T asReadOnly()
getReadOnly()public abstract T getReadOnly()
asReadOnly()public abstract int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(T t2)
t2 - The vector with which the comparison is made.
public boolean equals(java.lang.Object tuple2)
equals in class java.lang.Objecttuple2 - the Object with which the comparison is made
public abstract java.lang.String toString()
toString in class java.lang.Object
public int serialize(int pos,
byte[] buffer)
pos - buffer -
public int deserialize(int pos,
byte[] buffer)
pos - buffer -
protected int getSerializationBufferSize()
public void writeExternal(java.io.ObjectOutput out)
throws java.io.IOException
writeExternal in interface java.io.Externalizablejava.io.IOException
public void readExternal(java.io.ObjectInput in)
throws java.io.IOException,
java.lang.ClassNotFoundException
readExternal in interface java.io.Externalizablejava.io.IOException
java.lang.ClassNotFoundException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||