Package hec.hecmath

Class HecMath

java.lang.Object
hec.hecmath.HecMath
All Implemented Interfaces:
Constants
Direct Known Subclasses:
PairedDataMath, TextMath, TimeSeriesMath

public abstract class HecMath extends Object implements Constants
The HecMath class together with the TimeSeriesMath and PairedDataMath subclasses provide the user with a method to manipulate an entire time series or paired data set with simple function calls. For example, each value in a time series may be scaled by the value 3.0 using:

ts.multiply( 3.0 )     where ts is a TimeSeriesMath object

The HecMath class provides the math functions in an abstract form. The actual function operations are overriden and performed in the TimeSeriesMath and PairedDataMath subclasses.

TimeSeriesMath and PairedDataMath essentially wrap around the hec.io.TimeSeriesContainer (time series data) and hec.io.PairedDataContainer (paired data) classes and have no data of their own. The TimeSeriesMath class provides the user a way of manipulating time series data. Similarly, PairedDataMath class provides the user with functions to manipulate paired data.

The static method HecMath.createInstance( DataContainer dc ) can be used to create the HecMath subclass appropriate to the data type. That is if dc is of type TimeSeriesContainer, a TimeSeriesMath object will be created containing the TimeSeriesContainer. Conversly, if dc is of type PairedDataContainer, a PairedDataMath object will be created.

The HecMath class provides several concrete methods which modify the data in the DataContainer, and are thus common to both TimeSeriesContainer and PairedDataContainer. These primarily concern the record path name and the file name associated with the time series or paired data.

If errors in the processing and computation of the math functions occur, such as the attempted operation on an empty data set or the use of invalid parameter values, an HecMathException will be thrown by the function and must be caught by the caller. Runtime errors ( java.lang.RuntimeException ) are caught in HecMath, TimeSeriesMath and PairedDataMath and converted to an HecMathException.

See Also: