codeblocks
Class CommandRule

java.lang.Object
  extended by codeblocks.CommandRule
All Implemented Interfaces:
LinkRule, WorkspaceListener

public class CommandRule
extends java.lang.Object
implements LinkRule, WorkspaceListener


Constructor Summary
CommandRule()
           
 
Method Summary
 boolean canLink(Block block1, Block block2, BlockConnector socket1, BlockConnector socket2)
          Returns true if the two sockets of the two blocks can link; false if not
 boolean isMandatory()
           
 void workspaceEventOccurred(WorkspaceEvent e)
          Invoked whenever any of the enumerated events specified within WorkspaceEvent occur.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CommandRule

public CommandRule()
Method Detail

canLink

public boolean canLink(Block block1,
                       Block block2,
                       BlockConnector socket1,
                       BlockConnector socket2)
Description copied from interface: LinkRule
Returns true if the two sockets of the two blocks can link; false if not

Specified by:
canLink in interface LinkRule
Parameters:
block1 - the associated Block of socket1
block2 - the associated Block of socket2
socket1 - a Socket of block1
socket2 - a Socket of block2
Returns:
true if the two sockets of the two blocks can link; false if not

isMandatory

public boolean isMandatory()
Specified by:
isMandatory in interface LinkRule

workspaceEventOccurred

public void workspaceEventOccurred(WorkspaceEvent e)
Description copied from interface: WorkspaceListener
Invoked whenever any of the enumerated events specified within WorkspaceEvent occur. We leave it to the implementor to look at the event type and determine what to do from there. We chose this design so that listeners need not implement all X methods, where X is the number of workspace events.

Specified by:
workspaceEventOccurred in interface WorkspaceListener
Parameters:
e - WorkspaceEvent object holding information regarding the triggered event.