|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectwinterwell.jgeoplanet.GeoPlanetResource
winterwell.jgeoplanet.PlaceCollection
public class PlaceCollection
A collection of Place
objects.
A PlaceCollection
represents a potential collection of places
rather than the collection of places themselves.
Use get()
and friends to get hold of the actual Places involved.
PlaceCollection returns Places in long form by default. Use shortForm(boolean)
to change this behaviour.
Method Summary | |
---|---|
java.util.List<Place> |
get()
Get all places in this collection. |
Place |
get(int index)
Get a specific place from this collection. |
java.util.List<Place> |
get(int start,
int count)
Get a list of (some of) the places contained in this collection. |
PlaceType |
getType()
If this collection is filtered by place type, return that type otherwise return null. |
boolean |
isShortForm()
|
PlaceCollection |
shortForm(boolean useShortForm)
Return short form places from this query. |
int |
size()
Returns the total number of places in this collection if a get() has occurred, or -1 to indicate that no get has occurred. |
PlaceCollection |
type(PlaceType type)
Set the type filter. |
PlaceCollection |
type(java.lang.String placeTypeName)
Convenience wrapper for type(PlaceType) . |
Methods inherited from class winterwell.jgeoplanet.GeoPlanetResource |
---|
getClient |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public PlaceCollection type(PlaceType type)
May be null to unset the type. Example usage:
Place earth = g.getPlace(1); PlaceType country = g.getPlaceType("Country"); Listcountries = earth.getChildren().type(country).get();
type
- The place type to filter on. May be null to unset the type.
public PlaceCollection type(java.lang.String placeTypeName) throws InvalidPlaceType
type(PlaceType)
.
Valid place types names include "County", "Region", "Town" and "Ward"
placeTypeName
- the name of a place type. Must be valid.
InvalidPlaceType
- if the place type is invalidtype(PlaceType)
public PlaceType getType()
public PlaceCollection shortForm(boolean useShortForm)
useShortForm
- isShortForm()
public boolean isShortForm()
public int size()
public java.util.List<Place> get(int start, int count) throws GeoPlanetException
start
- The first result to get indexed from 0count
- The maximum number of results to return. Zero (0) returns all results.
GeoPlanetException
- for general errorspublic java.util.List<Place> get() throws GeoPlanetException
get(0,0)
.
Requires network access.
GeoPlanetException
- for general errorspublic Place get(int index) throws GeoPlanetException
get(index, 1).get(0)
Not usually used with index != 0. Requires network access.
GeoPlanetException
- for general errors
java.lang.ArrayIndexOutOfBoundsException
- for invalid indices
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |