public class Row
extends java.lang.Object
implements java.io.Serializable
Constructor and Description |
---|
Row(Color[] colors)
Constructor for a Row with colors.
|
Row(int width)
Constructor for a Row with a given width.
|
Modifier and Type | Method and Description |
---|---|
int |
containsColor(Color color)
Checks how often a Row contains a specific color.
|
boolean |
containsDoubleColor()
Checks if the same Color is inside the Row more than once.
|
boolean |
equals(java.lang.Object o)
Check if the specified object equals this Row.
|
Color |
getColorAtPos(int pos)
Get a color at a specific position in the Row.
|
Color[] |
getColors()
Getter for a Row.
|
boolean |
setColorAtPos(int pos,
Color color)
Set a color at a specific position in the Row.
|
void |
setColors(Color[] colors)
Setter for a Row.
|
java.lang.String |
toString()
Line-up all colors seperated with ",".
|
int |
width()
Getter for the Row width.
|
private Color[] colors
public Row(Color[] colors)
colors
- An array of colors to initialize the Row.public Row(int width)
width
- The width of the Row.public Color[] getColors()
public void setColors(Color[] colors)
colors
- An array of colors.public Color getColorAtPos(int pos)
pos
- The position from where to get the color.public boolean setColorAtPos(int pos, Color color)
pos
- The position where to set the color.color
- The color to set on the position.public int width()
public int containsColor(Color color)
color
- The color to look for.public boolean containsDoubleColor()
public java.lang.String toString()
toString
in class java.lang.Object
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
o
- The object to compare with.