codeblocks
Class InfixRule

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

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

InfixRule specifies a rule for Block linking. Allows users to insert infix blocks in between two blocks.


Constructor Summary
InfixRule()
           
 
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

InfixRule

public InfixRule()
Method Detail

canLink

public 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

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.