Package jadex.bdi.examples.blocksworld
Class Block
- java.lang.Object
-
- jadex.bdi.examples.blocksworld.Block
-
- Direct Known Subclasses:
Table
public class Block extends java.lang.ObjectA block in the blocks-world.
-
-
Field Summary
Fields Modifier and Type Field Description protected java.awt.ColorcolorThe color of the block.protected doubledxThe x translation for drawing (0-1).protected doubledyThe y translation for drawing (0-1).protected BlocklowerThe block where this block is located on.protected intnumberThe number of the block.SimplePropertyChangeSupportpcsThe helper object for bean events.protected BlockupperThe block located on upper of this block.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddBlock(Block block)Add a block to this block.voidaddPropertyChangeListener(PropertyChangeListener listener)Add a PropertyChangeListener to the listener list.booleanequals(java.lang.Object o)Check for equality.java.awt.ColorgetColor()Get the color of the block.BlockgetLower()Get the block where this block is located on.protected static intgetNumber()Get an instance number.inthashCode()Calculate the hash code.booleanisClear()Check if this block is clear.protected voidremoveBlock(Block block)Remove a block from this block.voidremovePropertyChangeListener(PropertyChangeListener listener)Remove a PropertyChangeListener from the listener list.protected voidsetLower(Block lower)Set the lower block, where this block is located on.voidstackOn(Block lower)Move this block on top of another block.java.lang.StringtoString()Create a string representation of this block.
-
-
-
Field Detail
-
number
protected int number
The number of the block.
-
color
protected java.awt.Color color
The color of the block.
-
lower
protected Block lower
The block where this block is located on.
-
upper
protected Block upper
The block located on upper of this block.
-
pcs
public SimplePropertyChangeSupport pcs
The helper object for bean events.
-
dx
protected double dx
The x translation for drawing (0-1).
-
dy
protected double dy
The y translation for drawing (0-1).
-
-
Constructor Detail
-
Block
public Block(java.awt.Color color, Block lower)Create a new block.- Parameters:
color- The color of the block.lower- The block where this block is located on.
-
Block
public Block(int number, java.awt.Color color, Block lower)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 Detail
-
getNumber
protected static int getNumber()
Get an instance number.
-
getColor
public java.awt.Color getColor()
Get the color of the block.- Returns:
- The color of the block.
-
getLower
public Block getLower()
Get the block where this block is located on.- Returns:
- The block where this block is located on.
-
isClear
public boolean isClear()
Check if this block is clear.
-
stackOn
public void stackOn(Block lower)
Move this block on top of another block.
-
setLower
protected void setLower(Block lower)
Set the lower block, where this block is located on.- Parameters:
lower- The lower block.
-
addBlock
protected void addBlock(Block block)
Add a block to this block.
-
removeBlock
protected void removeBlock(Block block)
Remove a block from this block.
-
toString
public java.lang.String toString()
Create a string representation of this block.- Overrides:
toStringin classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)
Check for equality.- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
Calculate the hash code.- Overrides:
hashCodein classjava.lang.Object
-
addPropertyChangeListener
public void addPropertyChangeListener(PropertyChangeListener listener)
Add a PropertyChangeListener to the listener list. The listener is registered for all properties.- Parameters:
listener- The PropertyChangeListener to be added.
-
removePropertyChangeListener
public void removePropertyChangeListener(PropertyChangeListener listener)
Remove a PropertyChangeListener from the listener list. This removes a PropertyChangeListener that was registered for all properties.- Parameters:
listener- The PropertyChangeListener to be removed.
-
-