uk.co.agena.minerva.util.model
Class IntervalDataPoint

java.lang.Object
  extended by uk.co.agena.minerva.util.model.DataPoint
      extended by uk.co.agena.minerva.util.model.IntervalDataPoint
All Implemented Interfaces:
java.lang.Cloneable, Writable

public class IntervalDataPoint
extends DataPoint

This class represents DataPoints that have an interval (e.g. [4.0, 4.5]) as their "x" value.


Field Summary
 
Fields inherited from class uk.co.agena.minerva.util.model.DataPoint
connObjectId, label, value, version
 
Fields inherited from interface uk.co.agena.minerva.util.model.Writable
FIELD_SEPARATOR
 
Constructor Summary
IntervalDataPoint()
          Default constructor.
IntervalDataPoint(double intervalLowerBound, double intervalUpperBound)
           
IntervalDataPoint(double value, int connObjectId, double intervalLowerBound, double intervalUpperBound)
          Constructs an IntervalDataPoint with the supplied value, connected object ID, lower bound and upper bound.
IntervalDataPoint(java.lang.String label, double intervalLowerBound, double intervalUpperBound)
           
IntervalDataPoint(java.lang.String label, double value, int connObjectId, double intervalLowerBound, double intervalUpperBound)
          Constructs an IntervalDataPoint with the supplied label, value, connected object ID, lower bound and upper bound.
 
Method Summary
 double area()
          This returns the "area" of the DataPoint i.e.
 java.lang.Object clone()
          Makes a copy of the IntervalDataPoint.
 double getAdjustedValue()
          This method will return the value adjusted for its probability mass.
 double getIntervalLowerBound()
          Returns the lower bound of the "x" interval.
 double getIntervalUpperBound()
          Returns the upper bound of the "x" interval.
 double getMidPoint()
          Returns the mid point of the interval
protected  void readRestOfFields(java.util.StringTokenizer st)
           
 void setIntervalLowerBound(double intervalLowerBound)
          Sets the lower bound of the "x" interval.
 void setIntervalUpperBound(double intervalUpperBound)
          Sets the upper bound of the "x" interval.
 java.lang.String toString()
          Returns a String representation of the IntervalDataPoint.
protected  void writeRestOfFields(java.lang.StringBuffer sb)
           
 
Methods inherited from class uk.co.agena.minerva.util.model.DataPoint
getConnObjectId, getLabel, getValue, getVersion, read, setConnObjectId, setLabel, setValue, setVersion, toHTMLString, toString, write
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

IntervalDataPoint

public IntervalDataPoint()
Default constructor.


IntervalDataPoint

public IntervalDataPoint(double value,
                         int connObjectId,
                         double intervalLowerBound,
                         double intervalUpperBound)
                  throws MinervaRangeException
Constructs an IntervalDataPoint with the supplied value, connected object ID, lower bound and upper bound. The IntervalDataPoint's label will be initialised with a String containing the lower and upper bound separated by a hyphen e.g. "10.0 - 20.0".

Parameters:
value - the "y" value
connObjectId - the ID of the object to which this IntervalDataPoint is connected
intervalLowerBound - the lower bound of the "x" interval
intervalUpperBound - the upper bound of the "x" interval
Throws:
MinervaRangeException - if the lower bound is greater than the upper bound

IntervalDataPoint

public IntervalDataPoint(java.lang.String label,
                         double value,
                         int connObjectId,
                         double intervalLowerBound,
                         double intervalUpperBound)
                  throws MinervaRangeException
Constructs an IntervalDataPoint with the supplied label, value, connected object ID, lower bound and upper bound.

Parameters:
label - the IntervalDataPoint's label
value - the "y" value
connObjectId - the ID of the object to which this IntervalDataPoint is connected
intervalLowerBound - the lower bound of the "x" interval
intervalUpperBound - the upper bound of the "x" interval
Throws:
MinervaRangeException - if the lower bound is greater than the upper bound

IntervalDataPoint

public IntervalDataPoint(java.lang.String label,
                         double intervalLowerBound,
                         double intervalUpperBound)

IntervalDataPoint

public IntervalDataPoint(double intervalLowerBound,
                         double intervalUpperBound)
Method Detail

getIntervalLowerBound

public double getIntervalLowerBound()
Returns the lower bound of the "x" interval.

Returns:
the lower bound of the "x" interval

setIntervalLowerBound

public void setIntervalLowerBound(double intervalLowerBound)
Sets the lower bound of the "x" interval.

Parameters:
intervalLowerBound - the new lower bound of the interval

getIntervalUpperBound

public double getIntervalUpperBound()
Returns the upper bound of the "x" interval.

Returns:
the upper bound of the "x" interval

setIntervalUpperBound

public void setIntervalUpperBound(double intervalUpperBound)
Sets the upper bound of the "x" interval.

Parameters:
intervalUpperBound - the new lower bound of the interval

clone

public java.lang.Object clone()
Makes a copy of the IntervalDataPoint.

Overrides:
clone in class DataPoint
Returns:
a copy of the IntervalDataPoint

readRestOfFields

protected void readRestOfFields(java.util.StringTokenizer st)
Overrides:
readRestOfFields in class DataPoint

writeRestOfFields

protected void writeRestOfFields(java.lang.StringBuffer sb)
Overrides:
writeRestOfFields in class DataPoint

area

public double area()
This returns the "area" of the DataPoint i.e. the interval width multiplied by the probability.

Returns:
the area

getMidPoint

public double getMidPoint()
Returns the mid point of the interval

Returns:

getAdjustedValue

public double getAdjustedValue()
This method will return the value adjusted for its probability mass. The probabilty mass is equal to the value of the datapoint divided by its range. If the range = 0, then the value of the data point is returned If the lower and upper bound are equivilent then the upper bound is incremented by 1 and the range calculated on this new upper bound value.

Overrides:
getAdjustedValue in class DataPoint
Returns:

toString

public java.lang.String toString()
Returns a String representation of the IntervalDataPoint. This contains the upper and lower bounds.

Overrides:
toString in class DataPoint
Returns:
the String representation of the DataSet


Copyright © 2006 Agena Ltd. All Rights Reserved.