NetCharts Pro

netcharts.pro.common
Class NFColorExpression

java.lang.Object
  extended by netcharts.pro.common.NFBaseClass
      extended by netcharts.pro.common.NFColorExpression
All Implemented Interfaces:
java.lang.Cloneable, NFCDLGenerator

public class NFColorExpression
extends NFBaseClass
implements NFCDLGenerator

The NFHeatmapColorExpression class contains attributes for a single color expression. Each color expression has an operator, value(s) to compare against, and a color to use if the expression is true. The BETWEEN operator is the only operator that uses two compare values as follows: value1 < x < value2.


Field Summary
static int BETWEEN
          Between operator
static int DEFAULT_OPERATOR
          Default value for the operator if not specified.
static double DEFAULT_VALUE1
          Default value for value1 if not specified.
static double DEFAULT_VALUE2
          Default value for value2 if not specified.
static int EQUALS
          Equals operator
static int GREATER_THAN
          Greater than operator
static int GREATER_THAN_OR_EQUAL
          Greater than or equal operator
static int LESS_THAN
          Less than operator
static int LESS_THAN_OR_EQUAL
          Less than or equal operator
static int NOT_EQUALS
          Not equals operator
 
Constructor Summary
NFColorExpression()
          Constructs a color expression object with defaults
NFColorExpression(int operator, double value, java.awt.Color color)
          Constructs a color expression object with the specified operator, value and color.
NFColorExpression(int operator, double value1, double value2, java.awt.Color color)
          Constructs a color expression object with the specified operator, compare values and color.
 
Method Summary
 java.lang.String getCDL()
          Generate CDL parameters representing the color expression
 void getCDL(java.lang.StringBuffer sb, boolean includeParens)
          Append CDL parameters representing the color expression to the given StringBuffer.
 java.awt.Color getColor()
          Returns the color to use if the expression is true
 int getOperator()
          Returns the expression operator
 double getValue1()
          Returns the value to compare against
 double getValue2()
          Returns the second compare value used for the BETWEEN operator
 void setCDL(java.lang.String cdl)
          Configures this object from a CDL parameter representation.
 int setCDL(java.lang.String[] elements, int offset)
          Configures this object from a CDL parameter representation.
 void setColor(java.awt.Color color)
          Sets the color to use if the expression is true
 void setOperator(int operator)
          Sets the expression operator
 void setValue1(double value1)
          Sets the value to compare against
 void setValue2(double value2)
          Sets the second compare value used for the BETWEEN operator.
 java.lang.String toString()
          Returns a String object representing the color expression.
 
Methods inherited from class netcharts.pro.common.NFBaseClass
clone, getModified, getUserObject, setModified, setUserObject
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

EQUALS

public static final int EQUALS
Equals operator


NOT_EQUALS

public static final int NOT_EQUALS
Not equals operator


GREATER_THAN

public static final int GREATER_THAN
Greater than operator


GREATER_THAN_OR_EQUAL

public static final int GREATER_THAN_OR_EQUAL
Greater than or equal operator


LESS_THAN

public static final int LESS_THAN
Less than operator


LESS_THAN_OR_EQUAL

public static final int LESS_THAN_OR_EQUAL
Less than or equal operator


BETWEEN

public static final int BETWEEN
Between operator


DEFAULT_OPERATOR

public static final int DEFAULT_OPERATOR
Default value for the operator if not specified.


DEFAULT_VALUE1

public static final double DEFAULT_VALUE1
Default value for value1 if not specified.

See Also:
Constant Field Values

DEFAULT_VALUE2

public static final double DEFAULT_VALUE2
Default value for value2 if not specified.

See Also:
Constant Field Values
Constructor Detail

NFColorExpression

public NFColorExpression()
Constructs a color expression object with defaults


NFColorExpression

public NFColorExpression(int operator,
                         double value,
                         java.awt.Color color)
Constructs a color expression object with the specified operator, value and color.


NFColorExpression

public NFColorExpression(int operator,
                         double value1,
                         double value2,
                         java.awt.Color color)
Constructs a color expression object with the specified operator, compare values and color.

Method Detail

setOperator

public void setOperator(int operator)
Sets the expression operator

If the specified expression operator is not valid then an IllegalArgumentException will be thrown.

Parameters:
operator - expression operator

getOperator

public int getOperator()
Returns the expression operator

Returns:
expression operator or DEFAULT_OPERATOR if not set

setValue1

public void setValue1(double value1)
Sets the value to compare against

Parameters:
value1 - compare value

getValue1

public double getValue1()
Returns the value to compare against

Returns:
compare value or DEFAULT_VALUE1 if not set

setValue2

public void setValue2(double value2)
Sets the second compare value used for the BETWEEN operator. For example, if value1 is set to 1 and value2 is set to 10 then the expression would be: 1 < cell value < 10.

Parameters:
value2 - second compare value

getValue2

public double getValue2()
Returns the second compare value used for the BETWEEN operator

Returns:
second compare value or DEFAULT_VALUE2 if not set

setColor

public void setColor(java.awt.Color color)
Sets the color to use if the expression is true

Parameters:
color - expression color

getColor

public java.awt.Color getColor()
Returns the color to use if the expression is true

Returns:
expression color or null if not set

getCDL

public java.lang.String getCDL()
Generate CDL parameters representing the color expression

Specified by:
getCDL in interface NFCDLGenerator
Returns:
CDL in the form: (operator, value1, value2, color)

getCDL

public void getCDL(java.lang.StringBuffer sb,
                   boolean includeParens)
Append CDL parameters representing the color expression to the given StringBuffer.

Parameters:
sb - Target buffer to append the CDL parameters
includeParens - If true, this will cause the parameters to be delimited with parenthesis.

toString

public java.lang.String toString()
Returns a String object representing the color expression.

Specified by:
toString in interface NFCDLGenerator
Overrides:
toString in class java.lang.Object
Returns:
String object in the same form as that given by getCDL().

setCDL

public void setCDL(java.lang.String cdl)
Configures this object from a CDL parameter representation.

Specified by:
setCDL in interface NFCDLGenerator
Parameters:
cdl - CDL in the form: (operator, value1, value2, color)

setCDL

public int setCDL(java.lang.String[] elements,
                  int offset)
Configures this object from a CDL parameter representation.

Parameters:
elements - Array of parameter elements. This array is expected to contain consecutive elements containing operator, value1, value2 and color.
offset - Offset into the elements array.

NetCharts Pro


Visual Mining, Inc.
2099 Gaither Rd.
Suite 220
Rockville, MD 20850
800.308.0731
301.947.8293 FAX

Copyright © Visual Mining, Inc. 1996 - 2011
All Rights Reserved.

NetCharts Pro TM is a registered trademark of Visual Mining, Inc. Other brands and their products are trademarks of their respective holders.

Last Modified: Jun 28, 2011