Constructor and Description |
---|
Body(java.lang.String layout)
Body constructor takes a string and make from it a Body object.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
fitString()
fitString Return a string representing the space and the shapes that have
been fit into it.
|
int |
getHeight()
getHeight gets the height of the space
|
int |
getWidth()
getWidth gets the width of the space
|
boolean |
isFilledAt(int row,
int col)
isFilledAt(r,c) check if this point is in the space bound and check
if this spot is filled and no.
|
int |
placedShapeCount()
placedShapeCount keeps the count of how many shapes we have into a space tjat gets updated each
time a change in space happend like adding one or remove one space
|
java.lang.String |
placedShapeInfo()
placedShapeInfo has all info about the shape like where the shape is located on the map
what rotation was used to be there the name of the shape and how the shape looks.
|
void |
placeShapeAt(int row,
int col,
Shape shape)
This method will place a shape Amoeba into the body space.
|
void |
removeShapeByDisplayChar(char dc)
This method will remove the shapes that contains the char dc.
|
boolean |
shapeFitsAt(int row,
int col,
Shape shape)
shapeFitsAt check if this shape can fit into this space.
|
java.lang.String |
toString()
toString puts everything togother that have happend on the space
first print the space with space info and later print info of shapes list
get this info from fitString and placedShapeInfo
return the represantion of the new space with shapes in it.
|
public Body(java.lang.String layout)
public int getWidth()
public int getHeight()
public boolean isFilledAt(int row, int col)
isFilledAt
in interface Space
public boolean shapeFitsAt(int row, int col, Shape shape)
shapeFitsAt
in interface Space
public void placeShapeAt(int row, int col, Shape shape)
placeShapeAt
in interface Space
public void removeShapeByDisplayChar(char dc)
removeShapeByDisplayChar
in interface Space
public int placedShapeCount()
placedShapeCount
in interface Space
public java.lang.String fitString()
public java.lang.String placedShapeInfo()
placedShapeInfo
in interface Space
public java.lang.String toString()