com.mapquest
Class ObjectCollection

java.lang.Object
  extended bycom.mapquest.MQObject
      extended bycom.mapquest.ObjectCollection
All Implemented Interfaces:
java.lang.Cloneable
Direct Known Subclasses:
DTCollection, IntCollection, StringCollection

public abstract class ObjectCollection
extends MQObject

An abstract collection of Object objects. Note that this implementation is not synchronized.


Field Summary
 
Fields inherited from class com.mapquest.MQObject
CLASS_ID, CLASS_NAME, DEFAULT_ID, DEFAULT_NAME, DEFAULT_VERSION, FORMAT_NUMERIC_ID, FORMAT_TEXT_NAME, INVALID_ID, INVALID_NAME, INVALID_VERSION
 
Constructor Summary
ObjectCollection()
          Default constructor.
 
Method Summary
 boolean equals(java.lang.Object otherObject)
          Compares this object to the specified object.
 java.lang.Object get(int index)
          Returns the element at the specified position in this collection.
 int getSize()
          Returns the number of components in this collection.
 int hashCode()
          Returns a hash code for this ObjectCollection.
 void init()
          Initializes object.
 void remove(int index)
          Deletes the component at the specified index.
 void removeAll()
          Removes all components from this collection and sets its size to zero.
 void removeAt(int index)
          Deprecated. Use remove(int) instead.
 
Methods inherited from class com.mapquest.MQObject
clone, getClassId, getClassName, getFormat, getIdWithVersion, getNameWithVersion, getObjectVersion, getTypeId, getTypeName, getVerboseConsoleOutput, setFormat, setObjectVersion, setVerboseConsoleOutput, toString
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ObjectCollection

public ObjectCollection()
Default constructor.

Method Detail

init

public void init()
Initializes object.

Overrides:
init in class MQObject

get

public java.lang.Object get(int index)
Returns the element at the specified position in this collection.

Parameters:
index - index of element to return.
Returns:
Object at the specified index.
Throws:
java.lang.ArrayIndexOutOfBoundsException - index is out of range (index < 0 || index >= getSize()).

remove

public void remove(int index)
Deletes the component at the specified index. Each component in this collection with an index greater or equal to the specified index is shifted downward to have an index one smaller than the value it had previously. The size of this collection is decreased by 1. The index must be a value greater than or equal to 0 and less than the current size of the collection.

Parameters:
index - The index of the object to remove.
Throws:
java.lang.ArrayIndexOutOfBoundsException - index is out of range (index < 0 || index >= getSize()).

removeAt

public void removeAt(int index)
Deprecated. Use remove(int) instead.

Deletes the component at the specified index. Each component in this collection with an index greater or equal to the specified index is shifted downward to have an index one smaller than the value it had previously. The size of this collection is decreased by 1. The index must be a value greater than or equal to 0 and less than the current size of the collection. Calls remove(int).

Parameters:
index - The index of the object to remove.
See Also:
remove(int)

removeAll

public void removeAll()
Removes all components from this collection and sets its size to zero.


getSize

public int getSize()
Returns the number of components in this collection.

Returns:
the number of components in this collection.

equals

public boolean equals(java.lang.Object otherObject)
Compares this object to the specified object. The result is true if and only if the argument is not null and is a ObjectCollection object that has same attributes as this object.

Overrides:
equals in class MQObject
Parameters:
otherObject - the object to compare this ObjectCollection against.
Returns:
true if the ObjectCollection objects are equal; false otherwise.

hashCode

public int hashCode()
Returns a hash code for this ObjectCollection.

Overrides:
hashCode in class MQObject
Returns:
a hash code value for this ObjectCollection.