public class Tunnel
extends java.lang.Object
Tunnel represents the tunnel between two open Portals,
which are the tunnel entrances. A Tunnel has a single section of Rails
inside with a given length, on which vehicles can traverse. It can be opened, checked for
traffic and closed.| Constructor and Description |
|---|
Tunnel(Portal portal1,
Portal portal2,
int length)
Creates a
Tunnel between portal1 and portal2 containing
a number of Rails given by length. |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes both of the entrances of this
Tunnel. |
boolean |
isEmpty()
Returns if there are any
Vehicles occupying any of the Rails
inside the Tunnel. |
public Tunnel(Portal portal1, Portal portal2, int length)
Tunnel between portal1 and portal2 containing
a number of Rails given by length.portal1 - one of the entrances of the Tunnel. A Portal to be opened.portal2 - another entrance for the Tunnel. A Portal to be opened.length - the number of Rails to be in the Tunnel