gov.noaa.pmel.util
Class GeoDateArray

java.lang.Object
  extended by gov.noaa.pmel.util.GeoDateArray
All Implemented Interfaces:
java.io.Serializable

public class GeoDateArray
extends java.lang.Object
implements java.io.Serializable

GeoDateArray creates an efficient storage of GeoDate objects. This is accomplished by using an internal storage of long for the number of milliseconds since January 1, 1970, 00:00:00 GMT.

Since:
sgt 3.0
Version:
$Revision$, $Date$
Author:
Donald Denbo
See Also:
Serialized Form

Constructor Summary
GeoDateArray(java.util.Date[] dates)
          Construct a new GeoDateArray from an array of Dates.
GeoDateArray(GeoDate[] dates)
          Construct a new GeoDateArray from an array of GeoDates.
GeoDateArray(long[] dates)
          Construct a new GeoDateArray from an array of longs that represent the number of milliseconds since January 1, 1970, 00:00:00 GMT.
 
Method Summary
 void addOffset(int index, long offset)
          Add offset to single date.
 void addOffset(long offset)
          Add offset to all dates.
 GeoDate[] getGeoDate()
           
 GeoDate getGeoDate(int index)
           
 int getLength()
          Get length of array.
 double[] getOffset(GeoDate ref)
          Time offset for reference GeoDate.
 double getOffset(int index, GeoDate ref)
          Time offset for reference GeoDate.
 long[] getOffsetTime(GeoDate ref)
          Time offset for reference GeoDate.
 long getOffsetTime(int index, GeoDate ref)
          Time offset for reference GeoDate.
 long[] getTime()
           
 long getTime(int index)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GeoDateArray

public GeoDateArray(GeoDate[] dates)
Construct a new GeoDateArray from an array of GeoDates.

Parameters:
dates - an array of GeoDates.

GeoDateArray

public GeoDateArray(java.util.Date[] dates)
Construct a new GeoDateArray from an array of Dates.

Parameters:
dates - an array of Dates.

GeoDateArray

public GeoDateArray(long[] dates)
Construct a new GeoDateArray from an array of longs that represent the number of milliseconds since January 1, 1970, 00:00:00 GMT. Missing value for date is Long.MAX_VALUE.

Parameters:
dates - an array of longs.
Method Detail

getTime

public long[] getTime()

getTime

public long getTime(int index)

getGeoDate

public GeoDate getGeoDate(int index)

getGeoDate

public GeoDate[] getGeoDate()

getOffset

public double getOffset(int index,
                        GeoDate ref)
Time offset for reference GeoDate.

Parameters:
ref - reference GeoDate
Returns:
offset in days

getOffset

public double[] getOffset(GeoDate ref)
Time offset for reference GeoDate.

Parameters:
ref - reference GeoDate
Returns:
offset in days

getOffsetTime

public long getOffsetTime(int index,
                          GeoDate ref)
Time offset for reference GeoDate.

Parameters:
ref - reference GeoDate
Returns:
offset in milliseconds

getOffsetTime

public long[] getOffsetTime(GeoDate ref)
Time offset for reference GeoDate.

Parameters:
ref - reference GeoDate
Returns:
offset in milliseconds

addOffset

public void addOffset(long offset)
Add offset to all dates.


addOffset

public void addOffset(int index,
                      long offset)
Add offset to single date.


getLength

public int getLength()
Get length of array.