|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jcae.mesh.amibe.ds.Triangle.List
public static class Triangle.List
Singly linked list of triangles. We sometimes need to process lists of triangles before mesh connectivity has been set up. This can be achieved efficiently with a singly linked list, but there are few caveats.
clear()
method
before being freed, otherwise Triangle can not be inserted into
other lists.Here is an example:
// Begin a new list Triangle.List tList = new Triangle.List(); ... // In a loop, add triangles to this list. tList.add(org.jcae.mesh.amibe.ds.Triangle)
(tri); // Check whether a triangle is contained in this list. // This is very fast because it tests if its link pointer // isnull
or not. if (tList.contains(org.jcae.mesh.amibe.ds.Triangle)
(tri)) { ... } // Loop over collected triangles. for (Iteratorit = tList. iterator()
; it.hasNext(); ) { Triangle t = it.next(); ... } // When finished, remove all links between triangles tList.clear()
;
New elements are added at the end of the list so that add(org.jcae.mesh.amibe.ds.Triangle)
can
be called while iterator()
is in action.
Constructor Summary | |
---|---|
Triangle.List()
Initialize a triangle linked list. |
Method Summary | |
---|---|
void |
add(Triangle o)
Add the current triangle to the end of the list. |
void |
addAllowDuplicates(Triangle o)
Add the current triangle to the end of the list. |
void |
clear()
Unmark triangles. |
boolean |
contains(Triangle o)
Check whether this element appears in the list. |
java.util.Iterator<Triangle> |
iterator()
Create an iterator over linked triangles. |
int |
size()
Return list size. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Triangle.List()
Method Detail |
---|
public void clear()
public final void add(Triangle o)
java.util.ConcurrentModificationException
- if this element is
already linked.public final void addAllowDuplicates(Triangle o)
public boolean contains(Triangle o)
public int size()
public java.util.Iterator<Triangle> iterator()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |