|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object texturesynthesis.wangtilesynthesizer.wangtiles.WangTile
public class WangTile
This class represents a Wang tile. A Wang tile is a square with all it's four edges colored. A Wang tiling can be constructed from multiple Wang tiles by organizing the tiles to a plane so that adjacent edges have same colors. The tiles shouldn't be rotated. The coloring of edges is an abstract term. In this case integers greater than or equal to zero are used as colors.
Field Summary | |
---|---|
private int |
eastColor
The color of the east edge. |
private int |
northColor
The color of the north edge. |
private int |
numHorizontalColors
The number of the colors in the horizontal coloring. |
private int |
numVerticalColors
The number of the colors in the vertical coloring. |
private int |
southColor
The color of the south edge. |
private int |
westColor
The color of the west edge. |
Constructor Summary | |
---|---|
WangTile(int horizontalColors,
int verticalColors)
Constructs a new Wang tile skeleton. |
Method Summary | |
---|---|
boolean |
equals(WangTile anotherTile)
Tests if this tile is similiar to another tile. |
int |
getEastColor()
Returns the color of the east edge. |
int |
getNorthColor()
Returns the color of the north edge. |
int |
getNumHorizontalColors()
Gets the number of the colors in the horizontal coloring. |
int |
getNumVerticalColors()
Gets the number of the colors in the vertical coloring. |
int |
getSouthColor()
Returns the color of the south edge. |
int |
getWestColor()
Returns the color of the west edge. |
private boolean |
hasCorrectColoring()
Checks if this tile is colored. |
private boolean |
hasCorrectColoringLimits()
Checks if this tile has coloring limits set. |
void |
makeRandom()
Chooses colors for this tile's edges at random. |
void |
setEastColor(int color)
Sets the east edge color of this tile. |
void |
setNorthColor(int color)
Sets the north edge color of this tile. |
void |
setNumHorizontalColors(int numColors)
Sets the number of the colors in the horizontal coloring. |
void |
setNumVerticalColors(int numColors)
Sets the number of the colors in the vertical coloring. |
void |
setSouthColor(int color)
Sets the south edge color of this tile. |
void |
setWestColor(int color)
Sets the west edge color of this tile. |
java.lang.String |
toString()
Returns a string representation of this tile. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private int numHorizontalColors
private int numVerticalColors
private int northColor
private int westColor
private int southColor
private int eastColor
Constructor Detail |
---|
public WangTile(int horizontalColors, int verticalColors) throws java.lang.IllegalArgumentException
horizontalColors
- the number of horizontal colorsverticalColors
- the number of vertical colors
java.lang.IllegalArgumentException
Method Detail |
---|
public int getNumHorizontalColors()
public void setNumHorizontalColors(int numColors) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException
numColors
- the number of the colors.
java.lang.IllegalArgumentException
- if an argument less than 2 was given.
java.lang.IllegalStateException
- if the number of colors was already set.public int getNumVerticalColors()
public void setNumVerticalColors(int numColors) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException
numColors
- the number of the colors.
java.lang.IllegalArgumentException
- if an argument less than 2 was given.
java.lang.IllegalStateException
- if the number of colors was already set.public int getNorthColor()
public void setNorthColor(int color) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException
color
- the color.
java.lang.IllegalArgumentException
- if the argument was less than
zero or greater than (number_of_vertical_colors - 1).
java.lang.IllegalStateException
- if the tile has no coloring limits,
i.e. the numbers of horizontal and vertical colors aren't set yet.public int getEastColor()
public void setEastColor(int color) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException
color
- the color.
java.lang.IllegalArgumentException
- if the argument was less than
zero or greater than (number_of_horizontal_colors - 1).
java.lang.IllegalStateException
- if the tile has no coloring limits,
i.e. the numbers of horizontal and vertical colors aren't set yet.public int getSouthColor()
public void setSouthColor(int color) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException
color
- the color.
java.lang.IllegalArgumentException
- if the argument was less than
zero or greater than (number_of_vertical_colors - 1).
java.lang.IllegalStateException
- if the tile has no coloring limits,
i.e. the numbers of horizontal and vertical colors aren't set yet.public int getWestColor()
public void setWestColor(int color) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException
color
- the color.
java.lang.IllegalArgumentException
- if the argument was less than
zero or greater than (number_of_horizontal_colors - 1).
java.lang.IllegalStateException
- if the tile has no coloring limits,
i.e. the numbers of horizontal and vertical colors aren't set yet.public void makeRandom()
public boolean equals(WangTile anotherTile)
anotherTile
- another tile.
public java.lang.String toString()
toString
in class java.lang.Object
private boolean hasCorrectColoringLimits()
private boolean hasCorrectColoring()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |