if ( node == null )
continue;
boolean isValidConnection = this.canConnect( node, f ) && node.canConnect( this, f.getOpposite() );
IGridConnection con = null; // find the connection for this
// direction..
for (IGridConnection c : getConnections())
{
if ( c.getDirection( this ) == f )
{
con = c;
break;
}
}
if ( con != null )
{
IGridNode os = con.getOtherSide( this );
if ( os == node )
{
// if this connection is no longer valid, destroy it.
if ( !isValidConnection )
con.destroy();
}
else
{
con.destroy();
// throw new GridException( "invalid state found, encountered connection to phantom block." );
}
}
else if ( isValidConnection )
{