/*
* Parameter.java
* used to store the TideLines used in the Tide Calendar Class
*/
//package TideCalendar;
/**
* The purpose of the Parameter Class is to store all data associated
* with the Tide Lines used in the Tide Calendar.
*
* @author Tim Bollman
* @author Earthguide
* @version 1.0 04-04-05
*/
import java.text.*;
public class Parameter
{
/*Stores the distances (in hours) between the high and low tides*/
private float[] xDistance;
/*Stores the heights of the current high or low tide*/
private float[] height;
/*How many highs and lows are stored by the parameter*/
private int size;
/*How many hours the list of highs and lows spans*/
private float totalDistance;
/*What the TideLine associated with these highs and lows is*/
private TideLine myLine;
/**
* Creates a Parameter of size 0.
*/
public Parameter()
{
this(0);
}
/**
* Creates a Parameter of size size
*
* @param size the amount of data points that will be stored.
*/
public Parameter(int size)
{
this.size = size;
xDistance = new float[size];
height = new float[size];
totalDistance = 0;
myLine = null;
}
/**
* returns the total amount of hours spaned by the TideLine associated with
* this Parameter.
*
* @return the totalDistance of this Parameter
*/
public String toString()
{
String retVal = Float.toString(totalDistance);
return retVal;
}
/**
* sets the xDistance at location index
to value
.
*
* @param index the index of the xDistance we are changing/setting.
* @param value the value we are setting the xDistance to.
*/
public void setXDistance(int index, float value)
{
xDistance[index] = value;
}
/**
* sets the endingHieght at location index
to value
*
* @param index the index of the height we are changing/setting.
* @param value the value we are setting the height to.
*/
public void setHeight(int index, float value)
{
height[index] = value;
}
/**
* sets the totalDistance to value
*
* @param value the value we are setting the totalDistance to.
*/
public void setTotalDistance(float value)
{
totalDistance = value;
}
/**
* Sets the TideLine
associated with this parameter to
* line
*
* @param line the line we are associating with this Parameter.
*/
public void setLine(TideLine line)
{
myLine = line;
}
/**
* Returns the xDistance at index
*
* @return the xDistance at index
*/
public float getXDistance(int index)
{
return xDistance[index];
}
/**
* Returns the xDistance at index
*
* @return the xDistance at index
*/
public float getHeight(int index)
{
return height[index];
}
/**
* Returns the xDistance at index
*
* @return the xDistance at index
*/
public float getTotalDistance()
{
return totalDistance;
}
/**
* Returns the xDistance at index
*
* @return the xDistance at index
*/
public int getSize()
{
return size;
}
/**
* Returns the xDistance at index
*
* @return the xDistance at index
*/
public TideLine getLine()
{
return myLine;
}
public void changePixel(float oldFactor, float newFactor)
{return;}
/**
* Returns the xDistance at index
*
* @return the xDistance at index
*/
public String getExtremas(int month, int days)
{
DecimalFormat numberFormat = new DecimalFormat("#0.0");
String retVal = "