net.rim.device.api.lbs.maps.utils
Class MappableVector

java.lang.Object
  extended by java.util.Vector
      extended by net.rim.device.api.lbs.maps.utils.MappableVector
All Implemented Interfaces:
Boxable

public class MappableVector
extends Vector
implements Boxable

Represents a vector of Mappable objects.

Since:
BlackBerry API 6.0.0

Field Summary
 
Fields inherited from class java.util.Vector
capacityIncrement, elementCount, elementData
 
Constructor Summary
MappableVector()
          Constructs a new MappableVector instance.
MappableVector(int initialCapacity)
          Constructs a new MappableVector instance using the initial capacity of the vector.
MappableVector(int initialCapacity, int capacityIncrement)
          Constructs a new MappableVector instance using the initial capacity and capacity increment for the vector.
MappableVector(Mappable[] data)
          Constructs a copy of a MappableVector instance using the specified array.
 
Method Summary
 void addAllMappables(Vector collection)
          Adds all objects that are of type Mappable in the given collection.
 void addAllMappables(Mappable[] data)
          Adds all objects in the given array to this collection.
 void addElement(Object element)
          Adds the specified component to the end of this vector, increasing its size by one.
 LatLonRectangle getBoundingBox()
          Retrieves the latitude and longitude-based bounding box of this mappable item.
 void insertElementAt(Object element, int index)
          Inserts the specified object as a component in this vector at the specified index.
 Mappable mappableAt(int index)
          Retrieves the Mappable entity at the given index.
 void removeAllElements()
          Removes all components from this vector and sets its size to zero.
 boolean removeElement(Object obj)
          Removes the first occurrence of the argument from this vector.
 void removeElementAt(int index)
          Deletes the component at the specified index.
 void setElementAt(Object element, int index)
          Sets the component at the specified index of this vector to be the specified object.
 void setSize(int newSize)
          Sets the size of this vector.
 
Methods inherited from class java.util.Vector
capacity, contains, copyInto, elementAt, elements, ensureCapacity, firstElement, indexOf, indexOf, isEmpty, lastElement, lastIndexOf, lastIndexOf, size, toString, trimToSize
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 



Constructor Detail

MappableVector

public MappableVector()
Constructs a new MappableVector instance.

Since:
BlackBerry API 6.0.0

MappableVector

public MappableVector(int initialCapacity)
Constructs a new MappableVector instance using the initial capacity of the vector.

Parameters:
initialCapacity - The initial capacity of the vector.
Since:
BlackBerry API 6.0.0

MappableVector

public MappableVector(int initialCapacity,
                      int capacityIncrement)
Constructs a new MappableVector instance using the initial capacity and capacity increment for the vector.

Parameters:
initialCapacity - the initial capacity of the vector.
capacityIncrement - The amount by which the capacity is increased when the vector overflows.
Since:
BlackBerry API 6.0.0

MappableVector

public MappableVector(Mappable[] data)
Constructs a copy of a MappableVector instance using the specified array.

Parameters:
data - An array of mappable items to initially populate this vector with.
Since:
BlackBerry API 6.0.0


Method Detail

addElement

public void addElement(Object element)
Description copied from class: Vector
Adds the specified component to the end of this vector, increasing its size by one. The capacity of this vector is increased if its size becomes greater than its capacity.

Overrides:
addElement in class Vector
Parameters:
element - the component to be added.
See Also:
Vector.addElement(Object)
Since:
BlackBerry API 6.0.0

insertElementAt

public void insertElementAt(Object element,
                            int index)
Description copied from class: Vector
Inserts the specified object as a component in this vector at the specified index. Each component in this vector with an index greater or equal to the specified index is shifted upward to have an index one greater than the value it had previously.

The index must be a value greater than or equal to 0 and less than or equal to the current size of the vector.

Overrides:
insertElementAt in class Vector
Parameters:
element - the component to insert.
index - where to insert the new component.
See Also:
Vector.insertElementAt(Object, int)
Since:
BlackBerry API 6.0.0

setElementAt

public void setElementAt(Object element,
                         int index)
Description copied from class: Vector
Sets the component at the specified index of this vector to be the specified object. The previous component at that position is discarded.

The index must be a value greater than or equal to 0 and less than the current size of the vector.

Overrides:
setElementAt in class Vector
Parameters:
element - what the component is to be set to.
index - the specified index.
See Also:
Vector.setElementAt(Object, int)
Since:
BlackBerry API 6.0.0

removeAllElements

public void removeAllElements()
Description copied from class: Vector
Removes all components from this vector and sets its size to zero.

Overrides:
removeAllElements in class Vector
Since:
BlackBerry API 7.0.0

removeElement

public boolean removeElement(Object obj)
Description copied from class: Vector
Removes the first occurrence of the argument from this vector. If the object is found in this vector, each component in the vector with an index greater or equal to the object's index is shifted downward to have an index one smaller than the value it had previously.

Overrides:
removeElement in class Vector
Parameters:
obj - the component to be removed.
Returns:
true if the argument was a component of this vector; false otherwise.
Since:
BlackBerry API 7.0.0

removeElementAt

public void removeElementAt(int index)
Description copied from class: Vector
Deletes the component at the specified index. Each component in this vector 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 index must be a value greater than or equal to 0 and less than the current size of the vector.

Overrides:
removeElementAt in class Vector
Parameters:
index - the index of the object to remove.
See Also:
Vector.size()
Since:
BlackBerry API 7.0.0

setSize

public void setSize(int newSize)
Description copied from class: Vector
Sets the size of this vector. If the new size is greater than the current size, new null items are added to the end of the vector. If the new size is less than the current size, all components at index newSize and greater are discarded.

Overrides:
setSize in class Vector
Parameters:
newSize - the new size of this vector.
Since:
BlackBerry API 7.0.0

getBoundingBox

public LatLonRectangle getBoundingBox()
Description copied from interface: Boxable
Retrieves the latitude and longitude-based bounding box of this mappable item.

Note: It's recommended that for classes that implement Boxable that the bounding box calculation be performed at request time, and not at modification time. When there are multiple modifications to perform, continuous recalculation of the bounding box is unnecessary.

It's also recommended that you cache the bounding box information once it's been calculated because requests for the bounding box may be frequent.

Specified by:
getBoundingBox in interface Boxable
Returns:
The axis-aligned bounding box or null if there is no bounding box.
See Also:
Boxable.getBoundingBox()
Since:
BlackBerry API 6.0.0

mappableAt

public Mappable mappableAt(int index)
Retrieves the Mappable entity at the given index. This method behaves similarly to elementAt(int) with the exception that the return is of type Mappable.

Parameters:
index - The index for the Mappable entity.
Returns:
The Mappable entity at the given index.
Since:
BlackBerry API 6.0.0

addAllMappables

public void addAllMappables(Vector collection)
Adds all objects that are of type Mappable in the given collection. For elements that are not mappable, they are not added to this collection.

Parameters:
collection - The collection to add all Mappable objects.
Since:
BlackBerry API 6.0.0

addAllMappables

public void addAllMappables(Mappable[] data)
Adds all objects in the given array to this collection.

Parameters:
data - The data for the array of Mappable items.
Since:
BlackBerry API 6.0.0





Copyright 1999-2011 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Java is a trademark of Oracle America Inc. in the US and other countries.
Legal