|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectuk.org.arlott.simon.hw.f24.lbsta.LAN
public class LAN
Represents a LAN on the network.
| Field Summary | |
|---|---|
private java.util.HashSet<BridgePort> |
bridgePorts
The bridge ports connected to this LAN. |
private java.util.HashSet<Host> |
hosts
The hosts connected to this LAN. |
private java.util.HashSet<LAN> |
lans
The LANs connected to this one. |
private java.util.HashSet<Packet> |
packets
The packets attached to this LAN. |
int |
x1
The top left X co-ordinate position of the LAN. |
int |
x2
The bottom right X co-ordinate position of the LAN. |
int |
y1
The top left Y co-ordinate position of the LAN. |
int |
y2
The bottom right Y co-ordinate position of the LAN. |
| Constructor Summary | |
|---|---|
LAN(int x1,
int y1,
int x2,
int y2)
Creates a new LAN object. |
|
LAN(LAN lan)
Creates a new LAN object. |
|
| Method Summary | |
|---|---|
void |
addPacket(Packet p)
Adds a packet to this LAN. |
void |
connect(BridgePort b)
Connects to a bridge port. |
void |
connect(Host h)
Connects to a host. |
void |
connect(LAN l)
Connects to another LAN. |
void |
disconnect(BridgePort b)
Disconnects from a bridge port. |
void |
disconnect(Host h)
Disconnects from a host. |
void |
disconnect(LAN l)
Disconnects from a LAN. |
void |
disconnectAll()
Disconnects all LANs, bridges and hosts from this LAN. |
void |
disconnectBridges()
Disconnects all bridges from this LAN. |
void |
disconnectLANs()
Disconnects all LANs from this one. |
void |
finishConnects()
Finish reconnecting to any other network components that are not connected back to this one. |
java.util.HashSet<BridgePort> |
getBridges()
Gets all bridges connected to this LAN. |
java.util.Vector<Host> |
getHosts()
Gets all hosts connected to this LAN. |
java.util.HashSet<LAN> |
getLANs()
Gets all LANs connected to this one. |
int |
getLength()
Gets the length of the LAN. |
java.util.Vector<Packet> |
getPackets()
Gets all the packets on this LAN. |
void |
halfConnect(BridgePort b)
Connects to a bridge port but does not a require a reverse connection. |
void |
halfConnect(Host h)
Connects to a host but does not require a reverse connection. |
void |
halfConnect(LAN l)
Connects to another LAN but does not require a reverse connection. |
boolean |
isConnectedTo(BridgePort b)
Find out if this LAN is connected to a bridge port. |
boolean |
isConnectedTo(LAN l)
Find out if this LAN is connected to another LAN. |
void |
reconnect(LAN l)
Reconnects to all the LANs a LAN is connected to. |
void |
reconnectPackets(LAN l)
Reconnects to all the packets a LAN is connected to. |
void |
removeAllPackets()
Removes all packets from this LAN. |
void |
removePacket(Packet p)
Removes a packet from this LAN. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private java.util.HashSet<LAN> lans
private java.util.HashSet<BridgePort> bridgePorts
private java.util.HashSet<Host> hosts
private java.util.HashSet<Packet> packets
public int x1
public int y1
public int x2
public int y2
| Constructor Detail |
|---|
public LAN(int x1,
int y1,
int x2,
int y2)
throws InvalidPositionException
LAN object.
x1 - The top left X co-ordinate position.y1 - The top left Y co-ordinate position.x2 - The bottom right X co-ordinate positon.y2 - The bottom right Y co-ordinate positon.
InvalidPositionException - If the position is invalid.
public LAN(LAN lan)
throws InvalidPositionException
LAN object.
lan - An existing LAN object to copy.
InvalidPositionException - If the position is invalid.| Method Detail |
|---|
public int getLength()
public java.util.HashSet<LAN> getLANs()
public void connect(LAN l)
l - The LAN to connect to.public void halfConnect(LAN l)
l - The LAN to connect to.public void reconnect(LAN l)
l - The LAN with the LANs to reconnect to.public void reconnectPackets(LAN l)
l - The LAN with the packets to reconnect to.public boolean isConnectedTo(LAN l)
l - The other LAN.
true if connected to l.public void disconnect(LAN l)
l - The LAN to disconnect from.public java.util.HashSet<BridgePort> getBridges()
public void connect(BridgePort b)
b - The BridgePort to connect to.public void halfConnect(BridgePort b)
b - The BridgePort to connect to.public boolean isConnectedTo(BridgePort b)
b - The BridgePort.
true if connected to b.public void disconnect(BridgePort b)
b - The BridgePort to disconnect from.public java.util.Vector<Host> getHosts()
public void connect(Host h)
h - The Host to connect to.public void halfConnect(Host h)
h - The Host to connect to.public void disconnect(Host h)
h - The Host to disconnect from.public void finishConnects()
public void disconnectLANs()
public void disconnectBridges()
public void disconnectAll()
public void addPacket(Packet p)
addPacket in interface PacketTransportp - The Packet to add.public void removePacket(Packet p)
removePacket in interface PacketTransportp - The Packet to remove.public void removeAllPackets()
public java.util.Vector<Packet> getPackets()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||