|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.gicentre.treemappa.LocationList
public class LocationList
Stores a list of objects each be associated with a location. Allows spatial queries of the list (find closest item to (x,y)).
Constructor Summary | |
---|---|
LocationList()
Creates the collection. |
Method Summary | |
---|---|
void |
add(LocatedObject locObj)
Adds the given object to the collection. |
void |
clear()
Clears the contents of the list. |
LocatedObject |
get(int index)
Gets the object at the given position in the collection. |
LocatedObject |
getClosest(java.awt.geom.Point2D location)
Retrieves the object closest to the given location. |
void |
remove(int index)
Removes the object at the given position in the collection. |
boolean |
remove(LocatedObject locObj)
Removes the given object from the collection. |
int |
size()
Reports the number of items stored in the list. |
void |
sortByDistance(java.awt.geom.Point2D p)
Sorts the locations by distance from the given point. |
void |
sortByObject()
Sorts the locations by the descending natural order of the objects that are attached to them. |
java.lang.String |
toString()
Reports a textual representation of the list. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public LocationList()
Method Detail |
---|
public void add(LocatedObject locObj)
locObj
- New located object to add to the collection.public boolean remove(LocatedObject locObj)
locObj
- Object to remove from the collection.
public void remove(int index)
index
- Position in list at which to remove the object.public void clear()
public LocatedObject get(int index)
index
- Position in list at which to find the object.
public int size()
public void sortByObject()
public void sortByDistance(java.awt.geom.Point2D p)
p
- Point from which to measure distance.public LocatedObject getClosest(java.awt.geom.Point2D location)
location
- Location to query.
public java.lang.String toString()
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |