ObjectSpace Homepage

JGL - The Generic Collection Library for Java
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.objectspace.jgl.adapters.ArrayAdapter

java.lang.Object
   |
   +----com.objectspace.jgl.adapters.ArrayAdapter

public abstract class ArrayAdapter
extends Object
implements Sequence
super class of:
BooleanArray, BooleanBuffer, ByteArray, CharArray, DoubleArray, FloatArray, IntArray, LongArray, ObjectArray, ShortArray, VectorArray
ArrayAdapter is the base class of all array adapters, including those that adapt the JDK Vector and Java native arrays.

See Also:
BooleanArray, ByteArray, CharArray, DoubleArray, FloatArray, IntArray, LongArray, ObjectArray, ShortArray, VectorArray

Constructor Index

 o ArrayAdapter()

Method Index

 o add(Object)
Add an object to myself.
 o back()
Return my last element.
 o checkIndex(int, int)
 o checkRange(int, int, int)
 o clear()
Remove all of my objects.
 o clone()
 o contains(Object)
Return true if I contain a particular object using .equals()
 o count(int, int, Object)
Return the number of objects within a specified range of that match a particular value.
 o count(Object)
Return the number of objects that match a specified object.
 o equals(Object)
 o front()
Return my first element.
 o hashCode()
Return my hash code for support of hashing containers
 o indexOf(int, int, Object)
Return an index positioned at the first object within a specified range that matches a particular object, or -1 if the object is not found.
 o indexOf(Object)
Return the index of the first object that matches a particular value, or -1 if the object is not found.
 o isEmpty()
Return true if I contain no objects.
 o maxSize()
Return the maximum number of entries that I can contain.
 o popBack()
Remove and return my last element.
 o popFront()
Remove and return my first element.
 o pushBack(Object)
Add an object at my end.
 o pushFront(Object)
Insert an object in front of my first element.
 o remove(Enumeration)
Remove the element at a particular position.
 o remove(Enumeration, Enumeration)
Remove the elements in the specified range.
 o remove(int, int, Object)
Remove all elements within a specified range that match a particular object and return the number of objects that were removed.
 o remove(Object)
Remove all elements that match a specified object and return the number of objects that were removed.
 o remove(Object, int)
Remove at most a given number of elements that match a specified object and return the number of objects that were removed.
 o replace(int, int, Object, Object)
Replace all elements within a specified range that match a particular object with a new value and return the number of objects that were replaced.
 o replace(Object, Object)
Replace all elements that match a particular object with a new value and return the number of objects that were replaced.

Constructors

 o ArrayAdapter
 public ArrayAdapter()

Methods

 o clone
 public Object clone()
Overrides:
clone in class Object
 o equals
 public boolean equals(Object object)
Overrides:
equals in class Object
 o hashCode
 public synchronized int hashCode()
Return my hash code for support of hashing containers

Overrides:
hashCode in class Object
 o isEmpty
 public boolean isEmpty()
Return true if I contain no objects.

 o back
 public Object back()
Return my last element.

 o front
 public Object front()
Return my first element.

 o count
 public int count(Object object)
Return the number of objects that match a specified object.

Parameters:
object - The object to count.
 o count
 public synchronized int count(int first,
                               int last,
                               Object object)
Return the number of objects within a specified range of that match a particular value. the range is inclusive

Parameters:
first - The index of the first object to consider.
last - The index of the last object to consider.
Throws: IndexOutOfBoundsException
If either index is invalid.
 o replace
 public int replace(Object oldValue,
                    Object newValue)
Replace all elements that match a particular object with a new value and return the number of objects that were replaced.

Parameters:
oldValue - The object to be replaced.
newValue - The value to substitute.
 o replace
 public synchronized int replace(int first,
                                 int last,
                                 Object oldValue,
                                 Object newValue)
Replace all elements within a specified range that match a particular object with a new value and return the number of objects that were replaced.

Parameters:
first - The index of the first object to be considered.
last - The index of the last object to be considered.
oldValue - The object to be replaced.
newValue - The value to substitute.
Throws: IndexOutOfBoundsException
If either index is invalid.
 o contains
 public boolean contains(Object object)
Return true if I contain a particular object using .equals()

Parameters:
object - The object in question.
 o indexOf
 public int indexOf(Object object)
Return the index of the first object that matches a particular value, or -1 if the object is not found. Uses .equals() to find a match

Parameters:
object - The object to find.
Throws: ClassCastException
if objects are not Boolean
 o indexOf
 public synchronized int indexOf(int first,
                                 int last,
                                 Object object)
Return an index positioned at the first object within a specified range that matches a particular object, or -1 if the object is not found.

Parameters:
first - The index of the first object to consider.
last - The index of the last object to consider.
object - The object to find.
Throws: IndexOutOfBoundsException
If either index is invalid.
Throws: ClassCastException
if objects are not Boolean
 o clear
 public void clear()
Remove all of my objects. By default, this method throws an exception.

Throws: InvalidOperationException
Thrown by default.
 o add
 public Object add(Object object)
Add an object to myself. By default, this method throws an exception.

Parameters:
object - The object to add.
Throws: InvalidOperationException
Thrown by default.
 o pushFront
 public void pushFront(Object object)
Insert an object in front of my first element. By default, this method throws an exception.

Parameters:
object - The object to insert.
Throws: InvalidOperationException
Thrown by default.
 o popFront
 public Object popFront()
Remove and return my first element. By default, this method throws an exception.

Throws: InvalidOperationException
Thrown by default.
 o pushBack
 public void pushBack(Object object)
Add an object at my end. By default, this method throws an exception.

Parameters:
object - The object to add.
Throws: InvalidOperationException
Thrown by default.
 o popBack
 public Object popBack()
Remove and return my last element. By default, this method throws an exception.

Throws: InvalidOperationException
Thrown by default.
 o remove
 public Object remove(Enumeration pos)
Remove the element at a particular position.

Parameters:
pos - The enumeration representing of the object to remove.
Throws: InvalidOperationException
Thrown by default.
 o remove
 public int remove(Enumeration first,
                   Enumeration last)
Remove the elements in the specified range.

Parameters:
pos - The enumeration representing of the object to remove.
Throws: InvalidOperationException
Thrown by default.
 o remove
 public int remove(Object object)
Remove all elements that match a specified object and return the number of objects that were removed. By default, this method throws an exception.

Parameters:
object - The object to remove.
Throws: InvalidOperationException
Thrown by default.
 o remove
 public int remove(Object object,
                   int count)
Remove at most a given number of elements that match a specified object and return the number of objects that were removed. By default, this method throws an exception.

Parameters:
object - The object to remove.
count - The maximum number of objects to remove.
Throws: InvalidOperationException
Thrown by default.
 o remove
 public int remove(int first,
                   int last,
                   Object object)
Remove all elements within a specified range that match a particular object and return the number of objects that were removed. By default, this method throws an exception.

Parameters:
first - The index of the first object to remove.
last - The index of the last object to remove.
object - The object to remove.
Throws: IndexOutOfBoundsException
Thrown by default.
 o maxSize
 public int maxSize()
Return the maximum number of entries that I can contain.

 o checkIndex
 protected static final void checkIndex(int i,
                                        int size)
 o checkRange
 protected static final void checkRange(int lo,
                                        int hi,
                                        int size)

All Packages  Class Hierarchy  This Package  Previous  Next  Index