Package gov.usgs.earthquake.nshmp.geo
Class LocationList.Builder
java.lang.Object
gov.usgs.earthquake.nshmp.geo.LocationList.Builder
- Enclosing interface:
LocationList
A reusable
LocationList builder. Repeat calls to build()
will return multiple lists in series with each new list containing all the
elements of the one before it. Builder does not permit the addition of
null elements, however, null checking is lazy and not performed
until build() is called.
Use LocationList.builder() to create new builder instances.
-
Method Summary
Modifier and TypeMethodDescriptionadd(double longitude, double latitude) Add a location with the specified longitude and latitude, and a depth of 0 km.add(double longitude, double latitude, double depth) Add a location with the specified longitude, latitude, and depth.Add a location.Add each of the supplied locations.addAll(Collection<Location> locations) Add each of the supplied locations.build()Return a newly createdLocationListbased on the contents of theBuilder.
-
Method Details
-
add
Add a location.- Parameters:
location- to add- Returns:
- this
Builder
-
add
Add a location with the specified longitude and latitude, and a depth of 0 km.- Parameters:
longitude- in decimal degreeslatitude- in decimal degrees- Returns:
- this
Builder - Throws:
IllegalArgumentException- if any values are out of range- See Also:
-
add
Add a location with the specified longitude, latitude, and depth.- Parameters:
longitude- in decimal degreeslatitude- in decimal degreesdepth- in km (positive down)- Returns:
- this
Builder - Throws:
IllegalArgumentException- if any values are out of range- See Also:
-
add
Add each of the supplied locations.- Parameters:
locations- to add- Returns:
- this
Builder
-
addAll
Add each of the supplied locations.- Parameters:
locations- to add- Returns:
- this
Builder
-
build
Return a newly createdLocationListbased on the contents of theBuilder.- Returns:
- a new
LocationList - Throws:
IllegalStateException- if the list is emptyNullPointerException- if the list containsnullelements
-