/*
 * ITrace2D, the interface for all traces used by the Chart2D.
 * Copyright (c) 2004 - 2011  Achim Westermann, Achim.Westermann@gmx.de
 *
 *  This library is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU Lesser General Public
 *  License as published by the Free Software Foundation; either
 *  version 2.1 of the License, or (at your option) any later version.
 * 
 *  This library is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *  Lesser General Public License for more details.
 * 
 *  You should have received a copy of the GNU Lesser General Public
 *  License along with this library; if not, write to the Free Software
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 *
 *  If you modify or optimize the code in a useful way please let me know.
 *  Achim.Westermann@gmx.de
 */
package info.monitorenter.gui.chart;

import java.awt.Color;
import java.awt.Stroke;
import java.beans.PropertyChangeListener;
import java.io.Serializable;
import java.util.Iterator;
import java.util.Set;

/**
 * An interface used by Chart2D. ITrace2D contains the values to
 * display, the color for displaying and a suitable label. It may be seen as a
 * trace of the Chart2D that displays it. 
* Implementations may be optimized for different use- cases:
* RingBuffers for fast changing data to keep the amount of trace points and * consumption of memory constant, internal Lists for allowing the sorting the * internal TracePoint2D- instances or Arrays for unordered Data * (in the order of adding) for fast performance. Even an ITrace2D * constructed by a "function- Object" may be thinkable. *

* There are various constraints for Traces:
* - ordered by x-values
* - ordered by the order of addPoint- invocation (control form * outside)
* - unique, single x- values
* - limitation of tracepoints
* - time- critical (fast- changing tracepoints)
*
* Therefore there are various ITrace2D- implementations. Read * their description to find the one you need. Some may not have been written * yet. *

* {@link java.lang.Comparable} should be implemented by using the internal * property zIndex (see {@link #getZIndex()}, {@link #setZIndex(Integer)}). *

*

Property Change events

* The following {@link java.beans.PropertyChangeEvent} may be * fired to {@link PropertyChangeListener} instances that register * themselves with * {@link #addPropertyChangeListener(String, PropertyChangeListener)}. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
getPropertyName()getSource()getOldValue()getNewValue()
{@link info.monitorenter.gui.chart.ITrace2D#PROPERTY_ZINDEX} * {@link ITrace2D} that changed{@link java.lang.Number}, the old value{@link java.lang.Number}, the new value
{@link info.monitorenter.gui.chart.ITrace2D#PROPERTY_MAX_X}{@link ITrace2D} that changed{@link java.lang.Double}, the old value{@link java.lang.Double}, the new value
{@link info.monitorenter.gui.chart.ITrace2D#PROPERTY_MIN_X}{@link ITrace2D} that changed{@link java.lang.Double}, the old value{@link java.lang.Double}, the new value
{@link info.monitorenter.gui.chart.ITrace2D#PROPERTY_MAX_Y}{@link ITrace2D} that changed{@link java.lang.Double}, the old value{@link java.lang.Double}, the new value
{@link info.monitorenter.gui.chart.ITrace2D#PROPERTY_MIN_Y}{@link ITrace2D} that changed{@link java.lang.Double}, the old value{@link java.lang.Double}, the new value
* {@link info.monitorenter.gui.chart.ITrace2D#PROPERTY_TRACEPOINT} * {@link ITrace2D} that changed{@link info.monitorenter.gui.chart.TracePoint2D}, the * instance that was removednull, indication that an instance was removed
* {@link info.monitorenter.gui.chart.ITrace2D#PROPERTY_TRACEPOINT} * {@link ITrace2D} that changednull, indication that a value was added{@link info.monitorenter.gui.chart.TracePoint2D}, the new * instance that was added, identifying that an instance was removed
* {@link info.monitorenter.gui.chart.ITrace2D#PROPERTY_VISIBLE}{@link ITrace2D} that changed{@link java.lang.Boolean}, the old state.{@link java.lang.Boolean}, the new state.
* {@link info.monitorenter.gui.chart.ITrace2D#PROPERTY_PAINTERS}{@link ITrace2D} that changednull, indicating that a painter was added.{@link info.monitorenter.gui.chart.ITracePainter}, the new * painter.
* {@link info.monitorenter.gui.chart.ITrace2D#PROPERTY_PAINTERS}{@link ITrace2D} that changed{@link info.monitorenter.gui.chart.ITracePainter}, the old * painter.null, indicating that a painter was removed.
* {@link info.monitorenter.gui.chart.ITrace2D#PROPERTY_POINT_HIGHLIGHTERS_CHANGED} * {@link ITrace2D} that changednull, indicating that a point highlighter was added.{@link info.monitorenter.gui.chart.IPointPainter}, the * new highlighter.
* {@link info.monitorenter.gui.chart.ITrace2D#PROPERTY_POINT_HIGHLIGHTERS_CHANGED} * {@link ITrace2D} that changed{@link info.monitorenter.gui.chart.IPointPainter}, the * old highlighter.null, indicating that a point highlighter was removed.
* {@link info.monitorenter.gui.chart.ITrace2D#PROPERTY_PAINTERS}{@link ITrace2D} that changed{@link info.monitorenter.gui.chart.IPointPainter}, the * old highlighter.null, indicating that a highlighter was removed.
{@link info.monitorenter.gui.chart.ITrace2D#PROPERTY_STROKE} * {@link ITrace2D} that changed{@link java.awt.Stroke}, the old stroke.{@link java.awt.Stroke}, the new stroke.
{@link info.monitorenter.gui.chart.ITrace2D#PROPERTY_COLOR}{@link ITrace2D} that changed{@link java.awt.Color}, the new color.{@link java.awt.Color}, the new color.
* {@link info.monitorenter.gui.chart.ITrace2D#PROPERTY_ERRORBARPOLICY} * {@link ITrace2D} that changednull, indicating that an error bar policy was added.{@link info.monitorenter.gui.chart.IErrorBarPolicy}, the new * error bar policy.
* {@link info.monitorenter.gui.chart.ITrace2D#PROPERTY_ERRORBARPOLICY} * {@link ITrace2D} that changed{@link info.monitorenter.gui.chart.IErrorBarPolicy}, the old * error bar policy.null, indicating that an error bar policy was removed.
* {@link info.monitorenter.gui.chart.ITrace2D#PROPERTY_ERRORBARPOLICY_CONFIGURATION} * {@link ITrace2D} that notifies the change of the configured * error bar policy.null{@link info.monitorenter.gui.chart.IErrorBarPolicy}, the * instance with the configuration change.
* {@link info.monitorenter.gui.chart.ITrace2D#PROPERTY_POINT_CHANGED} * {@link ITrace2D} that notifies the change of the contained * trace point.null because it would be too much overhead to store the old * point in a additional instance as the original is modified in * {@link TracePoint2D#setLocation(java.awt.geom.Point2D)}.{@link TracePoint2D} the point whose location was modified.
{@link info.monitorenter.gui.chart.ITrace2D#PROPERTY_NAME}{@link ITrace2D} that notifies the change.{@link String}, the old value of * {@link #getName()}{@link String}, the new value of * {@link #getName()}
* {@link info.monitorenter.gui.chart.ITrace2D#PROPERTY_PHYSICALUNITS} * {@link ITrace2D} that notifies the change.{@link String}, the old value of * {@link #getPhysicalUnits()}{@link String}, the new value of * {@link #getPhysicalUnits()}
* {@link info.monitorenter.gui.chart.ITrace2D#PROPERTY_LABEL} * (triggered by {@link #setName(String)} and * {@link #setPhysicalUnits(String, String)}){@link ITrace2D} that notifies the change.{@link String}, the old value of * {@link #getLabel()}{@link String}, the new value of * {@link #getLabel()}
*

* * @author Achim Westermann * @version $Revision: 1.41 $ */ public interface ITrace2D extends PropertyChangeListener, Comparable, Serializable { /** * Simple struct just for allowing to return a trace point along with a * weighted distance. *

* TODO: change this to an interface and implement in abstract base class to * hide constructor. *

* * @author Achim Westermann * @version $Revision: 1.41 $ */ public final class DistancePoint { /** Constant for unfound distance. */ public static final DistancePoint EMPTY = new DistancePoint(); /** The measured distance. */ private double m_distance; /** The point with the distance. */ private ITracePoint2D m_point; /** * Defcon. */ public DistancePoint() { // nop. } /** * @return the distance. */ public final double getDistance() { return this.m_distance; } /** * @return the point. */ public final ITracePoint2D getPoint() { return this.m_point; } /** * @param manhattandistance * the manhattandistance to set */ public final void setDistance(final double manhattandistance) { this.m_distance = manhattandistance; } /** * @param point * the point to set */ public final void setPoint(final ITracePoint2D point) { this.m_point = point; } } /** * The property key defining the color property. Use in * combination with * {@link #addPropertyChangeListener(String, PropertyChangeListener)}. */ public static final String PROPERTY_COLOR = "ITrace2D.PROPERTY_COLOR"; /** * The property key defining a change of {@link IErrorBarPolicy} * instances contained. *

* This is fired from {@link #addErrorBarPolicy(IErrorBarPolicy)}, {@link #removeErrorBarPolicy(IErrorBarPolicy)} and * {@link #setErrorBarPolicy(IErrorBarPolicy)}. *

* Use in combination with * {@link #addPropertyChangeListener(String, PropertyChangeListener)}. *

*/ public static final String PROPERTY_ERRORBARPOLICY = "ITrace2D.PROPERTY_ERRORBARPOLICY"; /** * The property key defining a change of the configuration of a contained * {@link IErrorBarPolicy}. *

* This is fired whenever an IErrorBarPolicy notifies this * instance of a configuration change via an event for * {@link IErrorBarPolicy#PROPERTY_CONFIGURATION}. *

* Use in combination with * {@link #addPropertyChangeListener(String, PropertyChangeListener)}. *

*/ public static final String PROPERTY_ERRORBARPOLICY_CONFIGURATION = "ITrace2D.PROPERTY_ERRORBARPOLICY_CONFIGURATION"; /** * The property key defining the label property. Use in * combination with * {@link #addPropertyChangeListener(String, PropertyChangeListener)}. *

* * This is no real property as the {@link #getLabel()} access two * other fields. *

*/ public static final String PROPERTY_LABEL = "ITrace2D.PROPERTY_LABEL"; /** * The property key defining the maxX property. Use in * combination with * {@link #addPropertyChangeListener(String, PropertyChangeListener)}. */ public static final String PROPERTY_MAX_X = "ITrace2D.PROPERTY_MAX_X"; /** * The property key defining the maxY property. Use in * combination with * {@link #addPropertyChangeListener(String, PropertyChangeListener)}. */ public static final String PROPERTY_MAX_Y = "ITrace2D.PROPERTY_MAX_Y"; /** * The property key defining the minX property. Use in * combination with * {@link #addPropertyChangeListener(String, PropertyChangeListener)}. */ public static final String PROPERTY_MIN_X = "ITrace2D.PROPERTY_MIN_X"; /** * The property key defining the minY property. Use in * combination with * {@link #addPropertyChangeListener(String, PropertyChangeListener)}. */ public static final String PROPERTY_MIN_Y = "ITrace2D.PROPERTY_MIN_Y"; /** * The property key defining the name property. Use in * combination with * {@link #addPropertyChangeListener(String, PropertyChangeListener)}. */ public static final String PROPERTY_NAME = "ITrace2D.PROPERTY_NAME"; /** * The property key defining a change in the set of * {@link ITracePainter} * instances. Use in combination with * {@link #addPropertyChangeListener(String, PropertyChangeListener)}. */ public static final String PROPERTY_PAINTERS = "ITrace2D.PROPERTY_PAINTERS"; /** * The property key defining the physicalUnits property. Use in * combination with * {@link #addPropertyChangeListener(String, PropertyChangeListener)}. */ public static final String PROPERTY_PHYSICALUNITS = "ITrace2D.PROPERTY_PHYSICALUNITS"; /** * The property key defining any change of a location of a contained * {@link TracePoint2D} * . *

* Use in combination with * {@link #addPropertyChangeListener(String, PropertyChangeListener)}. * Property change event with this property will be fired if method * {@link TracePoint2D#setLocation(java.awt.geom.Point2D)} or * {@link TracePoint2D#setLocation(double, double)} of any * contained point is invoked. *

*/ public static final String PROPERTY_POINT_CHANGED = "ITrace2D.PROPERTY_POINT_CHANGED"; /** * The property key defining a change in the set of * {@link IPointPainter} * instances. Use in combination with * {@link #addPropertyChangeListener(String, PropertyChangeListener)}. */ public static final String PROPERTY_POINT_HIGHLIGHTERS_CHANGED = "ITrace2D.PROPERTY_POINT_HIGHLIGHTERS_CHANGED"; /** * The property key defining the stroke property. Use in * combination with * {@link #addPropertyChangeListener(String, PropertyChangeListener)}. */ public static final String PROPERTY_STROKE = "ITrace2D.PROPERTY_STROKE"; /** * The property key defining a change in the collection of * {@link TracePoint2D} * instances within this trace. Use in combination with * {@link #addPropertyChangeListener(String, PropertyChangeListener)}. */ public static final String PROPERTY_TRACEPOINT = "ITrace2D.PROPERTY_TRACEPOINT"; /** * The property key defining the visible property. Use in * combination with * {@link #addPropertyChangeListener(String, PropertyChangeListener)}. */ public static final String PROPERTY_VISIBLE = "ITrace2D.PROPERTY_VISIBLE"; /** * The property key defining the zIndex property. *

* Use in combination with * {@link #addPropertyChangeListener(String, PropertyChangeListener)}. *

*/ public static final String PROPERTY_ZINDEX = "ITrace2D.PROPERTY_ZINDEX"; /** * The minimum value for property zIndex: 0. * * @see #getZIndex() * @see #setZIndex(Integer) */ public static final int Z_INDEX_MIN = 0; /** * The maximum value for property zIndex: 100. *

* the descriptive name for this trace. *

* * @see #getZIndex() * @see #setZIndex(Integer) */ public static final int ZINDEX_MAX = 100; /** * Adds a trace that "should" compute values from the points added via * {@link #addPoint(ITracePoint2D)} * . *

* The given trace will be informed in case an add operation on this trace * succeeds via {@link #addPoint(ITracePoint2D)}. * * @param trace * the trace that will calculate it's points from the added points of * this trace. */ public void addComputingTrace(ITrace2D trace); /** * Adds the given error bar policy to the internal set of error bar policies. *

* It will be the last error bar policy to render (most forward on screen). *

* * @param errorBarPolicy * the error bar policy to add for rendering this trace's error bars. * @return true if the painter was added (same instance was not contained * before). */ public boolean addErrorBarPolicy(IErrorBarPolicy< ? > errorBarPolicy); /** * Adds a trace point to the internal data. *

* Warning:
* Do not call this method before this trace has been added to a chart or you * will not succeed as the chart is needed to get the proper * {@link Chart2D#getTracePointProvider()}. *

* * * @see #addPoint(ITracePoint2D p) * @param x * the x-value of the point to add. * @param y * the y-value of the point to add. * * @return true if the operation was successful, false else. * **/ public boolean addPoint(double x, double y); /** * Adds the given TracePoint2D to the internal data. *

* Try to pass instances of TracePoint2D to this instance instead * of invoking {@link #addPoint(double, double)} to increase * performance. Else the given point has to be copied into such an instance * from the other method and delegated to this method. *

* Implementations decide whether the point will be accepted or not. So they * have to update the internal properties minX, maxX,maxY and minY and also care about firing * property change events for those properties by method * * {@link java.beans.PropertyChangeSupport#firePropertyChange(java.beans.PropertyChangeEvent)}. *

* * @param p * the point to add. * @return true if the operation was successful, false else. */ public boolean addPoint(ITracePoint2D p); /** * Adds the given point painter to the internal set of point highlighters. *

* It will be the last point painter to paint highlighting if highlighting is * active. *

* * @param highlighter * the highlighter to add for highlighting this trace. * * @return true if the highlighter was added (class of instance not contained * before). */ public boolean addPointHighlighter(IPointPainter< ? > highlighter); /** * Registers a property change listener that will be informed about changes of * the property identified by the given propertyName. *

* * @param propertyName * the name of the property the listener is interested in * @param listener * a listener that will only be informed if the property identified * by the argument propertyName changes */ public void addPropertyChangeListener(String propertyName, PropertyChangeListener listener); /** * Adds the given trace painter to the internal set of trace painters. *

* It will be the last painter to paint (most forward). *

* * @param painter * the painter to add for rendering this trace. * @return true if the painter was added (class of instance not contained * before). */ public boolean addTracePainter(ITracePainter< ? > painter); /** * Returns true if the given painter is contained in this compound painter. *

* * @param painter * the painter to check whether it is contained. * @return true if the given painter is contained in this compound painter. */ public boolean containsTracePainter(final ITracePainter< ? > painter); /** * Method to trigger by {@link TracePoint2D#setLocation(double, double)} * , {@link #addPoint(ITracePoint2D)} * or * {@link #removePoint(ITracePoint2D)}. *

* Bound checks are performed and property change events for the properties * {@link ITrace2D#PROPERTY_MAX_X}, * {@link ITrace2D#PROPERTY_MIN_X}, * {@link ITrace2D#PROPERTY_MAX_Y} and * {@link ITrace2D#PROPERTY_MIN_Y} are fired if the add bounds * have changed due to the modification of the point. *

* * @param changed * the point that has been changed which may be a newly added point * (from {@link #addPoint(ITracePoint2D)}, a removed one * or a modified one. * @param state * one of {{@link ITracePoint2D#STATE_ADDED}, * {@link ITracePoint2D#STATE_CHANGED}, * {@link ITracePoint2D#STATE_REMOVED} to inform about the * type of change. */ public void firePointChanged(final ITracePoint2D changed, final int state); /** * Because the color is data common to a trace of a Chart2D it is * stored here. *

* On the other hand only the corresponding Chart2D may detect * the same color chosen for different IChart2D instances to be * displayed. Therefore it is allowed to return null. This is a message to the * Chart2D to leave it the choice of the color. Then the * Chart2D will chose a color not owned by another * ITrace2D instance managed and assign it to the null- returning * instance. *

* The Chart2D will often call this method. So try to cache the * value in implementation and only check on modifications of * TracePoint instances or on add- invocations for * changes. *

* * @return The chosen java.awt.Color or null if the decision for the color * should be made by the corresponding Chart2D. */ public Color getColor(); /** * Returns the Set<{@link IErrorBarPolicy}> that will be used to render * error bars for this trace. *

* * @return the Set<{@link IErrorBarPolicy}> that will be * used to render error bars for this trace. */ public Set> getErrorBarPolicies(); /** * Returns true if this trace has error bars configured. *

* If this returns false, no error bars will be painted for this trace. *

* * @return true if this trace has error bars configured. */ public boolean getHasErrorBars(); /** * Callback method for the Chart2D that returns a * String describing the label of the ITrace2D that * will be displayed below the drawing area of the Chart2D. *

* This method should be implemented and finalized ASAP in the inheritance * tree and rely on the property name and * physicalUnits. *

* * @return a String describing the Axis being accessed. */ public String getLabel(); /** *

* Returns the maximum amount of {@link TracePoint2D} instances that may be * added. For implementations that limit the maximum amount this is a * reasonable amount. Non-limiting implementations should return * {@link Integer#MAX_VALUE}. This allows to detect the unlimitedness. Of * course no implementation could store that amount of points. *

* * @return The maximum amount of {@link TracePoint2D} instances that may be * added. */ public int getMaxSize(); /** * Returns the maximum value to be displayed on the x- axis of the * Chart2D. Implementations should be synchronized for * multithreaded use. No exception is thrown. In case of empty data (no * tracepoints) 0 should be returned, to let the Chart2D know. *

* The Chart2D will often call this method. So try to cache the * value in implementation and only check on modifications of * TracePoint instances or on add- invocations for * changes. *

* * @return the maximum value of the internal data for the x- dimension. */ public double getMaxX(); /** * Returns the maximum value to be displayed on the y- axis of the Chart2D. * Implementations should be synchronized for multithreaded use. No exception * is thrown. In case of empty data (no tracepoints) 0 should be returned. * (watch division with zero). *

* * @return the maximum value of the internal data for the y- dimension. */ public double getMaxY(); /** * Returns the minimum value to be displayed on the x- axis of the Chart2D. *

* Implementations should be synchronized for multithreaded use. No exception * is thrown. In case of empty data (no tracepoints) 0 should be returned. * (watch division with zero). *

* The Chart2D will often call this method. So try to cache the * value in implementation and only check on modifications of * TracePoint instances or on add- invocations for * changes. *

* * @return the minimum value of the internal data for the x- dimension. */ double getMinX(); /** * Returns the minimum value to be displayed on the y- axis of the Chart2D. *

* Implementations should be synchronized for multithreaded use. No exception * is thrown. In case of empty data (no tracepoints) 0 should be returned. * (watch division with zero). *

* The Chart2D will often call this method. So try to cache the * value in implementation and only check on modifications of * TracePoint instances or on add- invocations for * changes. *

* * @return the minimum value of the internal data for the y- dimension. */ double getMinY(); /** * Returns the name of this trace. *

* * @return the name of this trace. * @see #setName(String s) */ public String getName(); /** * Returns the nearest point to the given normalized value coordinates of this * trace in Euclid distance. *

* Please note that the arguments must be normalized value coordinates like * provided by a {@link TracePoint2D#getScaledX()} or the * division of a pixel coordinate by the total pixel range of the chart. *

* Using the Manhattan distance is much faster than Euclid distance as it only * includes basic addition an absolute value for computation per point (vs. * square root, addition and quadrature for Euclid distance). However the * euclid distance spans a circle for the nearest points which is visually * more normal for end users than the Manhattan distance which forms a rhombus * and reaches far distances in only one dimension. *

* * @param x * the x value as a normalized value between 0 and 1.0. * @param y * the x value as a normalized value between 0 and 1.0. * * @return the nearest point to the given normalized value coordinates of this * trace in Euclid distance. */ public DistancePoint getNearestPointEuclid(double x, double y); /** * Returns the nearest point to the given normalized value coordinates of this * trace in Manhattan distance. *

* Please note that the arguments must be normalized value coordinates like * provided by a {@link TracePoint2D#getScaledX()} or the * division of a pixel coordinate by the total pixel range of the chart. *

* Using the Manhattan distance is much faster than Euclid distance as it only * includes basic addition an absolute value for computation per point (vs. * square root, addition and quadrature for Euclid distance). *

* * @param x * the x value as a normalized value between 0 and 1.0. * @param y * the x value as a normalized value between 0 and 1.0. * * @return the nearest point to the given normalized value coordinates of this * trace in Manhattan distance. */ public DistancePoint getNearestPointManhattan(double x, double y); /** * Returns the concatenation [x: "{@link #getPhysicalUnitsX()}", y: " * {@link #getPhysicalUnitsY()}"]. *

* * @return the concatenation [x: "{@link #getPhysicalUnitsX()}", y: " * {@link #getPhysicalUnitsY()}"]. * @see #setPhysicalUnits(String x,String y) */ public String getPhysicalUnits(); /** * Returns the physical unit string value for the x dimension. *

* * @return the physical unit string value for the x dimension. * @see #setPhysicalUnits(String x,String y) */ public String getPhysicalUnitsX(); /** * Returns the physical unit string value for the y dimension. *

* * @return the physical unit string value for the y dimension. * @see #setPhysicalUnits(String x,String y) */ public String getPhysicalUnitsY(); /** * Returns the Set<{@link IPointPainter}> that may be used to highlight * points of this trace. *

* This is used by the point highlighting feature: * {@link Chart2D#enablePointHighlighting(boolean)} * * @return the Set<{@link IPointPainter}> that may be used * to highlight points. */ public Set> getPointHighlighters(); /** * Returns all property change listeners for the given property. *

* * @param property * one of the constants with the PROPERTY_ prefix * defined in this class or subclasses. * @return the property change listeners for the given property. */ public PropertyChangeListener[] getPropertyChangeListeners(String property); /** * @return Returns the renderer. */ public Chart2D getRenderer(); /** * Returns the amount of {@link TracePoint2D} instances currently contained. *

* * @return The amount of {@link TracePoint2D} instances currently * contained. */ public int getSize(); /** * Returns the Stroke that is used to render this instance. *

* * @return the Stroke that is used to render this instance. * @see #setStroke(Stroke) */ public Stroke getStroke(); /** * Returns the Set<{@link ITracePainter}> that will be used to paint * this trace. *

* * The original set should be returned by contract to allow adding painters * "silently" (vs. using * {@link ITrace2D#addTracePainter(ITracePainter)}). *

* * @return the Set<{@link ITracePainter}> that will be used * to paint this trace. */ public Set> getTracePainters(); /** * The z-index defines the order in which this instance will be painted. *

* A higher value will bring it more "to the front". *

* * @return the z-index that will define the order in which this instance will * be painted. */ public Integer getZIndex(); /** * Returns false if internal {@link TracePoint2D} instances are * contained or true if not. *

* * @return false if internal {@link TracePoint2D} * instances are contained or true if not. */ public boolean isEmpty(); /** * Returns true if this instance should be rendered. *

* * @return true if this instance should be rendered. */ public boolean isVisible(); /** * Returns an Iterator over the internal * {@link TracePoint2D} * instances. *

* Implementations should be synchronized. This method is meant to allow * modifications of the intenal TracePoint2D instances, so the * original points should be returned. *

* There is no guarantee that changes made to the contained tracepoints will * be reflected in the display immediately. The order the iterator returns the * TracePoint2D instances decides how the Chart2D * will paint the trace. *

* * @return an Iterator over the internal * {@link TracePoint2D} instances. */ public Iterator iterator(); /** * Clears all internal point highlighters used. *

* * Returns the Set<{@link IPointPainter}> that was used to highlight * points. *

* This is used by the point highlighting feature: * {@link Chart2D#enablePointHighlighting(boolean)} * * @return the Set<{@link IPointPainter}> that was be used * to highlight points. */ public Set> removeAllPointHighlighters(); /** * Removes all internal TracePoint2D.{@link #isEmpty()} will * return true afterwards. *

*/ public void removeAllPoints(); /** * Remove a trace that "should" compute values from the points added via * {@link #addPoint(ITracePoint2D)}. *

* * @param trace * the trace that will calculate it's points from the added points of * this trace. * @return true if the given trace was removed (recognized by the means of * {@link Object#equals(Object)}). */ public boolean removeComputingTrace(ITrace2D trace); /** * Removes the given error bar policy from the internal set of error bar * policies. *

* * @param errorBarPolicy * the error bar policy to remove. * @return true if the painter was removed (same instance contained before). */ public boolean removeErrorBarPolicy(IErrorBarPolicy< ? > errorBarPolicy); /** * Removes the given point from this trace. *

* * @param point * the point to remove. * @return true if the remove opertation was successful, false else. */ public boolean removePoint(ITracePoint2D point); /** * Removes the given point highlighter, if it's class is contained. *

* * @param highlighter * the highlighter to remove. * * @return true if a point highlighter of the class of the given argument was * removed. */ public boolean removePointHighlighter(final IPointPainter< ? > highlighter); /** * Unregisters a property change listener that has been registered for * listening on all properties. *

* * @param listener * a listener that will only be informed if the property identified * by the argument propertyName changes */ public void removePropertyChangeListener(PropertyChangeListener listener); /** * Removes a property change listener for listening on the given property. *

* * @param property * one of the constants with the PROPERTY_ prefix * defined in this class or subclasses. * @param listener * the listener for this property change. */ public void removePropertyChangeListener(String property, PropertyChangeListener listener); /** * Removes the given trace painter, if it's class is contained and if more * painters are remaining. *

* * @param painter * the trace painter to remove. * @return true if a trace painter of the class of the given argument was * removed. */ public boolean removeTracePainter(final ITracePainter< ? > painter); /** * Set a java.awt.Color for this trace. *

* * @param color * the Color to set. */ public void setColor(Color color); /** * Replaces all internal error bar policies by the new one. *

* * @param errorBarPolicy * the new sole painter to use. * @return the Set<{@link IErrorBarPolicy}> that was used * before. */ public Set> setErrorBarPolicy(IErrorBarPolicy< ? > errorBarPolicy); /** * Assingns a specific name to the ITrace2D which will be * displayed by the Chart2D. *

* * @param name * the name for this trace. */ public void setName(String name); /** * Assigns a specific String representing the physical unit to the * ITrace2D * (e.g. Volt, Ohm, lux, ...) which will be displayed by the * {@link Chart2D} *

* * @param xunit * the physical unit for the x axis. * @param yunit * the physical unit for the y axis. */ public void setPhysicalUnits(final String xunit, final String yunit); /** * Replaces all internal point highlighters by the new one. *

* * @param highlighter * the new sole highlighter to use. * * @return the Set<{@link IPointPainter}> that was used * before or null if nothing changed. */ public Set> setPointHighlighter(IPointPainter< ? > highlighter); /** * This is a callback from {@link Chart2D#addTrace(ITrace2D)} and must not be * invoked from elsewhere (needed for synchronization). *

* Not the best design to put this to an interface, but Char2D should handle * this interface only. *

* * @param renderer * The renderer to set. */ public void setRenderer(Chart2D renderer); /** * Allows to specify the rendering of the ITrace2D. This Stroke will be * assigned to the {@link java.awt.Graphics2D} by the rendering * {@link Chart2D} when painting this instance. *

* * @param stroke * the stroke to use for painting this trace. */ public void setStroke(Stroke stroke); /** * Replaces all internal trace painters by the new one. *

* * @param painter * the new sole painter to use. * @return the Set<{@link ITracePainter}> that was used * before. */ public Set> setTracePainter(ITracePainter< ? > painter); /** * Set the visibility. If argument is false, this instance will not be * rendered by a Chart2D. *

* * @param visible * true if this trace should be painted, false else. */ public void setVisible(boolean visible); /** * Sets the internal z-index property. This decides the order in which * different traces within the same {@link Chart2D} are painted. *

* The higher the given value is the more this trace will be brought to front. *

* The value must not be lower than {@link #Z_INDEX_MIN}(0) and higher than * {@link #ZINDEX_MAX}(100). *

* This might not be tested for increased performance but ignoring these * bounds may result in wrong ordering of display. *

* * @param zIndex * the z index of this trace - the lower the value the more in front * the trace will appear amongst other traces in the same chart. * @see #getZIndex() */ public void setZIndex(Integer zIndex); /** * Tests whether error bars are painted by this trace. *

* Returns true if *

*

* * @return true if this trace renders error bars. */ public boolean showsErrorBars(); /** * Tests whether error bars in negative x direction are painted by this trace. *

* Returns true if *

*

* * @return true if this trace renders error bars in negative x direction. */ public boolean showsNegativeXErrorBars(); /** * Tests whether error bars in negative y direction are painted by this trace. *

* Returns true if *

*

* * @return true if this trace renders error bars in negative y direction. */ public boolean showsNegativeYErrorBars(); /** * Tests whether error bars in positive x direction are painted by this trace. *

* Returns true if *

*

* * @return true if this trace renders error bars in positive x direction. */ public boolean showsPositiveXErrorBars(); /** * Tests whether error bars in positive y direction are painted by this trace. *

* Returns true if *

*

* * @return true if this trace renders error bars in positive y direction. */ public boolean showsPositiveYErrorBars(); }

Ads help maintain this website.