diff options
author | Sven Gothel <[email protected]> | 2023-04-12 19:07:27 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2023-04-12 19:07:27 +0200 |
commit | 92ec47e74eef3ba47627b04ddf78996fa3a2296f (patch) | |
tree | 005de45eb4f3b9645f08b56ac0aea9ffa8e3e269 /src | |
parent | 3224346312357430eeb7af3f561e85f9695870b6 (diff) |
GraphUI TreeTool: Iterate from start to end (not vice versa), eliminating potential side-effects - fixing forSortedAll(..)
Diffstat (limited to 'src')
-rw-r--r-- | src/graphui/classes/jogamp/graph/ui/TreeTool.java | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/graphui/classes/jogamp/graph/ui/TreeTool.java b/src/graphui/classes/jogamp/graph/ui/TreeTool.java index f4fe2813d..c5701d6e2 100644 --- a/src/graphui/classes/jogamp/graph/ui/TreeTool.java +++ b/src/graphui/classes/jogamp/graph/ui/TreeTool.java @@ -49,7 +49,7 @@ public class TreeTool { * @return true to signal operation complete, i.e. {@code shape} found, otherwise false */ public static boolean forOne(final List<Shape> shapes, final PMVMatrix pmv, final Shape shape, final Runnable action) { - for(int i=shapes.size()-1; i>=0; i--) { + for(int i=0; i<shapes.size(); ++i) { final Shape s = shapes.get(i); if( s.equals(shape) ) { pmv.glPushMatrix(); @@ -79,7 +79,7 @@ public class TreeTool { * @return true to signal operation complete and to stop traversal, i.e. {@link Visitor1#visit(Shape)} returned true, otherwise false */ public static boolean forAll(final List<Shape> shapes, final Visitor1 v) { - for(int i=shapes.size()-1; i>=0; i--) { + for(int i=0; i<shapes.size(); ++i) { final Shape s = shapes.get(i); boolean res = v.visit(s); if( !res && s instanceof Container ) { @@ -100,7 +100,7 @@ public class TreeTool { * @return true to signal operation complete and to stop traversal, i.e. {@link Visitor2#visit(Shape, PMVMatrix)} returned true, otherwise false */ public static boolean forAll(final List<Shape> shapes, final PMVMatrix pmv, final Visitor2 v) { - for(int i=shapes.size()-1; i>=0; i--) { + for(int i=0; i<shapes.size(); ++i) { final Shape s = shapes.get(i); pmv.glPushMatrix(); s.setTransform(pmv); @@ -131,7 +131,7 @@ public class TreeTool { final Object[] shapesS = shapes.toArray(); Arrays.sort(shapesS, (Comparator)sortComp); - for(int i=shapesS.length-1; i>=0; i--) { + for(int i=0; i<shapesS.length; ++i) { final Shape s = (Shape)shapesS[i]; pmv.glPushMatrix(); s.setTransform(pmv); |