|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectBarriers
Class representing barriers in a grid.
Constructor Summary | |
Barriers(int width,
int height,
int numberOfBarriers,
int positionX,
int positionY,
int headPositionX,
int headPositionY)
Creates a new instance of Barriers |
Method Summary | |
void |
Delete(java.awt.Graphics g,
java.awt.Color backgroundColor)
Clears barriers from a grid on a form. |
boolean |
IsBarrier(int x,
int y)
Tests if there is a barrier at the specific point. |
void |
paint(java.awt.Graphics g)
Paints barriers in a form. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public Barriers(int width, int height, int numberOfBarriers, int positionX, int positionY, int headPositionX, int headPositionY) throws java.lang.IllegalArgumentException, java.lang.RuntimeException
width
- Width of grid where to create barriers. (Number of cells.)height
- Height of grid where to create barriers. (Number of cells.)numberOfBarriers
- Number of barriers to create. Must be 0 <= numberOfBarriers < width * height *
10positionX
- X-coordinate of upper-left corner of a grid where barriers are displayed (in
pixels).positionY
- Y-coordinate of upper-left corner of a grid where barriers are displayed (in
pixels).headPositionX
- X-coordinate of a point in grid in whose nearness are no barriers created. In
the concrete it's 3 cells around that point. Usually this is a position of
caterpillar's head.headPositionY
- Y-coordinate of a point in grid in whose nearness are no barriers created. In
the concrete it's 3 cells around that point. Usually this is a position of
caterpillar's head.
java.lang.IllegalArgumentException
- If too big number of barriers is passed, IllegalArgumentException
is thrown. Too big means greather then (width * height / 10).
java.lang.RuntimeException
Method Detail |
public boolean IsBarrier(int x, int y)
x
- X-coordinate (in cells)y
- Y-coordinate (in cells)
public void paint(java.awt.Graphics g)
g
- Graphics object used to painting.public void Delete(java.awt.Graphics g, java.awt.Color backgroundColor)
g
- Graphics object used to painting.backgroundColor
- Background color.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |