chart
Class Filter

java.lang.Object
  extended by chart.Filter
All Implemented Interfaces:
java.io.Serializable

public class Filter
extends java.lang.Object
implements java.io.Serializable

Provides the possibility to filter the Designs on a Chart.

Filtered Designs are not displayed on he Chart anymore, or are displayed in a different color than the unfiltered Designs.

Each filter is a small triangular draggable symbol on an Axis. Each Axis has two filters, an upper Filter and a lower Filter. The upper Filter is used to filter out all Designs that have a larger value than the Filter value for the Parameter represented by the Filter's Axis. Accordingly, the lower Filter is used to filter out all Designs that have a lower value than the Filter value for the Parameter represented by the Filter's Axis.

The behavior described above changes when

See Also:
Chart, Axis, Parameter, Design, Serialized Form

Field Summary
private  Axis axis
          The axis to which the Filter belongs.
private  DataSheet dataSheet
          The data sheet.
private  int filterType
          The filter type.
static int LOWER_FILTER
          Constant that described a lower filter.
(package private) static boolean printLog
          Flag to enable debug message printing for this class.
(package private) static long serialVersionUID
          The version tracking unique identifier for Serialization.
static int UPPER_FILTER
          Constant that describes an upper filter.
private  int xPos
          The x position of the Filter on the Chart.
private  int yPos
          The y position of the Filter on the Chart.
 
Constructor Summary
Filter(DataSheet dataSheet, Axis axis, int filterType)
          Instantiates a new filter.
 
Method Summary
 void applyToDesigns()
          Applies the Filter to all designs.
 Axis getAxis()
          Gets the axis to which the Filter belongs.
 int getFilterType()
          Gets the filter type.
 int getHighestPos()
          Gets the highest position that this Filter may reach.
 int getLowestPos()
          Gets the lowest position that this Filter may reach.
 double getValue()
          Gets the current value of this Filter.
 int getXPos()
          Gets the x position of this Filter on the Chart.
 int getYPos()
          Gets the y position of this Filter on the Chart.
private  void log(java.lang.String message)
          Prints debug information to stdout when printLog is set to true.
 void setValue(double value)
          Sets the current value of this Filter.
 void setXPos(int pos)
          Sets the x position of this Filter on the Chart.
 void setYPos(int pos)
          Sets the y position of this Filter on the Chart.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serialVersionUID

static final long serialVersionUID
The version tracking unique identifier for Serialization.

See Also:
Constant Field Values

printLog

static final boolean printLog
Flag to enable debug message printing for this class.

See Also:
Constant Field Values

UPPER_FILTER

public static final int UPPER_FILTER
Constant that describes an upper filter.

See Also:
Constant Field Values

LOWER_FILTER

public static final int LOWER_FILTER
Constant that described a lower filter.

See Also:
Constant Field Values

dataSheet

private DataSheet dataSheet
The data sheet.


filterType

private int filterType
The filter type. Upper or Lower


axis

private Axis axis
The axis to which the Filter belongs.


xPos

private int xPos
The x position of the Filter on the Chart.


yPos

private int yPos
The y position of the Filter on the Chart.

Constructor Detail

Filter

public Filter(DataSheet dataSheet,
              Axis axis,
              int filterType)
Instantiates a new filter.

Parameters:
dataSheet - the data sheet
axis - the axis to which the Filter belongs
filterType - the filter type: UPPER_FILTER, LOWER_FILTER
Method Detail

getValue

public double getValue()
Gets the current value of this Filter.

Returns:
the current value of this Filter.

setValue

public void setValue(double value)
Sets the current value of this Filter.

Also calls applyToDesigns in order to make sure that the modified Filter positions is accounted for in the Filter states of all Designs.

Parameters:
value - the new current value of this Filter.

getXPos

public int getXPos()
Gets the x position of this Filter on the Chart.

Returns:
the x position of this Filter on the Chart.

setXPos

public void setXPos(int pos)
Sets the x position of this Filter on the Chart.

Parameters:
pos - the new x position of this Filter on the Chart.

getYPos

public int getYPos()
Gets the y position of this Filter on the Chart.

Returns:
the y position of this Filter on the Chart.

setYPos

public void setYPos(int pos)
Sets the y position of this Filter on the Chart.

Also calls applyToDesigns in order to make sure that the modified Filter positions is accounted for in the Filter states of all Designs.

Parameters:
pos - the new y position of this Filter on the Chart.

getHighestPos

public int getHighestPos()
Gets the highest position that this Filter may reach.

Used to make sure that a lower Filter is not dragged to a position above the upper Filter or outside the Axis range.

Returns:
the highest reachable position

getLowestPos

public int getLowestPos()
Gets the lowest position that this Filter may reach.

Used to make sure that a upper Filter is not dragged to a position below the lower Filter or outside the Axis range.

Returns:
the lowest reachable position

getFilterType

public int getFilterType()
Gets the filter type. Upper or lower.

Returns:
the filter type

getAxis

public Axis getAxis()
Gets the axis to which the Filter belongs.

Returns:
the axis to which the Filter belongs.

applyToDesigns

public void applyToDesigns()
Applies the Filter to all designs.

This method has to be called every time this Filter value is modified. This allows to check the Filtering state of a Design with respect to a Filter only when there is actually a reason for checking rather then upon every repaint.

This implementation was chosen because the check if a design is filtered would become to CPU expensive otherwise because each Filter would have to be checked for each design every time the Chart is repainted.


log

private void log(java.lang.String message)
Prints debug information to stdout when printLog is set to true.

Parameters:
message - the message