hep.aida.ref.histogram
Class DataPointSet

java.lang.Object
  extended by hep.aida.ref.event.AIDAObservable
      extended by hep.aida.ref.ManagedObject
          extended by hep.aida.ref.histogram.DataPointSet
All Implemented Interfaces:
hep.aida.dev.IDevManagedObject, IDataPointSet, IManagedObject, AIDAListener, Connectable, IsObservable, Serializable

public class DataPointSet
extends ManagedObject
implements IDataPointSet, IsObservable, Serializable, AIDAListener

Basic user-level interface class for holding and managing a single set of "data points".

See Also:
Serialized Form

Constructor Summary
DataPointSet(String name, String title, int dimOfPoints)
           
DataPointSet(String name, String title, int dimOfPoints, int defaultCapacity)
           
DataPointSet(String name, String title, int dimOfPoints, int defaultCapacity, String options)
           
DataPointSet(String name, String title, int dimOfPoints, String options)
           
 
Method Summary
 IDataPoint addPoint()
          Add a new empty IDataPoint at the end of the set.
 void addPoint(IDataPoint point)
          Add a copy of an IDataPoint at the end of the set.
 IAnnotation annotation()
          Get the IAnnotation of the IDataPointSet.
 void clear()
          Remove all the IDataPoints in the set.
 int dimension()
          Get the dimension of the IDataPoints that can be stored in the set.
 double lowerExtent(int coord)
          Get the lower value for a give axis.
 IDataPoint point(int index)
          Get the IDataPoint at a give index in the set.
 void removePoint(int index)
          Remove the IDataPoint at a given index.
 void scale(double scaleFactor)
          Scales the values and the errors of all the measurements of each point by a given factor.
 void scaleErrors(double scaleFactor)
          Scales the errors of all the measurements of each point by a given factor.
 void scaleValues(double scaleFactor)
          Scales the values of all the measurements of each point by a given factor.
 void setAnnotation(IAnnotation annotation)
           
 void setCoordinate(int coord, double[] values, double[] errors)
          Set the values and errors of a given coordinate all at once.
 void setCoordinate(int coord, double[] values, double[] errp, double[] errm)
          Set the values and errors of a given coordinate all at once.
 void setPoint(int index, IDataPoint point)
          Set the IDataPoint at a give index in the set.
 void setTitle(String title)
          Set the title of the IDataPointSet.
 int size()
          Get the current size of the IDataPointSet, i.e.
 void stateChanged(EventObject e)
           
 String title()
          Get the title of the IDataPointSet.
 double upperExtent(int coord)
          Get the upper value for a give axis.
 
Methods inherited from class hep.aida.ref.ManagedObject
isFillable, name, setFillable, setName, type, typeForClass
 
Methods inherited from class hep.aida.ref.event.AIDAObservable
addListener, isConnected, removeAllListeners, removeListener, setConnected, setValid, setValidForAll
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface hep.aida.ref.event.IsObservable
addListener, removeAllListeners, removeListener, setValid
 
Methods inherited from interface hep.aida.ref.event.Connectable
isConnected, setConnected
 

Constructor Detail

DataPointSet

public DataPointSet(String name,
                    String title,
                    int dimOfPoints)

DataPointSet

public DataPointSet(String name,
                    String title,
                    int dimOfPoints,
                    int defaultCapacity)

DataPointSet

public DataPointSet(String name,
                    String title,
                    int dimOfPoints,
                    String options)

DataPointSet

public DataPointSet(String name,
                    String title,
                    int dimOfPoints,
                    int defaultCapacity,
                    String options)
Method Detail

annotation

public IAnnotation annotation()
Description copied from interface: IDataPointSet
Get the IAnnotation of the IDataPointSet.

Specified by:
annotation in interface IDataPointSet
Returns:
The IAnnotation.

setAnnotation

public void setAnnotation(IAnnotation annotation)

title

public String title()
Description copied from interface: IDataPointSet
Get the title of the IDataPointSet.

Specified by:
title in interface IDataPointSet
Returns:
The title.

setTitle

public void setTitle(String title)
              throws IllegalArgumentException
Description copied from interface: IDataPointSet
Set the title of the IDataPointSet.

Specified by:
setTitle in interface IDataPointSet
Parameters:
title - The new title.
Throws:
IllegalArgumentException - If the title cannot be set.

dimension

public int dimension()
Description copied from interface: IDataPointSet
Get the dimension of the IDataPoints that can be stored in the set.

Specified by:
dimension in interface IDataPointSet
Returns:
The dimension of the IDataPoints storable in the set.

clear

public void clear()
Description copied from interface: IDataPointSet
Remove all the IDataPoints in the set. After this the IDataPointSet is as just created.

Specified by:
clear in interface IDataPointSet

size

public int size()
Description copied from interface: IDataPointSet
Get the current size of the IDataPointSet, i.e. the number of IDataPoints contained in the set.

Specified by:
size in interface IDataPointSet
Returns:
The size of the IDataPointSet.

point

public IDataPoint point(int index)
Description copied from interface: IDataPointSet
Get the IDataPoint at a give index in the set.

Specified by:
point in interface IDataPointSet
Parameters:
index - The IDataPoint index.
Returns:
The corresponding IDataPoint.

setPoint

public void setPoint(int index,
                     IDataPoint point)
              throws IllegalArgumentException
Set the IDataPoint at a give index in the set. This method is not in the IDataSet interface and is here for efficiency reasons

Parameters:
index - The IDataPoint index.
point - The corresponding IDataPoint to be set at the index
Throws:
IllegalArgumentException - If the index is < 0 or >= size().

addPoint

public IDataPoint addPoint()
                    throws RuntimeException
Description copied from interface: IDataPointSet
Add a new empty IDataPoint at the end of the set.

Specified by:
addPoint in interface IDataPointSet
Returns:
The newly added point.
Throws:
RuntimeException - If a new IDataPoint cannot be added to the set.

addPoint

public void addPoint(IDataPoint point)
              throws IllegalArgumentException
Description copied from interface: IDataPointSet
Add a copy of an IDataPoint at the end of the set.

Specified by:
addPoint in interface IDataPointSet
Parameters:
point - The IDataPoint to be added.
Throws:
IllegalArgumentException - If the point has the wrong dimension or if the point cannot be added.

removePoint

public void removePoint(int index)
                 throws IllegalArgumentException
Description copied from interface: IDataPointSet
Remove the IDataPoint at a given index.

Specified by:
removePoint in interface IDataPointSet
Parameters:
index - The index of the IDataPoint to be removed.
Throws:
IllegalArgumentException - If the index is < 0 or >= size().

lowerExtent

public double lowerExtent(int coord)
                   throws IllegalArgumentException
Description copied from interface: IDataPointSet
Get the lower value for a give axis.

Specified by:
lowerExtent in interface IDataPointSet
Parameters:
coord - The coordinate of the axis.
Returns:
The lower edge of the corresponding axis.
Throws:
IllegalArgumentException - if coord < 0 or coord >= dimension() or if the set is empty.

upperExtent

public double upperExtent(int coord)
                   throws IllegalArgumentException
Description copied from interface: IDataPointSet
Get the upper value for a give axis.

Specified by:
upperExtent in interface IDataPointSet
Parameters:
coord - The coordinate of the axis.
Returns:
The upper edge of the corresponding axis.
Throws:
IllegalArgumentException - if coord < 0 or coord >= dimension() or if the set is empty.

scale

public void scale(double scaleFactor)
           throws IllegalArgumentException
Description copied from interface: IDataPointSet
Scales the values and the errors of all the measurements of each point by a given factor.

Specified by:
scale in interface IDataPointSet
Parameters:
scaleFactor - The scale factor.
Throws:
IllegalArgumentException - If an illegal scaleFactor is provided.

scaleValues

public void scaleValues(double scaleFactor)
                 throws IllegalArgumentException
Description copied from interface: IDataPointSet
Scales the values of all the measurements of each point by a given factor.

Specified by:
scaleValues in interface IDataPointSet
Parameters:
scaleFactor - The scale factor.
Throws:
IllegalArgumentException - If an illegal scaleFactor is provided.

scaleErrors

public void scaleErrors(double scaleFactor)
                 throws IllegalArgumentException
Description copied from interface: IDataPointSet
Scales the errors of all the measurements of each point by a given factor.

Specified by:
scaleErrors in interface IDataPointSet
Parameters:
scaleFactor - The scale factor.
Throws:
IllegalArgumentException - If an illegal scaleFactor is provided.

setCoordinate

public void setCoordinate(int coord,
                          double[] values,
                          double[] errors)
                   throws IllegalArgumentException
Description copied from interface: IDataPointSet
Set the values and errors of a given coordinate all at once. If this method is called on an empty IDataPointSet, a number of points equal to the size of the arrays provided is created; if the IDataPointSet is not empty the dimension of the array must match with the size of the IDataPointSet.

Specified by:
setCoordinate in interface IDataPointSet
Parameters:
coord - The coordinate's index
values - The array of the values for the given coordinate
errors - The array with the symmetric errors.
Throws:
IllegalArgumentException - if an illegal coordinate is provided or if there is a mismatch between the size of the array and the size of the IDataPointSet.

setCoordinate

public void setCoordinate(int coord,
                          double[] values,
                          double[] errp,
                          double[] errm)
                   throws IllegalArgumentException
Description copied from interface: IDataPointSet
Set the values and errors of a given coordinate all at once. If this method is called on an empty IDataPointSet, a number of points equal to the size of the arrays provided is created; if the IDataPointSet is not empty the dimension of the array must match with the size of the IDataPointSet.

Specified by:
setCoordinate in interface IDataPointSet
Parameters:
coord - The coordinate's index
values - The array of the values for the given coordinate
errp - The array with the plus errors.
errm - The array with the minus errors.
Throws:
IllegalArgumentException - if an illegal coordinate is provided or if there is a mismatch between the size of the array and the size of the IDataPointSet.

stateChanged

public void stateChanged(EventObject e)
Specified by:
stateChanged in interface AIDAListener


jHepWork 3.2 © jWork.org