Class Side
java.lang.Object
com.github.basking2.sdsai.marchinesquares.Side
- Direct Known Subclasses:
Side.ArtificialSide
A side is one cell value and optionally one or two points on the edge of a
Tile
.
Points are assigned as either a begin or end point. That is, what role does that
point play in the contour of the cell of the tile the side is describing.-
Nested Class Summary
-
Field Summary
Modifier and TypeFieldDescriptionA point that begins a contour in a particular cell.static byte
This is used to construct artificial sides as place holders.byte
The value in the data grid.A point that ends a contour. -
Constructor Summary
ConstructorDescriptionSide
(byte cell) Constructor.Side
(byte cell, LinkedList.Node<Point> beginPoint, LinkedList.Node<Point> endPoint) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionstatic Side
buildArtificialSide
(double x, double y, byte side, byte color, byte left, byte right) Build an artificial side with the correct number of points.void
setPoints
(double x, double y, byte side, byte color, byte left, byte right) void
toString()
-
Field Details
-
cell
public byte cellThe value in the data grid. This is -1, 0, or 1. This is used to construct contours with neighboring tiles. -
beginPoint
A point that begins a contour in a particular cell. Its next field should be defined. The endPoint of one side should be linked to the beginPoint of another side in the same cell. -
endPoint
A point that ends a contour. Its next field will be empty if only a single cell is contoured. The endPoint of one side should be linked to the beginPoint of another side. -
BOGUS_VALUE
public static byte BOGUS_VALUEThis is used to construct artificial sides as place holders.
-
-
Constructor Details
-
Side
Constructor.- Parameters:
cell
- A cell value.beginPoint
- A point of a line.endPoint
- A point of a line.
-
Side
public Side(byte cell) Constructor.- Parameters:
cell
- A cell value.
-
-
Method Details
-
toString
-
setPoints
public void setPoints(double x, double y, byte side, byte color, byte left, byte right) -
buildArtificialSide
public static Side buildArtificialSide(double x, double y, byte side, byte color, byte left, byte right) Build an artificial side with the correct number of points.- Parameters:
x
- The x value to create points at.y
- The y value to create points at.side
- The side of a cell that this lies on. The values are 0 is the top, 1 is the right, 2 is the bottom, and 3 is the left.color
- The color to set the linked list nodes to.left
- The value of the point that is on the left of the side, the side being viewed from the center of the cell. The counter-clockwise most point.right
- The value of the point that is on the right of the side, the side being viewed from the center of the cell. The clockwise most point.- Returns:
- A built artificial side.
-
swapPoints
public void swapPoints() -
prettyPrint
-