/*
* 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 last high and low tide*/
private float[] startingHeight;
/*Stores the heights of the current high or low tide*/
private float[] endingHeight;
/*How many highs and lows are stored by the parameter*/
private int size;
/*stores how far in the past the last high or low before this year occured*/
private float offset;
/*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];
startingHeight = new float[size];
endingHeight = new float[size];
offset = 0;
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 startingHeight at location index
* to value
.
*
* @param index the index of the startingHeight we are changing/setting.
* @param value the value we are setting the startingHeight to.
*/
public void setStartingHeight(int index, float value)
{
startingHeight[index] = value;
}
/**
* sets the endingHieght at location index
to value
*
* @param index the index of the endingHeight we are changing/setting.
* @param value the value we are setting the endingHeight to.
*/
public void setEndingHeight(int index, float value)
{
endingHeight[index] = value;
}
/**
* sets the offset to value
*
* @param value the value we are setting the offset to.
*/
public void setOffset(float value)
{
offset = 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 getStartingHeight(int index)
{
return startingHeight[index];
}
/**
* Returns the xDistance at index
*
* @return the xDistance at index
*/
public float getEndingHeight(int index)
{
return endingHeight[index];
}
/**
* Returns the xDistance at index
*
* @return the xDistance at index
*/
public float getOffset()
{
return offset;
}
/**
* 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 = "