ucar.nc2.ft.point
Class PointCollectionImpl

java.lang.Object
  extended by ucar.nc2.ft.point.PointCollectionImpl
All Implemented Interfaces:
FeatureCollection, PointFeatureCollection
Direct Known Subclasses:
CompositePointCollection, CompositeStationCollectionFlattened, PointCollectionImpl.PointCollectionSubset, ProfileFeatureImpl, StandardPointCollectionImpl, StationFeatureImpl, StationTimeSeriesCollectionFlattened, TrajectoryFeatureImpl

public abstract class PointCollectionImpl
extends Object
implements PointFeatureCollection

Abstract superclass for PointFeatureCollection Subclass must supply getPointFeatureIterator().

Since:
Mar 1, 2008
Author:
caron

Nested Class Summary
protected  class PointCollectionImpl.PointCollectionSubset
           
 
Field Summary
protected  LatLonRect boundingBox
           
protected  DateRange dateRange
           
protected  PointFeatureIterator localIterator
           
protected  String name
           
protected  int npts
           
 
Constructor Summary
protected PointCollectionImpl(String name)
           
protected PointCollectionImpl(String name, LatLonRect boundingBox, DateRange dateRange, int npts)
           
 
Method Summary
 void calcBounds()
          Caclulate date range and bounding box, and size, even if the data has to be scanned.
 void finish()
          Make sure that the internal iterator is complete, and recover resources.
 LatLonRect getBoundingBox()
          The boundingBox for the FeatureCollection.
 FeatureType getCollectionFeatureType()
          All features in this collection have this feature type
 DateRange getDateRange()
          Date range for the FeatureCollection.
 String getName()
          Get the name of this feature collection.
 boolean hasNext()
          Use the internal iterator to check if there is another PointFeature in the iteration.
 PointFeature next()
          Use the internal iterator to get the next PointFeature in the iteration.
 void resetIteration()
          Reset the internal iterator for another iteration over the PointFeatures in this Collection.
 void setBoundingBox(LatLonRect bb)
          Set the boundingBox for the FeatureCollection.
 void setDateRange(DateRange range)
          Set the date range for the FeatureCollection.
 void setSize(int npts)
          Set the size of the FeatureCollection.
 int size()
          The number of points in the collection.
 PointFeatureCollection subset(LatLonRect boundingBox, DateRange dateRange)
          Subset this collection by boundingBox and/or dateRange
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface ucar.nc2.ft.PointFeatureCollection
getPointFeatureIterator
 

Field Detail

name

protected String name

boundingBox

protected LatLonRect boundingBox

dateRange

protected DateRange dateRange

npts

protected int npts

localIterator

protected PointFeatureIterator localIterator
Constructor Detail

PointCollectionImpl

protected PointCollectionImpl(String name)

PointCollectionImpl

protected PointCollectionImpl(String name,
                              LatLonRect boundingBox,
                              DateRange dateRange,
                              int npts)
Method Detail

getName

public String getName()
Description copied from interface: FeatureCollection
Get the name of this feature collection.

Specified by:
getName in interface FeatureCollection
Returns:
the name of this feature collection

hasNext

public boolean hasNext()
                throws IOException
Description copied from interface: PointFeatureCollection
Use the internal iterator to check if there is another PointFeature in the iteration. Note that this is not thread-safe; use getPointFeatureIterator() for a threadsafe iterator.

Specified by:
hasNext in interface PointFeatureCollection
Returns:
true is there is another PointFeature in the iteration.
Throws:
IOException - on read error
See Also:
PointFeatureIterator.hasNext()

finish

public void finish()
Description copied from interface: PointFeatureCollection
Make sure that the internal iterator is complete, and recover resources. You must complete the iteration (until hasNext() returns false) or call finish().

Specified by:
finish in interface PointFeatureCollection
See Also:
PointFeatureIterator.finish()

next

public PointFeature next()
                  throws IOException
Description copied from interface: PointFeatureCollection
Use the internal iterator to get the next PointFeature in the iteration. You must call hasNext() before you call this.

Specified by:
next in interface PointFeatureCollection
Returns:
the next PointFeature in the iteration
Throws:
IOException - on read error
See Also:
PointFeatureIterator.next()

resetIteration

public void resetIteration()
                    throws IOException
Description copied from interface: PointFeatureCollection
Reset the internal iterator for another iteration over the PointFeatures in this Collection.

Specified by:
resetIteration in interface PointFeatureCollection
Throws:
IOException - on read error

size

public int size()
Description copied from interface: PointFeatureCollection
The number of points in the collection. May not be known until after iterating through the collection.

Specified by:
size in interface PointFeatureCollection
Returns:
number of points in the collection, or -1 if not known.

getDateRange

public DateRange getDateRange()
Description copied from interface: PointFeatureCollection
Date range for the FeatureCollection. May not be known until after iterating through the collection.

Specified by:
getDateRange in interface PointFeatureCollection
Returns:
the date range for the entire collection, or null if unknown

getBoundingBox

public LatLonRect getBoundingBox()
Description copied from interface: PointFeatureCollection
The boundingBox for the FeatureCollection. May not be known until after iterating through the collection.

Specified by:
getBoundingBox in interface PointFeatureCollection
Returns:
the lat/lon boundingBox for the entire collection, or null if unknown.

setDateRange

public void setDateRange(DateRange range)
Description copied from interface: PointFeatureCollection
Set the date range for the FeatureCollection.

Specified by:
setDateRange in interface PointFeatureCollection
Parameters:
range - the date range for the entire collection

setBoundingBox

public void setBoundingBox(LatLonRect bb)
Description copied from interface: PointFeatureCollection
Set the boundingBox for the FeatureCollection.

Specified by:
setBoundingBox in interface PointFeatureCollection
Parameters:
bb - the lat/lon boundingBox for the entire collection.

calcBounds

public void calcBounds()
                throws IOException
Description copied from interface: PointFeatureCollection
Caclulate date range and bounding box, and size, even if the data has to be scanned. This ensures that getDateRange() and getBoundingBox() return non-null. If the collection already knows its size, date range and bounding box, then this has no effect.

Specified by:
calcBounds in interface PointFeatureCollection
Throws:
IOException - or read error.

setSize

public void setSize(int npts)
Description copied from interface: PointFeatureCollection
Set the size of the FeatureCollection.

Specified by:
setSize in interface PointFeatureCollection
Parameters:
npts - size of the collection

getCollectionFeatureType

public FeatureType getCollectionFeatureType()
Description copied from interface: FeatureCollection
All features in this collection have this feature type

Specified by:
getCollectionFeatureType in interface FeatureCollection
Returns:
the feature type

subset

public PointFeatureCollection subset(LatLonRect boundingBox,
                                     DateRange dateRange)
                              throws IOException
Description copied from interface: PointFeatureCollection
Subset this collection by boundingBox and/or dateRange

Specified by:
subset in interface PointFeatureCollection
Parameters:
boundingBox - only points in this lat/lon bounding box. may be null.
dateRange - only points in this date range. may be null.
Returns:
subsetted collection, may be null if empty
Throws:
IOException - on read error


Copyright © 1999-2011 UCAR/Unidata. All Rights Reserved.