Package jadex.bdiv3.examples.blocksworld
Class Block
- java.lang.Object
- 
- jadex.bdiv3.examples.blocksworld.Block
 
- 
- Direct Known Subclasses:
- Table
 
 public class Block extends java.lang.ObjectA block in the blocks-world.
- 
- 
Field SummaryFields 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 SummaryAll 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.BlockgetUpper()Get the upper.inthashCode()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- 
numberprotected int number The number of the block.
 - 
colorprotected java.awt.Color color The color of the block.
 - 
lowerprotected Block lower The block where this block is located on.
 - 
upperprotected Block upper The block located on upper of this block.
 - 
pcspublic SimplePropertyChangeSupport pcs The helper object for bean events.
 - 
dxprotected double dx The x translation for drawing (0-1).
 - 
dyprotected double dy The y translation for drawing (0-1).
 
- 
 - 
Constructor Detail- 
Blockpublic 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.
 
 - 
Blockpublic 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- 
getNumberprotected static int getNumber() Get an instance number.
 - 
getColorpublic java.awt.Color getColor() Get the color of the block.- Returns:
- The color of the block.
 
 - 
getLowerpublic Block getLower() Get the block where this block is located on.- Returns:
- The block where this block is located on.
 
 - 
getUpperpublic Block getUpper() Get the upper.- Returns:
- The upper.
 
 - 
isClearpublic boolean isClear() Check if this block is clear.
 - 
stackOnpublic void stackOn(Block lower) Move this block on top of another block.
 - 
setLowerprotected void setLower(Block lower) Set the lower block, where this block is located on.- Parameters:
- lower- The lower block.
 
 - 
addBlockprotected void addBlock(Block block) Add a block to this block.
 - 
removeBlockprotected void removeBlock(Block block) Remove a block from this block.
 - 
toStringpublic java.lang.String toString() Create a string representation of this block.- Overrides:
- toStringin class- java.lang.Object
 
 - 
equalspublic boolean equals(java.lang.Object o) Check for equality.- Overrides:
- equalsin class- java.lang.Object
 
 - 
hashCodepublic int hashCode() - Overrides:
- hashCodein class- java.lang.Object
 
 - 
addPropertyChangeListenerpublic 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.
 
 - 
removePropertyChangeListenerpublic 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.
 
 
- 
 
-