org.sakaiproject.tool.chat
Class ColorMapper

java.lang.Object
  extended byorg.sakaiproject.tool.chat.ColorMapper

public class ColorMapper
extends Object

ColorMapper is a wrapper for a Hashtable that maps user names (or any set of Strings) to colors.

The colors are standard names for HTML colors.

Version:
$Revision: 4742 $
Author:
University of Michigan, CHEF Software Development Team

Field Summary
protected static String[] COLORS
           
protected  Map m_map
           
protected  int m_next
           
protected static int NumColors
           
 
Constructor Summary
ColorMapper()
          Construct the ColorMapper.
 
Method Summary
 String getColor(String name)
          get the color associated with a name.
 String[] getColors()
          Returns the entire array of color names.
 Map getMapping()
          Returns the mapping of names to colors.
 int getNext()
          Returns the index of the next color in the COLORS array that will be assigned to a name.
 int getNum_colors()
          Returns the size of the array of color names.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_next

protected int m_next

m_map

protected Map m_map

COLORS

protected static final String[] COLORS

NumColors

protected static final int NumColors
Constructor Detail

ColorMapper

public ColorMapper()
Construct the ColorMapper.

Method Detail

getColor

public String getColor(String name)
get the color associated with a name. if name not already associated with a color, make a new association and determine the next color that will be used.


getMapping

public Map getMapping()
Returns the mapping of names to colors.


getNext

public int getNext()
Returns the index of the next color in the COLORS array that will be assigned to a name.


getColors

public String[] getColors()
Returns the entire array of color names.


getNum_colors

public int getNum_colors()
Returns the size of the array of color names.