public class IndexesLoop
extends java.lang.Object
implements java.util.Comparator<java.lang.Integer>, java.lang.Iterable<java.lang.Integer>
Modifier and Type | Class and Description |
---|---|
static interface |
IndexesLoop.IndexPredicate |
Modifier and Type | Field and Description |
---|---|
static IndexesLoop.IndexPredicate |
INDEX_PREDICATE_USE_ALL |
Constructor and Description |
---|
IndexesLoop(java.lang.Integer[] nodes)
The constructor uses the given nodes in their give order.
|
Modifier and Type | Method and Description |
---|---|
void |
addEdge(java.lang.Integer from,
java.lang.Integer to)
Adds edge to the loop.
|
boolean |
areNeighbours(java.lang.Integer index1,
java.lang.Integer index2)
Tells if the given indexes are neighbours.
|
IndexesLoop |
clone() |
int |
compare(java.lang.Integer i1,
java.lang.Integer i2) |
void |
findPath(java.lang.Integer start,
java.lang.Integer end,
java.util.List<java.lang.Integer> result)
The method finds the path between the given indexes.
|
java.lang.Integer |
get(int indexPosition)
Returns the index at the given position.
|
java.util.List<java.lang.Integer> |
getAll() |
java.lang.Integer |
getNextIndex(java.lang.Integer index)
Returns the value of the index located after the given one.
|
java.lang.Integer |
getPreviousIndex(java.lang.Integer index)
Returns the value of the index located before the given one.
|
int |
indexOf(java.lang.Integer index)
Returns the position of the given index in the loop.
|
java.util.Iterator<java.lang.Integer> |
iterator() |
boolean |
removeEdge(java.lang.Integer node1,
java.lang.Integer node2)
Removes edge from the face.
|
void |
removeIndexes(java.lang.Integer... indexes)
The method removes all given indexes.
|
void |
reverse()
Reverses the order of the indexes.
|
void |
shiftIndexes(int shift,
IndexesLoop.IndexPredicate predicate)
The method shifts all indexes by a given value.
|
int |
size() |
java.lang.String |
toString() |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
public static final IndexesLoop.IndexPredicate INDEX_PREDICATE_USE_ALL
public IndexesLoop(java.lang.Integer[] nodes)
nodes
- the nodes for the looppublic IndexesLoop clone()
clone
in class java.lang.Object
public int size()
public void addEdge(java.lang.Integer from, java.lang.Integer to)
from
- the start indexto
- the end indexpublic boolean removeEdge(java.lang.Integer node1, java.lang.Integer node2)
node1
- the first index of the edge to be removednode2
- the second index of the edge to be removedpublic boolean areNeighbours(java.lang.Integer index1, java.lang.Integer index2)
index1
- the first indexindex2
- the second indexpublic java.lang.Integer getNextIndex(java.lang.Integer index)
index
- the index valuepublic java.lang.Integer getPreviousIndex(java.lang.Integer index)
index
- the index valuepublic void shiftIndexes(int shift, IndexesLoop.IndexPredicate predicate)
shift
- the value to shift all indexespredicate
- the predicate that verifies which indexes should be shifted; if null then all will be shiftedpublic void reverse()
public int indexOf(java.lang.Integer index)
index
- the index of the facepublic java.lang.Integer get(int indexPosition)
indexPosition
- the position of the indexpublic java.util.List<java.lang.Integer> getAll()
public void removeIndexes(java.lang.Integer... indexes)
indexes
- the indexes to be removedpublic void findPath(java.lang.Integer start, java.lang.Integer end, java.util.List<java.lang.Integer> result) throws BlenderFileException
start
- the start indexend
- the end indexresult
- a list containing indexes on the path from start to end (inclusive)java.lang.IllegalStateException
- an exception is thrown when the loop is not normalized (at least one
index has more than 2 neighbours)BlenderFileException
- an exception is thrown if the vertices of a face create more than one loop; this is thrown
to prevent lack of memory errors during triangulationpublic java.lang.String toString()
toString
in class java.lang.Object
public int compare(java.lang.Integer i1, java.lang.Integer i2)
compare
in interface java.util.Comparator<java.lang.Integer>
public java.util.Iterator<java.lang.Integer> iterator()
iterator
in interface java.lang.Iterable<java.lang.Integer>