gcspy.utils
Class ColorDB

java.lang.Object
  extended by gcspy.utils.ColorDB

public class ColorDB
extends java.lang.Object

Maps colors to/from names

Author:
Tony Printezis

Method Summary
 void dump()
          Print out all the indices, names and values for all colours in the database
 java.awt.Color getColor(int index)
          Return the colour corresponding to an index
 java.awt.Color getColor(java.lang.String name)
          Return the colour corresponding to a name
static ColorDB getColorDB()
          Get the colours database
 int getIndex(java.awt.Color c)
          Return the index corresponding to a colour
 int getLength()
          Get the number of colours in the database
 java.lang.String getName(java.awt.Color c)
          Return the name corresponding to a colour
 java.lang.String getName(int index)
          Return the name corresponding to a colour index
static void main(java.lang.String[] args)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getColor

public java.awt.Color getColor(int index)
Return the colour corresponding to an index

Parameters:
index - The index
Returns:
The corresponding colour

getColor

public java.awt.Color getColor(java.lang.String name)
Return the colour corresponding to a name

Parameters:
name - The name
Returns:
The corresponding colour

getName

public java.lang.String getName(int index)
Return the name corresponding to a colour index

Parameters:
index - The index
Returns:
The corresponding name

getName

public java.lang.String getName(java.awt.Color c)
Return the name corresponding to a colour

Parameters:
c - The colour
Returns:
The corresponding name

getIndex

public int getIndex(java.awt.Color c)
Return the index corresponding to a colour

Parameters:
c - The colour
Returns:
The corresponding index

getLength

public int getLength()
Get the number of colours in the database

Returns:
the length of the colours list

dump

public void dump()
Print out all the indices, names and values for all colours in the database


getColorDB

public static ColorDB getColorDB()
Get the colours database

Returns:
the colours database

main

public static void main(java.lang.String[] args)