com.oopitis.weather
Class WeatherPropertySet

java.lang.Object
  extended by com.oopitis.weather.WeatherPropertySet
All Implemented Interfaces:
Queryable

public class WeatherPropertySet
extends java.lang.Object
implements Queryable

A set of weather properties. An object of this class can be used in a query to specify multiple weather properties of interest, or in a report to fetch all properties in the set at once. A weather property set must have at least one element. This class is backed by a java.util.LinkedHashSet. That means the order of the properties in the list returned by asList is the same as the order in which those properties are added by a constructor.

See Also:
WeatherService.query(GeoLocation, Queryable, Queryable[]), WeatherService.query(GeoLocation, Queryable, Feature, Feature[]), QueryHint.include(Queryable[]), WeatherReport.get(WeatherPropertySet)

Constructor Summary
WeatherPropertySet(java.util.Collection<WeatherProperty> c)
          Creates a weather property set from a collection of properties.
WeatherPropertySet(WeatherPropertySet base, WeatherProperty property, WeatherProperty... properties)
          Creates a weather property set based on another set.
WeatherPropertySet(WeatherProperty property, WeatherProperty... properties)
          Creates a weather property set with a list of properties.
 
Method Summary
 java.util.List<WeatherProperty> asList()
          Returns this property set as a list.
 boolean contains(WeatherProperty p)
          Returns true if this property set contains the specified property.
 WeatherProperty[] getQueryableProperties()
          Returns all properties in this set as queryable.
 int size()
          Returns the number of properties in this property set.
 java.lang.String toString()
          Returns a string representation of this property set.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

WeatherPropertySet

public WeatherPropertySet(WeatherProperty property,
                          WeatherProperty... properties)
Creates a weather property set with a list of properties.

Parameters:
property - the first property
properties - the rest of the properties
Throws:
java.lang.IllegalArgumentException - if all properties in the list are null

WeatherPropertySet

public WeatherPropertySet(java.util.Collection<WeatherProperty> c)
Creates a weather property set from a collection of properties.

Parameters:
c - the collection of properties
Throws:
java.lang.NullPointerException - if the given collection is null
java.lang.IllegalArgumentException - if all elements in the collection are null

WeatherPropertySet

public WeatherPropertySet(WeatherPropertySet base,
                          WeatherProperty property,
                          WeatherProperty... properties)
Creates a weather property set based on another set.

Parameters:
base - the basic set
property - the first additional property
properties - other additional properties
Throws:
java.lang.NullPointerException - if the base set or the first additional property is null
Method Detail

asList

public java.util.List<WeatherProperty> asList()
Returns this property set as a list.

Returns:
this property set as an unmodifiable list

contains

public boolean contains(WeatherProperty p)
Returns true if this property set contains the specified property.

Parameters:
p - the property whose presence in this set is to be tested
Returns:
true if this property set contains the specified property

size

public int size()
Returns the number of properties in this property set.

Returns:
the number of properties in this property set

getQueryableProperties

public final WeatherProperty[] getQueryableProperties()
Returns all properties in this set as queryable.

Specified by:
getQueryableProperties in interface Queryable
Returns:
all properties in this set

toString

public java.lang.String toString()
Returns a string representation of this property set. All calls are delegated to toString() of java.util.LinkedHashSet.

Overrides:
toString in class java.lang.Object
Returns:
the string representation of this property set
See Also:
AbstractCollection.toString()