net.rim.device.api.lbs.maps.model.geospatial
Class GsFolder

java.lang.Object
  extended by net.rim.device.api.lbs.maps.model.AbstractMappable
      extended by net.rim.device.api.lbs.maps.model.geospatial.GsFolder
All Implemented Interfaces:
Boxable, GsElement, Mappable, Persistable
Direct Known Subclasses:
GsRoot

public class GsFolder
extends AbstractMappable
implements GsElement, Persistable

Represents a folder that contains 0 or more GsElement elements.

Since:
BlackBerry API 7.0.0

Constructor Summary
GsFolder()
          Constructs a new instance of GsFolder.
GsFolder(String name, String description)
          Constructs an empty GsFolder with the given name and description.
GsFolder(String name, String description, GsElement[] elements)
          Constructs a GsFolder with the given name and description containing the given elements.
 
Method Summary
 void addElement(GsElement obj)
          Adds the given element to this folder.
 void addElements(GsElement[] elements)
          Adds the given elements to this folder.
 GsElementEnumeration elements()
          Retrieves an enumeration of the elements contained in this folder.
 boolean equals(Object obj)
          Indicates whether some other object is "equal to" this one.
 boolean equalsHierarchically(GsElement obj)
          Determines equality of this element and another element based on the element's attributes and parent.
 boolean equalsNode(GsElement obj)
          Determines equality of this element and another element based on the element's attributes, but not the element's parents.
 LatLonRectangle getBoundingBox()
          Retrieves the latitude and longitude-based bounding box of this mappable item.
 String getDescription()
          Retrieves the description of this element.
 GsElement getElementAt(int index)
          Retrieves the element at the given index.
 String getName()
          Retrieves the name of this element.
 GsFolder getParent()
          Retrieves the parent folder of this element.
 int hashCode()
          Returns a hash code value for the object.
 void insertElementAt(GsElement obj, int index)
          Inserts the given element into the folder at the given index.
 boolean isClusterable()
          Determines if the mappable object can be grouped with other clusterable points of interest.
 void removeAllElements()
          Removes all elements from the folder.
 boolean removeElement(GsElement obj)
          Removes the given element from this folder.
 void removeElementAt(int index)
          Removes the element at the given index from this folder.
 void setDescription(String description)
          Sets the description of this folder.
 void setElementAt(GsElement obj, int index)
          Replaces the element at the given index with the supplied element.
 void setName(String name)
          Sets the name of this folder.
 void setParent(GsFolder parent)
          Sets the parent folder of this element.
 int size()
          Retrieves the number of elements this folder contains.
 
Methods inherited from class net.rim.device.api.lbs.maps.model.AbstractMappable
getCommandsByType, getStyleId, match, setStyleId
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface net.rim.device.api.lbs.maps.model.Mappable
getStyleId
 



Constructor Detail

GsFolder

public GsFolder()
Constructs a new instance of GsFolder.

Since:
BlackBerry API 7.0.0

GsFolder

public GsFolder(String name,
                String description)
Constructs an empty GsFolder with the given name and description.

Parameters:
name - The name of the folder.
description - The description of the folder.
Since:
BlackBerry API 7.0.0

GsFolder

public GsFolder(String name,
                String description,
                GsElement[] elements)
Constructs a GsFolder with the given name and description containing the given elements.

Parameters:
name - The name of the folder.
description - The description of the folder.
elements - The elements to put in this folder.
Since:
BlackBerry API 7.0.0


Method Detail

getName

public String getName()
Description copied from interface: GsElement
Retrieves the name of this element.

Specified by:
getName in interface GsElement
Returns:
The name of the element.
Since:
BlackBerry API 7.0.0

setName

public void setName(String name)
Sets the name of this folder.

Parameters:
name - the name
Since:
BlackBerry API 7.0.0

getDescription

public String getDescription()
Description copied from interface: GsElement
Retrieves the description of this element.

Specified by:
getDescription in interface GsElement
Returns:
The description of this element.
Since:
BlackBerry API 7.0.0

setDescription

public void setDescription(String description)
Sets the description of this folder.

Parameters:
description - the description
Since:
BlackBerry API 7.0.0

getParent

public GsFolder getParent()
Description copied from interface: GsElement
Retrieves the parent folder of this element.

Specified by:
getParent in interface GsElement
Returns:
The parent folder of this element.
Since:
BlackBerry API 7.0.0

setParent

public void setParent(GsFolder parent)
Description copied from interface: GsElement
Sets the parent folder of this element.

Specified by:
setParent in interface GsElement
Parameters:
parent - The parent folder of this element.
Since:
BlackBerry API 7.0.0

addElement

public void addElement(GsElement obj)
Adds the given element to this folder. If the element already has a parent, the element will be removed from that parent.

Parameters:
obj - The element to add.
Since:
BlackBerry API 7.0.0

addElements

public void addElements(GsElement[] elements)
Adds the given elements to this folder.

Parameters:
elements - The elements to add to this folder.
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.
Since:
BlackBerry API 7.0.0

isClusterable

public boolean isClusterable()
Description copied from interface: Mappable
Determines if the mappable object can be grouped with other clusterable points of interest.

Specified by:
isClusterable in interface Mappable
Overrides:
isClusterable in class AbstractMappable
Returns:
true if the mappable object is clusterable, false otherwise.
Since:
BlackBerry API 7.0.0

insertElementAt

public void insertElementAt(GsElement obj,
                            int index)
Inserts the given element into the folder at the given index. If the element already has a parent, the element will be removed from that parent.

Parameters:
obj - The element to add.
index - The index to add the element at.
Throws:
ArrayIndexOutOfBoundsException - if the index is invalid.
Since:
BlackBerry API 7.0.0

removeAllElements

public void removeAllElements()
Removes all elements from the folder.

Since:
BlackBerry API 7.0.0

removeElement

public boolean removeElement(GsElement obj)
Removes the given element from this folder.

Parameters:
obj - The element to remove.
Returns:
true if the element was removed from the folder, false otherwise.
Since:
BlackBerry API 7.0.0

removeElementAt

public void removeElementAt(int index)
Removes the element at the given index from this folder.

Parameters:
index - The index of the element to remove.
Throws:
ArrayIndexOutOfBoundsException - if the index is invalid.
Since:
BlackBerry API 7.0.0

setElementAt

public void setElementAt(GsElement obj,
                         int index)
Replaces the element at the given index with the supplied element. If the element already has a parent, the element will be removed from that parent.

Parameters:
obj - The new element.
index - The index of the element to replace.
Throws:
ArrayIndexOutOfBoundsException - if the index is invalid.
Since:
BlackBerry API 7.0.0

getElementAt

public GsElement getElementAt(int index)
Retrieves the element at the given index.

Parameters:
index - The index of the element to retrieve.
Returns:
The element at the given index.
Since:
BlackBerry API 7.0.0

size

public int size()
Retrieves the number of elements this folder contains.

Returns:
The number of elements this folder contains.
Since:
BlackBerry API 7.0.0

elements

public GsElementEnumeration elements()
Retrieves an enumeration of the elements contained in this folder.

Returns:
An enumeration of the elements.
Since:
BlackBerry API 7.0.0

hashCode

public int hashCode()
Description copied from class: Object
Returns a hash code value for the object. This method is supported for the benefit of hashtables such as those provided by java.util.Hashtable.

The general contract of hashCode is:

As much as is reasonably practical, the hashCode method defined by class Object does return distinct integers for distinct objects. (This is typically implemented by converting the internal address of the object into an integer, but this implementation technique is not required by the JavaTM programming language.)

Overrides:
hashCode in class AbstractMappable
Returns:
a hash code value for this object.
See Also:
Object.equals(java.lang.Object), Hashtable
Since:
BlackBerry API 7.0.0

equalsNode

public boolean equalsNode(GsElement obj)
Description copied from interface: GsElement
Determines equality of this element and another element based on the element's attributes, but not the element's parents.

Specified by:
equalsNode in interface GsElement
Parameters:
obj - The GsElement to compare to.
Returns:
true if the elements are equal, false otherwise.
Since:
BlackBerry API 7.0.0

equalsHierarchically

public boolean equalsHierarchically(GsElement obj)
Description copied from interface: GsElement
Determines equality of this element and another element based on the element's attributes and parent.

Specified by:
equalsHierarchically in interface GsElement
Parameters:
obj - The GsElement to compare to.
Returns:
true if the elements are equal and have the same parent, false otherwise.
Since:
BlackBerry API 7.0.0

equals

public boolean equals(Object obj)
Description copied from class: Object
Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation:

The equals method for class Object implements the most discriminating possible equivalence relation on objects; that is, for any reference values x and y, this method returns true if and only if x and y refer to the same object (x==y has the value true).

Overrides:
equals in class AbstractMappable
Parameters:
obj - the reference object with which to compare.
Returns:
true if this object is the same as the obj argument; false otherwise.
See Also:
Boolean.hashCode(), Hashtable
Since:
BlackBerry API 7.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