Opened 14 years ago

Closed 14 years ago

#44 closed task (fixed)

create XY_DatasetAPI parent of DiscretizedFuncAPI that accepts scatter data

Reported by: Kevin Milner Owned by: Kevin Milner
Priority: major Milestone:
Component: commons Version:
Keywords: Cc: ned, Peter Powers


E-mail from Ned, 09/02/2010:


I couldn't resist looking into this a bit.

The jfreechart wrapper class we use is:


which takes a DiscretizedFuncList? (a list of DiscretizedFuncAPIs).

The methods DiscretizedFunctionXYDataSet actually uses from DiscretizedFuncAPIs are:

getDelta() (but with an if(obj instanceof EvenlyDiscretizedFunc?), so this should be OK; this is for histogram plotting)

One thing DiscretizedFunctionXYDataSet assumes is that getX(0) is minimum value, but this can easily be swapped with getMinX().

I propose we define and XY_DatasetAPI that is a parent to DiscretizedFuncAPI. This would include all the current DiscretizedFuncAPI methods listed in blue below, but not those listed in red (as the latter ordering and non-duplicates on the x axis).

Then we just need to change DiscretizedFunctionXYDataSet to take an XY_DatatsetList (which we'd have to define) rather than the DiscretizedFuncList?.

We also need to change its getX(0) call to getMinX() as mentioned above.

There are also all the classes used between org.opensha.sha.gui.infoTools.GraphiWindowAPI_Impl (the useful tool I mentioned below) and DiscretizedFunctionXYDataSet that would need to be changed (but I think just swapping DiscretizedFuncList? with XY_DatatsetList would do it.

Of course I might be missing something here, so please check my math.




public void setTolerance(double newTolerance);
public double getTolerance();
public double getY(double x);
public double getFirstInterpolatedX(double y);
public double getInterpolatedY(double x);
public int getXIndex(double x);
public int getIndex(DataPoint2D point);
public double getInterpolatedY_inLogXLogYDomain(double x);
public double getInterpolatedY_inLogYDomain(double x);
public double getFirstInterpolatedX_inLogXLogYDomain(double y);
public double getClosestY(double x);
public double getClosestX(double y);

(to be included in XY_DatasetAPI)

public void setName( String name );
public String getName();
public void setInfo( String info );
public String getInfo();
public int getNum();
public double getMinX();
public double getMaxX();
public double getMinY();
public double getMaxY();
public DataPoint2D get(int index);
public double getX(int index);
public double getY(int index);
public void set(DataPoint2D point) throws DataPoint2DException;
public void set(double x, double y) throws DataPoint2DException;
public void set(int index, double Y);
public boolean hasPoint(DataPoint2D point);
public boolean hasPoint(double x, double y);
public Iterator<DataPoint2D> getPointsIterator();
public ListIterator?<Double> getXValuesIterator();
public ListIterator?<Double> getYValuesIterator();
public String toString();
public boolean equals( DiscretizedFuncAPI function );
public DiscretizedFuncAPI deepClone();
public String getMetadataString();
public boolean areAllXValuesInteger(double tolerance);

Change History (2)

comment:1 Changed 14 years ago by Kevin Milner

Status: newassigned

comment:2 Changed 14 years ago by Kevin Milner

Resolution: fixed
Status: assignedclosed

Completed with [7026]. New class which accepts scatter data:


Note: See TracTickets for help on using tickets.