public class SimpleArray
extends java.lang.Object
Constructor and Description |
---|
SimpleArray(int size)
Constructs a SimpleArray object of type
int of a specified
size and initializes the 'writeIndex' to zero (0). |
Modifier and Type | Method and Description |
---|---|
void |
add(int value)
Adds a value to an element of the shared array after the thread is put
to sleep for between zero (0) to 499 milliseconds.
|
int |
getLength()
Returns the size of the array.
|
java.lang.String |
toString()
Returns the contents of the array as a String.
|
public SimpleArray(int size) throws java.lang.IllegalArgumentException
int
of a specified
size and initializes the 'writeIndex' to zero (0).size
- the size of the arrayjava.lang.IllegalArgumentException
- if the size of the array is not a positive numberpublic void add(int value)
value
- the value added to the shared arraypublic int getLength()
public java.lang.String toString()
toString
in class java.lang.Object