org.openbp.common.util
Class PrimitiveArray

java.lang.Object
  extended by org.openbp.common.util.PrimitiveArray

public class PrimitiveArray
extends java.lang.Object

Contains an array of a primitive data type, which is specified by the set method and provides methods to access this array easily.

Author:
Andreas Putz

Constructor Summary
PrimitiveArray()
          Constructor.
PrimitiveArray(int capacity)
          Constructor.
 
Method Summary
 void add(int value)
          Adds a integer value.
 void clear()
          Removes all of the elements from this list.
 void clear(int index)
          Clear the array beginning from the index.
 void ensureCapacity(int capacity)
          Ensures the capacity of the array.
 int get(int index)
          Gets the integer value by the index.
 int getSize()
          Gets the length of the array.
 void set(int index, int value)
          Sets the integer value at the index.
 void setDefaultReturnValue(int value)
          Sets the default return value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PrimitiveArray

public PrimitiveArray()
Constructor.


PrimitiveArray

public PrimitiveArray(int capacity)
Constructor.

Parameters:
capacity - The initial capacity of the array
Method Detail

ensureCapacity

public void ensureCapacity(int capacity)
Ensures the capacity of the array.

Parameters:
capacity - The capacity of the array which is to ensure

getSize

public int getSize()
Gets the length of the array.


clear

public void clear()
Removes all of the elements from this list. The list will be empty after this call returns.


clear

public void clear(int index)
Clear the array beginning from the index.

Parameters:
index - The start index to clear

set

public void set(int index,
                int value)
Sets the integer value at the index.

Parameters:
index - The array index
value - The integer value

get

public int get(int index)
Gets the integer value by the index.

Parameters:
index - The array index
Returns:
The integer value

add

public void add(int value)
Adds a integer value.

Parameters:
value - The integer value to add

setDefaultReturnValue

public void setDefaultReturnValue(int value)
Sets the default return value.



Copyright © 2011. All Rights Reserved.