Overview  Package   Class  Tree  Index 

be.lassi.domain
Class Colors

java.lang.Object
  extended by be.lassi.domain.Colors
All Implemented Interfaces:
java.lang.Iterable<java.awt.Color>

public class Colors
extends java.lang.Object
implements java.lang.Iterable<java.awt.Color>

Collection with Color objects that allows for regular and "endless" iteration over the collection elements (when the end of the collection is reached, iteration starts back at the start, and allows for initialization using color names.


Constructor Summary
Colors()
          Constructs a new instance.
Colors(java.awt.Color color, int size)
          Constructs a new instance with size elements referring to the same Color.
Colors(java.lang.String... colorNames)
          Constructs a new instance.
 
Method Summary
 java.awt.Color get(int index)
          Gets the color at given index.
 java.util.Iterator<java.awt.Color> iterator()
          
 java.awt.Color last()
          Gets the last color in the collection.
 java.awt.Color next()
          Gets the next color during endless iteration; when the end of the collection is reached, iteration starts back at the start.
 void set(int index, java.awt.Color color)
          Sets the color at given index.
 int size()
          Gets the number of elements in the collection.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Colors

public Colors()
Constructs a new instance.


Colors

public Colors(java.awt.Color color,
              int size)
Constructs a new instance with size elements referring to the same Color.

Parameters:
color - the initial color at each position in the collection
size - the initial number of elements in the collection

Colors

public Colors(java.lang.String... colorNames)
Constructs a new instance.

Parameters:
colorNames - the names of the initial colors in the collection
Method Detail

get

public java.awt.Color get(int index)
Gets the color at given index.

Parameters:
index - the index in the collection
Returns:
the color at given index

iterator

public java.util.Iterator<java.awt.Color> iterator()

Specified by:
iterator in interface java.lang.Iterable<java.awt.Color>

last

public java.awt.Color last()
Gets the last color in the collection.

Returns:
the last color in the collection

next

public java.awt.Color next()
Gets the next color during endless iteration; when the end of the collection is reached, iteration starts back at the start.

Returns:
the next color

set

public void set(int index,
                java.awt.Color color)
Sets the color at given index.

Parameters:
index - the index in the collection
color - the color to be set

size

public int size()
Gets the number of elements in the collection.

Returns:
the number of elements in the collection.

Overview  Package   Class  Tree  Index 
Lighting Assistant 1.2