## org.ascape.util.vis
Class ColorFeatureConcrete

    java.lang.Object
      org.ascape.util.vis.ColorFeatureConcrete

All Implemented Interfaces:
  java.lang.Cloneable, HasName, ColorFeature

Direct Known Subclasses:
  ColorFeatureFixed, ColorFeatureGradiated

    public abstract class ColorFeatureConcrete

extends java.lang.Object
implements java.lang.Cloneable, ColorFeature

A Color feature returns a color based on the state of an object of known type provided to it. This class provides a concrete version of color feature for convenience in implementing subclasses. Used to provide an appropriate color for some feature or aspect of an object.

Since:
  1.2
Version:
  1.2
Author:
  Miles Parker

Field Summary
`protected static java.util.Map<org.eclipse.swt.graphics.RGB,org.eclipse.swt.graphics.Color>` `colorCache`
`protected java.lang.String` `name` The name of the feature.

Fields inherited from interface org.ascape.util.vis.ColorFeature
`BLACK, BLUE, CYAN, DARK_BLUE, DARK_GRAY, DARK_GREEN, DARK_MAGENTA, DARK_RED, DARK_YELLOW, DEFAULT_BG, GRAY, GREEN, HIGHLIGHT_AGENT_COLOR, LIGHT_GRAY, MAGENTA, ORANGE, RED, WHITE, YELLOW`

Constructor Summary
`ColorFeatureConcrete()` Constructs a concrete instantiation of a color feature.
`ColorFeatureConcrete(java.lang.String name)` Constructs a concrete instantiation of a color feature with the supplied name.

Method Summary
`static org.eclipse.swt.graphics.Color` `adjustBrightness(org.eclipse.swt.graphics.Color color, float factor)`
`static org.eclipse.swt.graphics.Color` `create(float r, float g, float b)`
`static org.eclipse.swt.graphics.Color` `create(int r, int g, int b)`
`static org.eclipse.swt.graphics.Color` `create(int r, int g, int b, int a)`
`static org.eclipse.swt.graphics.Color` `create(org.eclipse.swt.graphics.RGB rgb)`
`static org.eclipse.swt.graphics.Color` `createHSB(float hue, float sat, float brightness)`
`static org.eclipse.swt.graphics.Color` `createRandom()`
`abstract org.eclipse.swt.graphics.Color` `getColor(java.lang.Object object)` Returns a color for the object as defined in implementions of this class.
`java.lang.String` `getName()` Returns a name for the object as defined by set name.
`void` `setName(java.lang.String name)` Sets the name of this feature.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### name

    protected java.lang.String name

  The name of the feature.

### colorCache

    protected static java.util.Map<org.eclipse.swt.graphics.RGB,org.eclipse.swt.graphics.Color> colorCache

Constructor Detail

### ColorFeatureConcrete

    public ColorFeatureConcrete()

  Constructs a concrete instantiation of a color feature.

### ColorFeatureConcrete

    public ColorFeatureConcrete(java.lang.String name)

  Constructs a concrete instantiation of a color feature with the supplied name.

  Parameters:
    `name` - the user relevant name of the feature

Method Detail

### create

    public static final org.eclipse.swt.graphics.Color create(org.eclipse.swt.graphics.RGB rgb)

### create

    public static final org.eclipse.swt.graphics.Color create(int r,
                                                              int g,
                                                              int b)

### create

    public static final org.eclipse.swt.graphics.Color create(float r,
                                                              float g,
                                                              float b)

### create

    public static final org.eclipse.swt.graphics.Color create(int r,
                                                              int g,
                                                              int b,
                                                              int a)

### adjustBrightness

    public static org.eclipse.swt.graphics.Color adjustBrightness(org.eclipse.swt.graphics.Color color,
                                                                  float factor)

### createHSB

    public static final org.eclipse.swt.graphics.Color createHSB(float hue,
                                                                 float sat,
                                                                 float brightness)

### createRandom

    public static final org.eclipse.swt.graphics.Color createRandom()

### getName

    public java.lang.String getName()

  Returns a name for the object as defined by set name.

  Specified by:
    `getName` in interface `HasName`

### setName

    public final void setName(java.lang.String name)

  Sets the name of this feature.

  Parameters:
    `name` - a user relevant name for this feature

### getColor

    public abstract org.eclipse.swt.graphics.Color getColor(java.lang.Object object)

  Returns a color for the object as defined in implementions of this class.

  Specified by:
    `getColor` in interface `ColorFeature`
  Parameters:
    `object` - the object to get a color from.