package hep.aida.ref.histogram;
import hep.aida.IDataPoint;
import hep.aida.IMeasurement;
import hep.aida.ref.event.AIDAListener;
import hep.aida.ref.event.AIDAObservable;
import hep.aida.ref.event.IsObservable;
import java.io.Serializable;
/**
* Basic user-level interface class for holding and managing
* a single set of "measurements".
*
* @author The AIDA team
*
*/
public class DataPoint extends AIDAObservable implements IDataPoint, IsObservable, Serializable, AIDAListener {
private int dimension;
private IMeasurement[] measurements;
// Constructors
public DataPoint(int dim) {
super();
setIsValidAfterNotify(true);
dimension = dim;
measurements = new Measurement[dim];
for (int i=0; i= dimension() or if the set is empty.
*
*/
public double lowerExtent(int coord) throws IllegalArgumentException {
double le = measurements[coord].value();
if ( ! Double.isNaN( measurements[coord].errorMinus() ) )
le -= measurements[coord].errorMinus();
return le;
}
/**
* Get the upper value for a give axis.
* This method is not in the IDataPoint interface and is here for efficiency reasons
* @param coord The coordinate of the axis.
* @return The upper edge of the corresponding axis.
* @throws IllegalArgumentException if coord < 0 or coord >= dimension() or if the set is empty.
*
*/
public double upperExtent(int coord) throws IllegalArgumentException {
double ue = measurements[coord].value();
if ( ! Double.isNaN( measurements[coord].errorPlus() ) )
ue += measurements[coord].errorPlus();
return ue;
}
// AIDAListener methods
public void stateChanged(java.util.EventObject e) {
//System.out.println("DataPoint.stateChanged, isValid="+isValid);
fireStateChanged();
}
// Service methods
public void clear() {
if (measurements != null && measurements.length > 0) {
for (int i=0; i
Ads help maintain this website.