test
Class TestDTNHost

java.lang.Object
  extended by core.DTNHost
      extended by test.TestDTNHost
All Implemented Interfaces:
java.lang.Comparable<DTNHost>

public class TestDTNHost
extends DTNHost

A test stub of DTNHost for testing. All fields are public so they can be easily read from test cases.


Field Summary
 int abortedBytesRemaining
           
 DTNHost abortedFrom
           
 java.lang.String abortedId
           
 double lastUpdate
           
 int nrofConnect
           
 int nrofUpdate
           
 DTNHost recvFrom
           
 Message recvMessage
           
 DTNHost transferredFrom
           
 java.lang.String transferredId
           
 
Constructor Summary
TestDTNHost()
           
 
Method Summary
 void connect(DTNHost anotherHost)
          Creates a connection to another host (if it is within range)
 void messageAborted(java.lang.String id, DTNHost from, int bytesRemaining)
          Informs the host that a message transfer was aborted.
 void messageTransferred(java.lang.String id, DTNHost from)
          Informs the host that a message was successfully transferred.
 int receiveMessage(Message m, DTNHost from)
          Start receiving a message from another host
 void update()
          Updates node's network layer and router.
 
Methods inherited from class core.DTNHost
changedConnection, compareTo, createNewMessage, deleteMessage, equals, forceConnection, getAddress, getBufferOccupancy, getConnections, getCurCell, getLocation, getMessageCollection, getNrofMessages, getPath, getRouter, getRoutingInfo, getTransmitRange, getTransmitSpeed, isActive, move, requestDeliverableMessages, sendMessage, setCurCell, setLocation, setName, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

lastUpdate

public double lastUpdate

nrofConnect

public int nrofConnect

nrofUpdate

public int nrofUpdate

recvMessage

public Message recvMessage

recvFrom

public DTNHost recvFrom

abortedId

public java.lang.String abortedId

abortedFrom

public DTNHost abortedFrom

abortedBytesRemaining

public int abortedBytesRemaining

transferredId

public java.lang.String transferredId

transferredFrom

public DTNHost transferredFrom
Constructor Detail

TestDTNHost

public TestDTNHost()
Method Detail

connect

public void connect(DTNHost anotherHost)
Description copied from class: DTNHost
Creates a connection to another host (if it is within range)

Overrides:
connect in class DTNHost

update

public void update()
Description copied from class: DTNHost
Updates node's network layer and router.

Overrides:
update in class DTNHost

receiveMessage

public int receiveMessage(Message m,
                          DTNHost from)
Description copied from class: DTNHost
Start receiving a message from another host

Overrides:
receiveMessage in class DTNHost
Parameters:
m - The message
from - Who the message is from
Returns:
The value returned by MessageRouter.receiveMessage(Message, DTNHost)

messageAborted

public void messageAborted(java.lang.String id,
                           DTNHost from,
                           int bytesRemaining)
Description copied from class: DTNHost
Informs the host that a message transfer was aborted.

Overrides:
messageAborted in class DTNHost
Parameters:
id - Identifier of the message
from - From who the message was from
bytesRemaining - Nrof bytes that were left before the transfer would have been ready; or -1 if the number of bytes is not known

messageTransferred

public void messageTransferred(java.lang.String id,
                               DTNHost from)
Description copied from class: DTNHost
Informs the host that a message was successfully transferred.

Overrides:
messageTransferred in class DTNHost
Parameters:
id - Identifier of the message
from - From who the message was from