All Downloads are FREE. Search and download functionalities are using the official Maven repository.

JSci.awt.DefaultGraph2DModel Maven / Gradle / Ivy

Go to download

JSci is a set of open source Java packages. The aim is to encapsulate scientific methods/principles in the most natural way possible. As such they should greatly aid the development of scientific based software. It offers: abstract math interfaces, linear algebra (support for various matrix and vector types), statistics (including probability distributions), wavelets, newtonian mechanics, chart/graph components (AWT and Swing), MathML DOM implementation, ... Note: some packages, like javax.comm, for the astro and instruments package aren't listed as dependencies (not available).

The newest version!
package JSci.awt;

import java.util.ArrayList;
import java.util.List;
import javax.swing.event.TableModelEvent;
import javax.swing.event.TableModelListener;
import javax.swing.table.AbstractTableModel;

/**
* The DefaultGraph2DModel class provides a default implementation
* of the Graph2DModel interface.
* @version 1.2
* @author Mark Hale
*/
public final class DefaultGraph2DModel extends AbstractGraphModel implements Graph2DModel, TableModelListener {
        private static final int X_AXIS_COLUMN = 0;
        private static final int SERIES_COLUMN = 1;
        
        private float defaultXAxis[]=new float[0];
        private final List series=new ArrayList();
        private int pos=0;
        private DataSeries curSeries=null;

        public DefaultGraph2DModel() {}
        /**
        * Sets the default x-axis values.
        * A copy of the values is made.
        * This method does not change the x-axis values of any data series
        * and so does not fire any events.
        */
        public void setXAxis(float x[]) {
                if(defaultXAxis.length!=x.length)
                        defaultXAxis=new float[x.length];
                System.arraycopy(x,0,defaultXAxis,0,x.length);
        }
        /**
        * Sets the default x-axis values.
        * A copy of the values is made.
        * This method does not change the x-axis values of any data series
        * and so does not fire any events.
        */
        public void setXAxis(double x[]) {
                if(defaultXAxis.length!=x.length)
                        defaultXAxis=new float[x.length];
                for(int i=0;i




© 2015 - 2024 Weber Informatics LLC | Privacy Policy