com.ge.research.charts
Class ColorMap

java.lang.Object
  extended bycom.ge.research.charts.ColorMap

public class ColorMap
extends java.lang.Object

Defines a set of Color objects to be used for charting purposes. The Colors can be accessed from static methods or by instantiating this class, setting up an ordered queue of the Colors, which can be "popped" from the queue using the "getNextColor" methods.

Version:
$Revision: 1.1 $ $Date: 2006/08/11 00:17:53 $
Author:
garbiras

Constructor Summary
ColorMap()
          Default constructor.
 
Method Summary
static java.awt.Color getColor(int index)
          Retrieves the Color from the internal COLORLIST at the specified index.
static java.awt.Color getColor(java.lang.String name)
          Retrieves the Color identified by the argument name.
static java.awt.Color[] getColorList()
          Returns a clone of the COLORLIST
static java.util.Map getColorMap()
          Returns a copy of the COLORMAP
 java.awt.Color getNextColor()
          Returns the next Color from the COLORLIST as specified by the current index.
 java.awt.Color getNextColor(java.awt.Color skipColor)
          Returns the next Color from the COLORLIST as specified by the current index.
 java.awt.Color getNextColor(java.awt.Color[] skipColors)
          Returns the next Color from the COLORLIST as specified by the current index.
 java.awt.Color getNextColor(java.lang.String skipColor)
          Looks up the Color identified by skipColor from the COLORMAP and uses the value found (null if the Color is not found) as the argument to the getNextColor(java.awt.Color) method.
 java.awt.Color getNextColor(java.lang.String[] skipColors)
          Looks up the Colors identified by skipColors from the COLORMAP and uses the values found (null if a Color is not found) as the argument to the getNextColor(java.awt.Color[]) method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ColorMap

public ColorMap()
Default constructor. Sets the current index of the color queue to the beginning

Method Detail

getColor

public static java.awt.Color getColor(java.lang.String name)
Retrieves the Color identified by the argument name.

Parameters:
name - the name of the color to retrieve
Returns:
The Color identified by the argument name. If the argument name is not recognized, null is returned.

getColor

public static java.awt.Color getColor(int index)
Retrieves the Color from the internal COLORLIST at the specified index.

Parameters:
index - the index of the list to extract
Returns:
The Color at the specified position within the COLORLIST. If the index is negative or greater than or equal to COLORLIST.length, null is returned.

getColorList

public static java.awt.Color[] getColorList()
Returns a clone of the COLORLIST

Returns:
A clone of the COLORLIST
See Also:
Object.clone()

getColorMap

public static java.util.Map getColorMap()
Returns a copy of the COLORMAP

Returns:
A copy of the COLORMAP

getNextColor

public java.awt.Color getNextColor()
Returns the next Color from the COLORLIST as specified by the current index. The currIndex wraps around to the beginning of the COLORLIST when it reaches the end of the list. The value of currIndex is incremented after each call to this method.

Returns:
The next Color in the sequence

getNextColor

public java.awt.Color getNextColor(java.awt.Color skipColor)
Returns the next Color from the COLORLIST as specified by the current index. The Color extracted from the COLORLIST is tested against the skipColor. If the Colors are the same, then the next color from the COLORLIST is extracted and tested. Only a color not matching the skipColor can be returned. If the entire COLORLIST has been checked and no non-matching Color is found, then it returns null. The currIndex wraps around to the beginning of the COLORLIST when it reaches the end of the list. The value of currIndex is incremented after each call to this method.

Parameters:
skipColor - a Color not to return, regardless if it is next in the list or not
Returns:
The next Color in the sequence that is not the skipColor. Returns null if no such Color can be found
See Also:
getNextColor()

getNextColor

public java.awt.Color getNextColor(java.awt.Color[] skipColors)
Returns the next Color from the COLORLIST as specified by the current index. The Color extracted from the COLORLIST is tested against the skipColors array. If the Color is the same as one in the array, then the next color from the COLORLIST is extracted and tested. Only a color not matching any of the skipColors can be returned. If the entire COLORLIST has been checked and no non-matching Color is found, then it returns null. The currIndex wraps around to the beginning of the COLORLIST when it reaches the end of the list. The value of currIndex is incremented after each call to this method.

Parameters:
skipColors - an array of Colors not to return
Returns:
The next Color in the sequence that is not in the skipColors array Returns null if no such Color can be found
See Also:
getNextColor()

getNextColor

public java.awt.Color getNextColor(java.lang.String skipColor)
Looks up the Color identified by skipColor from the COLORMAP and uses the value found (null if the Color is not found) as the argument to the getNextColor(java.awt.Color) method.

Parameters:
skipColor - a color not to return, regardless if it is next in the list or not
Returns:
The next Color in the sequence that is not the skipColor. Returns null if no such Color can be found
See Also:
getNextColor(java.awt.Color)

getNextColor

public java.awt.Color getNextColor(java.lang.String[] skipColors)
Looks up the Colors identified by skipColors from the COLORMAP and uses the values found (null if a Color is not found) as the argument to the getNextColor(java.awt.Color[]) method.

Parameters:
skipColors - an array of colors not to return
Returns:
The next Color in the sequence that is not in the skipColors array Returns null if no such Color can be found
See Also:
getNextColor(java.awt.Color[])