diff options
author | Sven Gothel <[email protected]> | 2015-07-30 02:53:59 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2015-07-30 02:53:59 +0200 |
commit | 0caa9474833a224060b9e4deefb7e0b171a8f273 (patch) | |
tree | 3af8546c959d51306d4efe320cdaa29c0fd03ba8 | |
parent | e241034942725b7a189cb6186fd331d9defde7bc (diff) |
Bitfield: Use IndexOutOfBoundsException instead of ArrayIndexOutOfBoundsException
-rw-r--r-- | src/java/com/jogamp/common/util/Bitfield.java | 24 | ||||
-rw-r--r-- | src/java/jogamp/common/util/Int32ArrayBitfield.java | 16 | ||||
-rw-r--r-- | src/java/jogamp/common/util/Int32Bitfield.java | 16 |
3 files changed, 28 insertions, 28 deletions
diff --git a/src/java/com/jogamp/common/util/Bitfield.java b/src/java/com/jogamp/common/util/Bitfield.java index 9155603..8c31fc6 100644 --- a/src/java/com/jogamp/common/util/Bitfield.java +++ b/src/java/com/jogamp/common/util/Bitfield.java @@ -81,46 +81,46 @@ public interface Bitfield { /** * Returns the 32 bit integer mask w/ its lowest bit at the bit number {@code rightBitnum}. * @param rightBitnum bit number denoting the position of the lowest bit, restricted to [0..{@link #getStorageBitSize()}-32]. - * @throws ArrayIndexOutOfBoundsException if {@code rightBitnum} is out of bounds + * @throws IndexOutOfBoundsException if {@code rightBitnum} is out of bounds */ - int getInt32(final int rightBitnum) throws ArrayIndexOutOfBoundsException; + int getInt32(final int rightBitnum) throws IndexOutOfBoundsException; /** * Sets the given 32 bit integer mask w/ its lowest bit at the bit number {@code rightBitnum}. * @param rightBitnum bit number denoting the position of the lowest bit, restricted to [0..{@link #getStorageBitSize()}-32]. * @param mask denoting the 32 bit mask value to store - * @throws ArrayIndexOutOfBoundsException if {@code rightBitnum} is out of bounds + * @throws IndexOutOfBoundsException if {@code rightBitnum} is out of bounds */ - void putInt32(final int rightBitnum, final int mask) throws ArrayIndexOutOfBoundsException; + void putInt32(final int rightBitnum, final int mask) throws IndexOutOfBoundsException; /** * Return <code>true</code> if the bit at position <code>bitnum</code> is set, otherwise <code>false</code>. * @param bitnum bit number, restricted to [0..{@link #getStorageBitSize()}-1]. - * @throws ArrayIndexOutOfBoundsException if {@code bitnum} is out of bounds + * @throws IndexOutOfBoundsException if {@code bitnum} is out of bounds */ - boolean get(final int bitnum) throws ArrayIndexOutOfBoundsException; + boolean get(final int bitnum) throws IndexOutOfBoundsException; /** * Set or clear the bit at position <code>bitnum</code> according to <code>bit</code> * and return the previous value. * @param bitnum bit number, restricted to [0..{@link #getStorageBitSize()}-1]. - * @throws ArrayIndexOutOfBoundsException if {@code bitnum} is out of bounds + * @throws IndexOutOfBoundsException if {@code bitnum} is out of bounds */ - boolean put(final int bitnum, final boolean bit) throws ArrayIndexOutOfBoundsException; + boolean put(final int bitnum, final boolean bit) throws IndexOutOfBoundsException; /** * Set the bit at position <code>bitnum</code> according to <code>bit</code>. * @param bitnum bit number, restricted to [0..{@link #getStorageBitSize()}-1]. - * @throws ArrayIndexOutOfBoundsException if {@code bitnum} is out of bounds + * @throws IndexOutOfBoundsException if {@code bitnum} is out of bounds */ - void set(final int bitnum) throws ArrayIndexOutOfBoundsException; + void set(final int bitnum) throws IndexOutOfBoundsException; /** * Clear the bit at position <code>bitnum</code> according to <code>bit</code>. * @param bitnum bit number, restricted to [0..{@link #getStorageBitSize()}-1]. - * @throws ArrayIndexOutOfBoundsException if {@code bitnum} is out of bounds + * @throws IndexOutOfBoundsException if {@code bitnum} is out of bounds */ - void clear(final int bitnum) throws ArrayIndexOutOfBoundsException; + void clear(final int bitnum) throws IndexOutOfBoundsException; /** * Returns the number of set bits within this bitfield. diff --git a/src/java/jogamp/common/util/Int32ArrayBitfield.java b/src/java/jogamp/common/util/Int32ArrayBitfield.java index d0ce669..954680c 100644 --- a/src/java/jogamp/common/util/Int32ArrayBitfield.java +++ b/src/java/jogamp/common/util/Int32ArrayBitfield.java @@ -54,14 +54,14 @@ public class Int32ArrayBitfield implements Bitfield { return bitSize; } - private final void check(final int limit, final int bitnum) throws ArrayIndexOutOfBoundsException { + private final void check(final int limit, final int bitnum) throws IndexOutOfBoundsException { if( 0 > bitnum || bitnum >= limit ) { - throw new ArrayIndexOutOfBoundsException("Bitnum should be within [0.."+(limit-1)+"], but is "+bitnum); + throw new IndexOutOfBoundsException("Bitnum should be within [0.."+(limit-1)+"], but is "+bitnum); } } @Override - public final int getInt32(final int rightBitnum) throws ArrayIndexOutOfBoundsException { + public final int getInt32(final int rightBitnum) throws IndexOutOfBoundsException { check(bitSize-31, rightBitnum); if( 0 == rightBitnum % 32 ) { // fast path @@ -73,7 +73,7 @@ public class Int32ArrayBitfield implements Bitfield { } @Override - public final void putInt32(final int rightBitnum, final int mask) throws ArrayIndexOutOfBoundsException { + public final void putInt32(final int rightBitnum, final int mask) throws IndexOutOfBoundsException { check(bitSize-31, rightBitnum); if( 0 == rightBitnum % 32 ) { // fast path @@ -85,7 +85,7 @@ public class Int32ArrayBitfield implements Bitfield { } @Override - public final boolean get(final int bitnum) throws ArrayIndexOutOfBoundsException { + public final boolean get(final int bitnum) throws IndexOutOfBoundsException { check(bitSize, bitnum); final int u = bitnum >>> UNIT_SHIFT; final int b = bitnum - ( u << UNIT_SHIFT ); @@ -93,7 +93,7 @@ public class Int32ArrayBitfield implements Bitfield { } @Override - public final boolean put(final int bitnum, final boolean bit) throws ArrayIndexOutOfBoundsException { + public final boolean put(final int bitnum, final boolean bit) throws IndexOutOfBoundsException { check(bitSize, bitnum); final int u = bitnum >>> UNIT_SHIFT; final int b = bitnum - ( u << UNIT_SHIFT ); @@ -109,7 +109,7 @@ public class Int32ArrayBitfield implements Bitfield { return prev; } @Override - public final void set(final int bitnum) throws ArrayIndexOutOfBoundsException { + public final void set(final int bitnum) throws IndexOutOfBoundsException { check(bitSize, bitnum); final int u = bitnum >>> UNIT_SHIFT; final int b = bitnum - ( u << UNIT_SHIFT ); @@ -117,7 +117,7 @@ public class Int32ArrayBitfield implements Bitfield { storage[u] |= m; } @Override - public final void clear (final int bitnum) throws ArrayIndexOutOfBoundsException { + public final void clear (final int bitnum) throws IndexOutOfBoundsException { check(bitSize, bitnum); final int u = bitnum >>> UNIT_SHIFT; final int b = bitnum - ( u << UNIT_SHIFT ); diff --git a/src/java/jogamp/common/util/Int32Bitfield.java b/src/java/jogamp/common/util/Int32Bitfield.java index 28faf2c..f81b486 100644 --- a/src/java/jogamp/common/util/Int32Bitfield.java +++ b/src/java/jogamp/common/util/Int32Bitfield.java @@ -49,32 +49,32 @@ public class Int32Bitfield implements Bitfield { return UNIT_SIZE; } - private final void check(final int limit, final int bitnum) throws ArrayIndexOutOfBoundsException { + private final void check(final int limit, final int bitnum) throws IndexOutOfBoundsException { if( 0 > bitnum || bitnum >= limit ) { - throw new ArrayIndexOutOfBoundsException("Bitnum should be within [0.."+(limit-1)+"], but is "+bitnum); + throw new IndexOutOfBoundsException("Bitnum should be within [0.."+(limit-1)+"], but is "+bitnum); } } @Override - public final int getInt32(final int rightBitnum) throws ArrayIndexOutOfBoundsException { + public final int getInt32(final int rightBitnum) throws IndexOutOfBoundsException { check(UNIT_SIZE-31, rightBitnum); return storage; } @Override - public final void putInt32(final int rightBitnum, final int mask) throws ArrayIndexOutOfBoundsException { + public final void putInt32(final int rightBitnum, final int mask) throws IndexOutOfBoundsException { check(UNIT_SIZE-31, rightBitnum); storage = mask; } @Override - public final boolean get(final int bitnum) throws ArrayIndexOutOfBoundsException { + public final boolean get(final int bitnum) throws IndexOutOfBoundsException { check(UNIT_SIZE, bitnum); return 0 != ( storage & ( 1 << bitnum ) ) ; } @Override - public final boolean put(final int bitnum, final boolean bit) throws ArrayIndexOutOfBoundsException { + public final boolean put(final int bitnum, final boolean bit) throws IndexOutOfBoundsException { check(UNIT_SIZE, bitnum); final int m = 1 << bitnum; final boolean prev = 0 != ( storage & m ) ; @@ -88,13 +88,13 @@ public class Int32Bitfield implements Bitfield { return prev; } @Override - public final void set(final int bitnum) throws ArrayIndexOutOfBoundsException { + public final void set(final int bitnum) throws IndexOutOfBoundsException { check(UNIT_SIZE, bitnum); final int m = 1 << bitnum; storage |= m; } @Override - public final void clear (final int bitnum) throws ArrayIndexOutOfBoundsException { + public final void clear (final int bitnum) throws IndexOutOfBoundsException { check(UNIT_SIZE, bitnum); final int m = 1 << bitnum; storage &= ~m; |