com.mapquest
Class MQObjectCollection

java.lang.Object
  extended bycom.mapquest.MQObject
      extended bycom.mapquest.MQObjectCollection
All Implemented Interfaces:
java.lang.Cloneable
Direct Known Subclasses:
CatToDTMapCollection, CoverageStyle, DBLayerQueryCollection, FeatureCollection, FeatureSpecifierCollection, GeocodeOptionsCollection, LatLngCollection, LocationCollection, LocationCollectionCollection, ManeuverCollection, PointCollection, PrimitiveCollection, Session, SignCollection, TrekRouteCollection

public abstract class MQObjectCollection
extends MQObject

An abstract collection of MQObject 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
MQObjectCollection()
          Default constructor.
 
Method Summary
 void add(MQObject obj)
          Adds a MQObject to the collection.
 void append(MQObjectCollection collection)
          Appends one MQObjectCollection to another.
 boolean equals(java.lang.Object otherObject)
          Compares this object to the specified object.
 MQObject 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 MQObjectCollection.
 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

MQObjectCollection

public MQObjectCollection()
Default constructor.

Method Detail

init

public void init()
Initializes object.

Overrides:
init in class MQObject

add

public void add(MQObject obj)
Adds a MQObject to the collection.

Parameters:
obj - The new MQObject to be added to the collection.
Throws:
java.lang.IllegalArgumentException - Invalid object for this collection.

append

public void append(MQObjectCollection collection)
Appends one MQObjectCollection to another.

Parameters:
collection - The MQObjectCollection which is to be added to "this" MQObjectCollection.
See Also:
get(int), add(MQObject)

get

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

Parameters:
index - index of element to return.
Returns:
MQObject 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 MQObjectCollection object that has same attributes as this object.

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

hashCode

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

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