|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Index
Models a multi-index of infinite dimension. The multi-index is an element of the N-fold direct sum of N, where N is the natural numbers including 0.
An index is immutable. Changing the value of an entry will return a new index with the specified change, but leave the original index untouched.
All implementations of this interface must be thread-safe.
Method Summary | |
---|---|
Index |
add(int entryNum,
int increment)
Returns a new index with the specified increment at the specified entry. |
boolean |
equals(java.lang.Object o)
Compares the specified object with this index for equality. |
int |
get(int number)
Returns the value for the specified entry. |
int |
hashCode()
Returns the hash code value for this index. |
java.util.Iterator<de.torstennahm.math.IntEntry> |
iterator()
Returns an IntPairIterator for iterating over the index. |
int |
lastEntry()
Returns the index of highest entry whose value is not 0. |
int |
nonZeroEntries()
Returns the number of entries with values not equal to 0. |
Index |
set(int entryNum,
int value)
Returns a new index with the specified new value at the specified entry. |
int |
sum()
Returns the the sum of all entry values. |
Method Detail |
---|
int nonZeroEntries()
int lastEntry()
int get(int number)
number
- number of the entry
Index set(int entryNum, int value)
entryNum
- number of the entryvalue
- new value for the entry
Index add(int entryNum, int increment)
entryNum
- number of the entryincrement
- increment for the entry, may be negative
int sum()
java.util.Iterator<de.torstennahm.math.IntEntry> iterator()
IntPairIterator
for iterating over the index.
The iterator skips all entries whose value is zero.
iterator
in interface java.lang.Iterable<de.torstennahm.math.IntEntry>
boolean equals(java.lang.Object o)
Index
interface.
equals
in class java.lang.Object
int hashCode()
hashCode
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |