ucar.unidata.metdata
Class StationTableImpl

java.lang.Object
  extended by ucar.unidata.metdata.StationTableImpl
All Implemented Interfaces:
StationTable
Direct Known Subclasses:
NamedStationTable

public class StationTableImpl
extends Object
implements StationTable

Table of reporting stations.

Version:
$Revision: 1.11 $ $Date: 2006/08/18 21:31:58 $
Author:
$Author: jeffmc $

Field Summary
protected  Map byId_
          Map of stations
protected  List stations
           
 
Constructor Summary
StationTableImpl()
          Create a new StationTableImpl
 
Method Summary
 boolean add(Station stn)
          Add a station to the table
 boolean add(Station stn, boolean onlyIfNotInMap)
          Add a station to the table
 Station get(String identifier)
          Lookup Station by Identifier
protected  Map getMap()
          Have this method here so derived classes know when anything was requested of this station table.
 Set keySet()
          Returns the set of identifiers
 Station remove(Station stn)
          Remove a station from the table
 Station remove(String id)
          Remove a station from the table by it's id
 int size()
          Returns the number of stations in this table
 Collection values()
          Returns a collection view of the Station values contained in this table.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

stations

protected List stations

byId_

protected final Map byId_
Map of stations

Constructor Detail

StationTableImpl

public StationTableImpl()
Create a new StationTableImpl

Method Detail

getMap

protected Map getMap()
Have this method here so derived classes know when anything was requested of this station table. This allows them to lazily create the stations, etc.

Returns:
station map

add

public boolean add(Station stn)
Add a station to the table

Parameters:
stn - station to add
Returns:
true if the station was not already in the table

add

public boolean add(Station stn,
                   boolean onlyIfNotInMap)
Add a station to the table

Parameters:
stn - station to add
onlyIfNotInMap -
Returns:
true if the station was not already in the table

remove

public Station remove(Station stn)
Remove a station from the table

Parameters:
stn - station to remove
Returns:
the station being removed or null if it is not in the table

remove

public Station remove(String id)
Remove a station from the table by it's id

Parameters:
id - station identifier
Returns:
station mapped to the id, or null if none

get

public Station get(String identifier)
Lookup Station by Identifier

Specified by:
get in interface StationTable
Parameters:
identifier - the station identifier
Returns:
the station in the table

keySet

public Set keySet()
Returns the set of identifiers

Specified by:
keySet in interface StationTable
Returns:
Set of identifiers

size

public int size()
Returns the number of stations in this table

Specified by:
size in interface StationTable
Returns:
number of stations in the table

values

public Collection values()
Returns a collection view of the Station values contained in this table.

Specified by:
values in interface StationTable
Returns:
the collection of stations