codeblocks
Class SocketRule

java.lang.Object
  extended by codeblocks.SocketRule
All Implemented Interfaces:
LinkRule

public class SocketRule
extends java.lang.Object
implements LinkRule

SocketRule checks if the two sockets being matched can connect simply by checking if the socket/plug match in kind.


Constructor Summary
SocketRule()
           
 
Method Summary
 boolean canLink(Block block1, Block block2, BlockConnector socket1, BlockConnector socket2)
          Returns true if the two sockets of the two blocks can link by matching their socket kind; false if not.
 boolean isMandatory()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SocketRule

public SocketRule()
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 by matching their socket kind; false if not. Both sockets must be empty to return true.

Specified by:
canLink in interface LinkRule
Parameters:
block1 - the associated Block of socket1
block2 - the associated Block of socket2
socket1 - a Socket or plug of block1
socket2 - a Socket or plug 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