diff options
author | Sven Gothel <[email protected]> | 2012-12-31 14:52:36 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2012-12-31 14:52:36 +0100 |
commit | 8b3e5b94bcd3167278eb972b2be37086d3bd2996 (patch) | |
tree | c09970a1990e3bb7bb676f275c0a51af63df3cb6 /src/java/com/jogamp/common/util/FloatStack.java | |
parent | ac16df0bab94fab313030ead42644844d1690a82 (diff) |
PrimitiveStack: Add 'void position(int)' to set new position. Add test case w/ initialSizeElem:=0.
Diffstat (limited to 'src/java/com/jogamp/common/util/FloatStack.java')
-rw-r--r-- | src/java/com/jogamp/common/util/FloatStack.java | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/java/com/jogamp/common/util/FloatStack.java b/src/java/com/jogamp/common/util/FloatStack.java index e5790a9..2addd76 100644 --- a/src/java/com/jogamp/common/util/FloatStack.java +++ b/src/java/com/jogamp/common/util/FloatStack.java @@ -63,6 +63,14 @@ public class /*name*/FloatStack/*name*/ implements PrimitiveStack { public final int position() { return position; } @Override + public final void position(int newPosition) throws IndexOutOfBoundsException { + if( 0 > position || position >= buffer.length ) { + throw new IndexOutOfBoundsException("Invalid new position "+newPosition+", "+this.toString()); + } + position = newPosition; + } + + @Override public final int remaining() { return buffer.length - position; } @Override @@ -72,7 +80,7 @@ public class /*name*/FloatStack/*name*/ implements PrimitiveStack { public final void setGrowSize(int newGrowSize) { growSize = newGrowSize; } public final String toString() { - return "FloatStack[0..(top "+position+").."+buffer.length+", remaining "+remaining()+"]"; + return "FloatStack[0..(pos "+position+").."+buffer.length+", remaining "+remaining()+"]"; } public final /*value*/float/*value*/[] buffer() { return buffer; } |