public class Block extends java.lang.Object implements java.lang.Comparable<Block>
Individual
Constructor and Description |
---|
Block() |
Block(Block b) |
Block(double x,
double y,
double w,
double h) |
Block(double x,
double y,
double w,
double h,
Orientation o,
int number) |
Modifier and Type | Method and Description |
---|---|
int |
compareTo(Block other)
Method to compare the number of blocks
|
void |
disturb(double avgW,
java.util.Random rand)
Method to mutate this Block.
|
void |
disturbOrientation(java.util.Random rand) |
void |
disturbToCenter(double avgW,
java.util.Random rand) |
double |
getBottom()
Method to get the bottom y-coordinate of this rotated Block.
|
double |
getHeight()
Method to return the height of this Block.
|
double |
getLeft()
Method to get the left x-coordinate of this rotated Block.
|
int |
getNr()
Method to get the index of the node to which this Block corresponds.
|
Orientation |
getOrientation() |
double |
getRight()
Method to get the right x-coordinate of this rotated Block.
|
double |
getTop()
Method to get the top y-coordinate of this rotated Block.
|
double |
getWidth()
Method to return the width of this Block.
|
double |
getX()
Method to return the x-coordinate of this Block.
|
double |
getY()
Method to return the y-coordinate of this Block.
|
double |
intersectionArea(Block other)
Method to calculate the intersection area with another Block.
|
boolean |
intersects(Block other)
Method to check this Block for intersection with another.
|
void |
setOrientation(Orientation o) |
void |
setPos(double x,
double y)
Method to set the location of this Block.
|
void |
valuesFrom(PlacementFrame.PlacementNode n) |
public Block()
public Block(Block b)
public Block(double x, double y, double w, double h)
public Block(double x, double y, double w, double h, Orientation o, int number)
public void valuesFrom(PlacementFrame.PlacementNode n)
public int compareTo(Block other)
compareTo
in interface java.lang.Comparable<Block>
other
- The other Blockpublic int getNr()
public Orientation getOrientation()
public void setOrientation(Orientation o)
public double getWidth()
public double getHeight()
public double getX()
public double getY()
public double getLeft()
public double getTop()
public double getRight()
public double getBottom()
public boolean intersects(Block other)
other
- The other Block to check this one for intersection with.public double intersectionArea(Block other)
other
- The other block which possibly intersects this Block.public void setPos(double x, double y)
x
- the X-coordinate of the center of this Block.y
- the Y-coordinate of the center of this Block.public void disturb(double avgW, java.util.Random rand)
rand
- The random number generator of the calling thread.public void disturbToCenter(double avgW, java.util.Random rand)
public void disturbOrientation(java.util.Random rand)