JADE Java Persistence API
1.0

com.jadeworld.jade.rootschema
Class Array<M>

java.lang.Object
  extended by com.jadeworld.jade.rootschema.Object
      extended by com.jadeworld.jade.rootschema.Collection<M>
          extended by com.jadeworld.jade.rootschema.Array<M>
All Implemented Interfaces:
java.lang.Iterable<M>, java.util.Collection<M>, java.util.List<M>
Direct Known Subclasses:
BinaryArray, BooleanArray, ByteArray, CharacterArray, DateArray, DecimalArray, Integer64Array, IntegerArray, ObjectArray, PointArray, RealArray, StringArray, StringUtf8Array, TimeArray, TimeStampArray, TimeStampIntervalArray

public abstract class Array<M>
extends Collection<M>
implements java.util.List<M>

Superclass of all JADE Array classes. Implements the Java List interface plus JADE-specific methods.


Field Summary
 
Fields inherited from class com.jadeworld.jade.rootschema.Object
oid
 
Constructor Summary
Array()
           
 
Method Summary
 void add(int index, M element)
          Places an entry in the array of the object specified in the element parameter at the position specified by the index parameter.
 boolean add(M element)
          Adds an entry to the end of the array.
 boolean addAll(int index, java.util.Collection<? extends M> c)
          Inserts all of the elements in the specified collection into this list at the specified position (optional operation).
 M at(int index)
          Returns a reference to the entry in the array at the position specified by the index parameter;
for example:
 void atPut(int index, M element)
          The atPut method of the Array class places an entry in the array of the object specified in the value parameter at the position specified by the index parameter.
 M get(int index)
          Returns a reference to the entry in the array at the position specified by the index parameter;
for example:
 int indexOf(java.lang.Object o)
          Returns the index of the entry specified in the value parameter if it exists in the array or it returns zero (0) if it does not exist.
 int lastIndexOf(java.lang.Object o)
          Returns the index of the last occurrence of the specified element in this list, or -1 if this list does not contain the element.
 java.util.ListIterator<M> listIterator()
           
 java.util.ListIterator<M> listIterator(int index)
           
 M remove(int index)
          Removes an entry from an array at the position specified in the index parameter and moves all entries at a higher index down one slot to fill the gap.
 boolean remove(Object o)
          Removes the entry specified in the value parameter from an array.
 void replace(int index, M element)
          Replaces an existing entry in an array at the position specified by the index parameter with the entry specified in the value parameter.
 M set(int index, M element)
          Replaces an existing entry in an array at the position specified by the index parameter with the entry specified in the value parameter.
 java.util.List<M> subList(int from, int to)
           
 java.lang.Object[] toArray()
          Returns an Object array containing all of this collection's items in the order specified by the collection iterator.
 java.lang.Object[] toArray(java.lang.Object[] a)
          Not yet implemented
 
Methods inherited from class com.jadeworld.jade.rootschema.Collection
addAll, clear, contains, containsAll, copy, countOf, createIterator, deleteIfEmpty, first, getOwner, getStatistics, instantiate, isEmpty, iterator, last, maxSize, purge, remove, removeAll, retainAll, setBlockSize, size, toString
 
Methods inherited from class com.jadeworld.jade.rootschema.Object
changeObjectVolatility, creationTime, edition, equals, exclusiveLock, getClassNumberForObject, getInstanceIdForObject, getLockStatus, getName, getObjectStringForObject, getObjectVolatility, getOidString, getOidStringForObject, getPropertyValue, hashCode, hasMembers, isImportedObject, isKindOf, isLockedByMe, isObjectFrozen, isObjectNonSharedTransient, isObjectPersistent, isObjectSharedTransient, isObjectStable, isObjectTransient, isObjectVolatile, isSharedTransient, isSystemObject, isTransient, latestEdition, lock, makeObjectFrozen, makeObjectStable, makeObjectVolatile, reserveLock, sdeCauseEvent, sdsCauseEvent, setPropertyValue, sharedLock, tryLock, unlock, updateObjectEdition
 
Methods inherited from class java.lang.Object
equals, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
addAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, remove, removeAll, retainAll, size
 

Constructor Detail

Array

public Array()
Method Detail

add

public boolean add(M element)
Adds an entry to the end of the array. This increases the size of the array.

Specified by:
add in interface java.util.Collection<M>
Specified by:
add in interface java.util.List<M>
Overrides:
add in class Collection<M>
Parameters:
element - The object to add to the array.
Returns:
true (as specified by Collection.add(M)).

add

public void add(int index,
                M element)
Places an entry in the array of the object specified in the element parameter at the position specified by the index parameter.
If the specified index is greater than the size of the array, the array is expanded.

Specified by:
add in interface java.util.List<M>
Parameters:
element - The object to add to the array.
index - The index at which to insert the object.

addAll

public boolean addAll(int index,
                      java.util.Collection<? extends M> c)
Inserts all of the elements in the specified collection into this list at the specified position (optional operation). Shifts the element currently at that position (if any) and any subsequent elements to the right (increases their indices). The new elements appear in this list in the order that they are returned by the specified collection's iterator. The behavior of this operation is undefined if the specified collection is modified while the operation is in progress. (Note that this will occur if the specified collection is this list, and it is non-empty.)

Specified by:
addAll in interface java.util.List<M>
Parameters:
index - Index at which to insert the first element from the specified collection
c - Collection containing elements to be added to this list
Returns:
true if this list is changed as a result of the call

get

public M get(int index)
Returns a reference to the entry in the array at the position specified by the index parameter;
for example:

firstCustomer = currentList.get(0);

If there is no entry at the specified index, an exception is raised.

Specified by:
get in interface java.util.List<M>
Parameters:
index - Index of the item to return.
Returns:
The item at the specified position in this list.

set

public M set(int index,
             M element)
Replaces an existing entry in an array at the position specified by the index parameter with the entry specified in the value parameter.
If the specified index does not exist, an exception is raised.

Specified by:
set in interface java.util.List<M>
Parameters:
index - Index of the element to replace.
element - Element to be stored at the specified position.
Returns:
The element previously at the specified position.

lastIndexOf

public int lastIndexOf(java.lang.Object o)
Returns the index of the last occurrence of the specified element in this list, or -1 if this list does not contain the element.

Specified by:
lastIndexOf in interface java.util.List<M>
Parameters:
o - The object to check for.
Returns:
The last index of this element.

indexOf

public int indexOf(java.lang.Object o)
Returns the index of the entry specified in the value parameter if it exists in the array or it returns zero (0) if it does not exist. If the specified value occurs more than once in the array, the index of the first occurrence is returned.

Specified by:
indexOf in interface java.util.List<M>
Overrides:
indexOf in class Collection<M>
Parameters:
o - The object to check for.
Returns:
The (first) index of this element.

remove

public M remove(int index)
Removes an entry from an array at the position specified in the index parameter and moves all entries at a higher index down one slot to fill the gap.
If the specified index does not exist, an exception is raised.

Specified by:
remove in interface java.util.List<M>
Parameters:
index - Index of the element to remove.
Returns:
The element previously at the specified position.

remove

public boolean remove(Object o)
Removes the entry specified in the value parameter from an array. Any entry at a higher index is moved down one slot to fill the gap.
If the specified entry occurs more than once in the array, only the first entry is removed.

Parameters:
o - The element to remove.
Returns:
true if the item was removed, otherwise false.

toArray

public java.lang.Object[] toArray()
Returns an Object array containing all of this collection's items in the order specified by the collection iterator.

Specified by:
toArray in interface java.util.Collection<M>
Specified by:
toArray in interface java.util.List<M>
Overrides:
toArray in class Collection<M>
Returns:
The collection as an Object array.

toArray

public java.lang.Object[] toArray(java.lang.Object[] a)
Not yet implemented

Specified by:
toArray in interface java.util.Collection<M>
Specified by:
toArray in interface java.util.List<M>
Overrides:
toArray in class Collection<M>

subList

public java.util.List<M> subList(int from,
                                 int to)
Specified by:
subList in interface java.util.List<M>

listIterator

public java.util.ListIterator<M> listIterator()
Specified by:
listIterator in interface java.util.List<M>

listIterator

public java.util.ListIterator<M> listIterator(int index)
Specified by:
listIterator in interface java.util.List<M>

at

public M at(int index)
Returns a reference to the entry in the array at the position specified by the index parameter;
for example:

firstCustomer = currentList.at(0);

If there is no entry at the specified index, an exception is raised.
JADE-only method, the JADE version of get(int).

Parameters:
index - Index of the item to return.
Returns:
The item at the specified position in this list.

atPut

public void atPut(int index,
                  M element)
The atPut method of the Array class places an entry in the array of the object specified in the value parameter at the position specified by the index parameter.
If the specified index is greater than the size of the array, the array is expanded.

Parameters:
element - The object to add to the array.
index - The index at which to insert the object.

replace

public void replace(int index,
                    M element)
Replaces an existing entry in an array at the position specified by the index parameter with the entry specified in the value parameter.
If the specified index does not exist, an exception is raised.
This differs from set(int, M) in that it does not return the previous value. The set method implements the java.util.List behavior and the replace methods implements the JADE behavior.
JADE-only method.

Parameters:
index - Index of the element to replace.
element - Element to be stored at the specified position.

JADE Java Persistence API
1.0

Copyright © 2007 Jade Software Corporation