JIDE 3.5.15

com.jidesoft.chart.model
Class TransformingChartModel

java.lang.Object
  extended by com.jidesoft.chart.model.AbstractDelegatingChartModel
      extended by com.jidesoft.chart.model.TransformingChartModel
All Implemented Interfaces:
AnnotatedChartModel, AnnotationModel, ChartModel, ChartModelListener, Transform<Chartable>, Named, Iterable<Chartable>

public class TransformingChartModel
extends AbstractDelegatingChartModel
implements Transform<Chartable>

A chart model that provides a general transformation mechanism. Note that every point is transformed, so this cannot be used for filtering. This could be used for example to translate the chart, or perhaps to modify the data values by, for example, showing the logarithm.

The hooking up of listeners and receiving change events is handled by the super class

Author:
Simon White (swhite@catalysoft.com)

Constructor Summary
TransformingChartModel()
           
TransformingChartModel(AnnotatedChartModel delegate)
           
 
Method Summary
 boolean equals(Object obj)
          The equality of a TransformingChartModel depends on its name
 Annotation getAnnotation(int n)
          Gets the nth annotation.
 int getAnnotationCount()
          Returns the number of annotations
 Chartable getPoint(int n)
          Gets the nth point.
 int getPointCount()
          Gets the number of points in the data set
 Transform<Chartable> getTransform()
           
 int hashCode()
          TransformingChartModels that have the same delegate need to have different hash codes so that they are recognised as being different.
protected  void init()
          Assigns a default name to the instance during construction.
 boolean isAnnotationsVisible()
          Use this method to discover whether annotations should be shown or hidden.
 void setAnnotationsVisible(boolean visible)
          Specify whether annotations should be shown
 void setTransform(Transform<Chartable> transform)
           
 String toString()
           
 Chartable transform(Chartable chartable)
           
protected  void update()
           
 
Methods inherited from class com.jidesoft.chart.model.AbstractDelegatingChartModel
addChartModelListener, chartModelChanged, fireModelChanged, getDelegate, getDelegate, getDelegates, getName, isCyclical, iterator, removeChartModelListener, setDelegate, setDelegates, setDelegates, setName
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TransformingChartModel

public TransformingChartModel()

TransformingChartModel

public TransformingChartModel(AnnotatedChartModel delegate)
Method Detail

init

protected void init()
Assigns a default name to the instance during construction. The name is unique within this JVM.

Overrides:
init in class AbstractDelegatingChartModel

getTransform

public Transform<Chartable> getTransform()

setTransform

public void setTransform(Transform<Chartable> transform)

getAnnotationCount

public int getAnnotationCount()
Description copied from interface: AnnotationModel
Returns the number of annotations

Specified by:
getAnnotationCount in interface AnnotationModel
Specified by:
getAnnotationCount in class AbstractDelegatingChartModel
Returns:
the number of annotations

getAnnotation

public Annotation getAnnotation(int n)
Description copied from interface: AnnotationModel
Gets the nth annotation.

Specified by:
getAnnotation in interface AnnotationModel
Specified by:
getAnnotation in class AbstractDelegatingChartModel
Parameters:
n - the index.
Returns:
the nth annotation

isAnnotationsVisible

public boolean isAnnotationsVisible()
Description copied from interface: AnnotationModel
Use this method to discover whether annotations should be shown or hidden.

Specified by:
isAnnotationsVisible in interface AnnotationModel
Returns:
whether annotations should be shown

setAnnotationsVisible

public void setAnnotationsVisible(boolean visible)
Description copied from interface: AnnotationModel
Specify whether annotations should be shown

Specified by:
setAnnotationsVisible in interface AnnotationModel
Parameters:
visible - whether annotations should be shown

getPoint

public Chartable getPoint(int n)
Description copied from interface: ChartModel
Gets the nth point. The first point has index 0.

Specified by:
getPoint in interface ChartModel
Specified by:
getPoint in class AbstractDelegatingChartModel
Parameters:
n - the index
Returns:
the nth point in the ChartModel.

getPointCount

public int getPointCount()
Description copied from interface: ChartModel
Gets the number of points in the data set

Specified by:
getPointCount in interface ChartModel
Specified by:
getPointCount in class AbstractDelegatingChartModel
Returns:
the number of points

update

protected void update()
Specified by:
update in class AbstractDelegatingChartModel

transform

public Chartable transform(Chartable chartable)
Specified by:
transform in interface Transform<Chartable>

hashCode

public int hashCode()
TransformingChartModels that have the same delegate need to have different hash codes so that they are recognised as being different. This implementation uses the name and the delegate to generate a hash code.

Overrides:
hashCode in class AbstractDelegatingChartModel

equals

public boolean equals(Object obj)
The equality of a TransformingChartModel depends on its name

Overrides:
equals in class AbstractDelegatingChartModel

toString

public String toString()
Overrides:
toString in class Object

JIDE 3.5.15