public void allocateSpace(double xOrdinates[], int numberCurves)

public void setXOrdinates(double xOrdinates[])

public void setYOrdinates(double yOrdinates[][])

public void setStartingEndingCurve(int startingCurve, int endingCurve)
public void setStartingEndingOrdinage(int startingOrdinate, int endingOrdinate)
public int getStartingCurve()
public int getEndingCurve()
public int getStartingOrdinate()
public int getEndingOrdinate()
JAVA

Example: Paired Data Rating table

//This example stores and retrieves a simple rating table, then displays in in a data table.
import javax.swing.UIManager;
import hec.dataTable.HecDataTableFrame;
import hec.heclib.dss.*;
import hec.io.PairedDataContainer;


//  A simple sample of code to demonstrate storing and retrieving 
//  paired data for a rating table
//
public class ExamplePairedData1 {

	public static void main (String args[])  {

		try {
			javax.swing.UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
		}
		catch (Exception ignore) {}
		
		//  Gen up the data
		//  double xOrdinates[int numberOrdinates]		
		double xOrdinates[] = new double[200];
		//  double yOrdinates[int numberCurves][int numberOrdinates]
		double yOrdinates[][] = new double[1][200];
		//  Gen up data to store
		for (int i=0; i<200; i++) {
			xOrdinates[i] = (double)(i + 1);
			yOrdinates[0][i] = (double)(i + 1) * 100.0;
		}
		PairedDataContainer pdc1 = new PairedDataContainer();	
		pdc1.setName("/Basin/Location/Stage-Flow/Rating Table/Java Sample//");
		pdc1.setValues(xOrdinates, yOrdinates);
		pdc1.setXUnits("Feet");
		pdc1.setXType("Linear");
		pdc1.setYUnits("CFS");
		pdc1.setYType("Linear");
		
		HecPairedData dssPairedData1 = new HecPairedData();
		dssPairedData1.setDSSFileName("C:/temp/Example7.dss");
		//  We could have set with setDefaultDSSFileName for the entire example
		int status = dssPairedData1.write(pdc1);
		dssPairedData1.done();		
		if (status != 0) return;
				
		//  Read the data
		PairedDataContainer pdc2 = new PairedDataContainer();	
		pdc2.setName("/Basin/Location/Stage-Flow/Rating Table/Java Sample//");
		HecPairedData dssPairedData2 = new HecPairedData();
		dssPairedData2.setDSSFileName("C:/temp/Example7.dss");
		status = dssPairedData2.read(pdc2);		
		dssPairedData2.done();		
		if (status != 0) return;
		
	//  Show in a table
		HecDataTableFrame table = new HecDataTableFrame(null);
		table.setData(pdc2);
		table.setVisible(true);

		HecDataManager.closeAllFiles();  //  Only at the end of the program
	}
}
 

JAVA




Example: Paired Data Frequency Curve

//  This example stores and retrieves a flow-frequency curve. 
// Since the flow-frequency data set contains several curves, each curve is given a label to identify it.  
// After the data has been stored, it is read and displayed in a plot.
import java.util.Vector;
import javax.swing.UIManager;
import hec.gfx2d.G2dDialog;
import hec.heclib.dss.*;
import hec.io.DataContainer;
import hec.io.PairedDataContainer;


//  A simple sample of code to demonstrate storing and retrieving a flow-frequency curve set
//
public class ExamplePairedData2 {

	public static void main (String args[])  {

		try {
			javax.swing.UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
		}
		catch (Exception ignore) {}
		
		double xOrdinates[] = new double[20];
		//  numberOrdinates = 20;
		double yOrdinates[][] = new double[4][20];
		//  numberCurves = 4;
		//  Gen up data to store
		for (int i=0; i<xOrdinates.length; i++) {
			xOrdinates[i] = (double)(i + 1) / (double)(xOrdinates.length + 1);
		}
		for (int i=0; i<4; i++) {
			for (int j=0; j<xOrdinates.length; j++) {
				yOrdinates[i][j] = (double)(i + 1) * 10.0 + (double)(j * 5);
			}
		}		

		PairedDataContainer pdc1 = new PairedDataContainer();	
		pdc1.setName("/Basin/Location/Freqency-Flow/Java Sample///");
		pdc1.setValues(xOrdinates, yOrdinates);
		pdc1.setXUnits("Percent");
		pdc1.setXType("Freqency");
		pdc1.setYUnits("CFS");
		pdc1.setYType("Linear");
		
		String labels[] = new String[4];
		labels[0] = "Plan A"; 
		labels[1] = "Plan B"; 
		labels[2] = "Plan C"; 
		labels[3] = "No Changes"; 
		pdc1.setLabels(labels);
		
		HecPairedData dssPairedData1 = new HecPairedData();
		dssPairedData1.setDSSFileName("C:/temp/Example7.dss");
		int status = dssPairedData1.write(pdc1);
		dssPairedData1.done();		
		if (status != 0) return;
		
		//  Read the data
		PairedDataContainer pdc2 = new PairedDataContainer();	
		pdc2.setName("/Basin/Location/Freqency-Flow/Java Sample///");
		HecPairedData dssPairedData2 = new HecPairedData();
		dssPairedData2.setDSSFileName("C:/temp/Example7.dss");
		status = dssPairedData2.read(pdc2);
		dssPairedData2.done();		
		if (status != 0) return;
		//  Show in a plot
		Vector<DataContainer> v = new Vector<DataContainer>();
		v.add(pdc2);
		hec.gfx2d.G2dDialog plot =  new G2dDialog(null, "My Plot", false, v);
		plot.setVisible(true);

		HecDataManager.closeAllFiles();  //  Only at the end of the program
	}
}

JAVA