edu.colorado.cs.ns2.sim
Class Connection

java.lang.Object
  extended by edu.colorado.cs.ns2.sim.Connection
All Implemented Interfaces:
java.io.Serializable

public class Connection
extends java.lang.Object
implements java.io.Serializable

This class provides the binding between two Agents in the form of a Connection.

Author:
Kevin Bauer, Pushkar Sambhoos.
See Also:
Serialized Form

Field Summary
private  Agent agent1
          The first Agent party in the Connection.
private  Agent agent2
          The second Agent party in the Connection.
private  boolean isConnected
          The status of the Connection.
private static long serialVersionUID
          Generated serial version UID.
 
Constructor Summary
Connection(Agent a1, Agent a2)
          Two-argument constructor.
Connection(Agent a1, Agent a2, boolean isConnected)
          Three-argument constructor.
 
Method Summary
 boolean areAgentsConnected()
          Returns True if the agents are connected.
 void connectAgents()
          Connect the agents.
 void disconnectAgents()
          Disconnect the agents.
 Agent getAgent1()
          Returns the first Agent.
 Agent getAgent2()
          Returns the second Agent.
 void setAgent1(Agent agent1)
          Sets the first Agent.
 void setAgent2(Agent agent2)
          Sets the second Agent.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
Generated serial version UID.

See Also:
Constant Field Values

agent1

private Agent agent1
The first Agent party in the Connection.


agent2

private Agent agent2
The second Agent party in the Connection.


isConnected

private boolean isConnected
The status of the Connection.

Constructor Detail

Connection

public Connection(Agent a1,
                  Agent a2)
Two-argument constructor.

Parameters:
a1 - Agent 1.
a2 - Agent 2.

Connection

public Connection(Agent a1,
                  Agent a2,
                  boolean isConnected)
Three-argument constructor.

Parameters:
a1 - Agent 1.
a2 - Agent 2.
isConnected - The connection status. True if the agents are connected.
Method Detail

getAgent1

public Agent getAgent1()
Returns the first Agent.

Returns:
The first Agent.

setAgent1

public void setAgent1(Agent agent1)
Sets the first Agent.

Parameters:
agent1 - A new Agent 1.

getAgent2

public Agent getAgent2()
Returns the second Agent.

Returns:
The second Agent.

setAgent2

public void setAgent2(Agent agent2)
Sets the second Agent.

Parameters:
agent2 - A new Agent 2.

areAgentsConnected

public boolean areAgentsConnected()
Returns True if the agents are connected.

Returns:
True if the agents are connected.

connectAgents

public void connectAgents()
Connect the agents.


disconnectAgents

public void disconnectAgents()
Disconnect the agents.