Package jadex.bdi.blocksworld
Class Block
java.lang.Object
jadex.bdi.blocksworld.Block
- Direct Known Subclasses:
Table
A block in the blocks-world.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Color
The color of the block.protected double
The x translation for drawing (0-1).protected double
The y translation for drawing (0-1).protected Block
The block where this block is located on.protected int
The number of the block.The helper object for bean events.protected Block
The block located on upper of this block. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
Add a block to this block.void
Add a PropertyChangeListener to the listener list.boolean
Check for equality.getColor()
Get the color of the block.getLower()
Get the block where this block is located on.protected static int
Get an instance number.getUpper()
Get the upper.int
hashCode()
boolean
isClear()
Check if this block is clear.protected void
removeBlock
(Block block) Remove a block from this block.void
Remove a PropertyChangeListener from the listener list.protected void
Set the lower block, where this block is located on.void
Move this block on top of another block.toString()
Create a string representation of this block.
-
Field Details
-
number
protected int numberThe number of the block. -
color
The color of the block. -
lower
The block where this block is located on. -
upper
The block located on upper of this block. -
pcs
The helper object for bean events. -
dx
protected double dxThe x translation for drawing (0-1). -
dy
protected double dyThe y translation for drawing (0-1).
-
-
Constructor Details
-
Block
Create a new block.- Parameters:
color
- The color of the block.lower
- The block where this block is located on.
-
Block
Create a new block.- Parameters:
number
- The number of the block.color
- The color of the block.lower
- The block where this block is located on.
-
-
Method Details
-
getNumber
protected static int getNumber()Get an instance number. -
getColor
Get the color of the block.- Returns:
- The color of the block.
-
getLower
Get the block where this block is located on.- Returns:
- The block where this block is located on.
-
getUpper
Get the upper.- Returns:
- The upper.
-
isClear
public boolean isClear()Check if this block is clear. -
stackOn
Move this block on top of another block. -
setLower
Set the lower block, where this block is located on.- Parameters:
lower
- The lower block.
-
addBlock
Add a block to this block. -
removeBlock
Remove a block from this block. -
toString
Create a string representation of this block. -
equals
Check for equality. -
hashCode
public int hashCode() -
addPropertyChangeListener
Add a PropertyChangeListener to the listener list. The listener is registered for all properties.- Parameters:
listener
- The PropertyChangeListener to be added.
-
removePropertyChangeListener
Remove a PropertyChangeListener from the listener list. This removes a PropertyChangeListener that was registered for all properties.- Parameters:
listener
- The PropertyChangeListener to be removed.
-