codeblocks
Class BlockLink

java.lang.Object
  extended by codeblocks.BlockLink

public class BlockLink
extends java.lang.Object

A class that stores information about a potential block connection. Each BlockLink instance stores the Block IDs of the "plug" and "socket" and two block connectors, one from each, with a possible connection. In block linking, a "plug" can be either a before or plug connector, while a "socket" can either be a after or socket connector. Plugs can only connect to other socket connectors, while before connectors can connect to after and command socket connectors.


Method Summary
 void connect()
          This method actually connects the two blocks stored in this BlockLink object.
 void disconnect()
           
static BlockLink getBlockLink(Block block1, Block block2, BlockConnector socket1, BlockConnector socket2)
          Factory method for creating BlockLink objects
 java.lang.Long getLastBlockID()
           
 BlockConnector getPlug()
           
 java.lang.Long getPlugBlockID()
           
 BlockConnector getSocket()
           
 java.lang.Long getSocketBlockID()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

getPlug

public BlockConnector getPlug()
Returns:
the BlockConnector representing the plug side of the link

getSocket

public BlockConnector getSocket()
Returns:
the BlockConnector representing the socket side of the link

getPlugBlockID

public java.lang.Long getPlugBlockID()
Returns:
the Block ID of the Block containing the plug side of the link

getSocketBlockID

public java.lang.Long getSocketBlockID()
Returns:
the Block ID of the Block containing the socket side of the link

getLastBlockID

public java.lang.Long getLastBlockID()

connect

public void connect()
This method actually connects the two blocks stored in this BlockLink object.


disconnect

public void disconnect()

getBlockLink

public static BlockLink getBlockLink(Block block1,
                                     Block block2,
                                     BlockConnector socket1,
                                     BlockConnector socket2)
Factory method for creating BlockLink objects

Parameters:
block1 - one of the Block objects in the potential link
block2 - the other Block object
socket1 - the BlockConnector from block1
socket2 - the BlockConnector from block2
Returns:
a BlockLink object storing the potential link between block1 and block2

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object