|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcore.DTNHost
public class DTNHost
A DTN capable host.
Constructor Summary | |
---|---|
DTNHost(java.util.List<ConnectionListener> conLs,
java.util.List<MessageListener> msgLs,
java.util.List<MovementListener> movLs,
java.lang.String groupId,
double transmitRange,
int transmitSpeed,
MovementModel mmProto,
MessageRouter mRouterProto)
Creates a new DTNHost. |
Method Summary | |
---|---|
void |
changedConnection(Connection con)
Informs the router of this host about state change in a connection object. |
int |
compareTo(DTNHost h)
Compares two DTNHosts by their addresses. |
void |
connect(DTNHost anotherHost)
Creates a connection to another host (if it is within range) |
void |
createNewMessage(Message m)
Creates a new message to this host's router |
void |
deleteMessage(java.lang.String id,
boolean drop)
Deletes a message from this host |
boolean |
equals(DTNHost otherHost)
Checks if a host is the same as this host by comparing their names. |
void |
forceConnection(DTNHost anotherHost,
boolean up)
Forces this host to connect/disconnect to/from another host. |
int |
getAddress()
Returns the network-layer address of this host. |
double |
getBufferOccupancy()
Returns the buffer occupancy percentage. |
java.util.List<Connection> |
getConnections()
Returns a list of connections this host has with other hosts |
ConnectivityGrid.GridCell |
getCurCell()
Return the "current cell" set by the setCurCell method (for cell based connection checking). |
Coord |
getLocation()
Returns the current location of this host. |
java.util.Collection<Message> |
getMessageCollection()
Returns the messages in a collection. |
int |
getNrofMessages()
Returns the number of messages this node is carrying. |
Path |
getPath()
Returns the Path this node is currently travelling or null if no path is in use at the moment. |
MessageRouter |
getRouter()
Returns the router of this host |
RoutingInfo |
getRoutingInfo()
Returns routing info of this host's router. |
double |
getTransmitRange()
Returns the transmit range of this host's radio |
int |
getTransmitSpeed()
Returns the transmit speed of this host's radio |
boolean |
isActive()
Returns true if this node is active (false if not) |
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. |
void |
move(double timeIncrement)
Moves the node towards the next waypoint or waits if it is not time to move yet |
int |
receiveMessage(Message m,
DTNHost from)
Start receiving a message from another host |
boolean |
requestDeliverableMessages(Connection con)
Requests for deliverable message from this host to be sent trough a connection. |
void |
sendMessage(java.lang.String id,
DTNHost to)
Sends a message from this host to another host |
void |
setCurCell(ConnectivityGrid.GridCell c)
Sets the "current cell" (for cell based connection checking). |
void |
setLocation(Coord location)
Sets the Node's location overriding any location set by movement model |
void |
setName(java.lang.String name)
Sets the Node's name overriding the default name (groupId + netAddress) |
java.lang.String |
toString()
Returns a string presentation of the host. |
void |
update()
Updates node's network layer and router. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public DTNHost(java.util.List<ConnectionListener> conLs, java.util.List<MessageListener> msgLs, java.util.List<MovementListener> movLs, java.lang.String groupId, double transmitRange, int transmitSpeed, MovementModel mmProto, MessageRouter mRouterProto)
conLs
- Connection listenersmsgLs
- Message listenersgroupId
- GroupID of this hosttransmitRange
- Transmit range of the host's radiotransmitSpeed
- Transmit speed of the host's radiommProto
- Prototype of the movement model of this hostmRouterProto
- Prototype of the message router of this hostMethod Detail |
---|
public boolean isActive()
public MessageRouter getRouter()
public int getAddress()
public double getTransmitRange()
NetworkLayer.getTransmitRange()
public int getTransmitSpeed()
NetworkLayer.getTransmitSpeed()
public void changedConnection(Connection con)
con
- The connection object whose state changedpublic java.util.List<Connection> getConnections()
public Coord getLocation()
public Path getPath()
public ConnectivityGrid.GridCell getCurCell()
public void setCurCell(ConnectivityGrid.GridCell c)
c
- The cell to setgetCurCell()
public void setLocation(Coord location)
location
- The location to setpublic void setName(java.lang.String name)
name
- The name to setpublic java.util.Collection<Message> getMessageCollection()
public int getNrofMessages()
public double getBufferOccupancy()
public RoutingInfo getRoutingInfo()
public void update()
public void move(double timeIncrement)
timeIncrement
- How long time the node movespublic void connect(DTNHost anotherHost)
anotherHost
- public void forceConnection(DTNHost anotherHost, boolean up)
anotherHost
- The host to connect to or disconnect fromup
- If true, the a new connection is created, if false, existing
connection is destroyed.public void sendMessage(java.lang.String id, DTNHost to)
id
- Identifier of the messageto
- Host the message should be sent topublic int receiveMessage(Message m, DTNHost from)
m
- The messagefrom
- Who the message is from
MessageRouter.receiveMessage(Message, DTNHost)
public boolean requestDeliverableMessages(Connection con)
con
- The connection to send the messages trough
public void messageTransferred(java.lang.String id, DTNHost from)
id
- Identifier of the messagefrom
- From who the message was frompublic void messageAborted(java.lang.String id, DTNHost from, int bytesRemaining)
id
- Identifier of the messagefrom
- From who the message was frombytesRemaining
- Nrof bytes that were left before the transfer
would have been ready; or -1 if the number of bytes is not knownpublic void createNewMessage(Message m)
m
- The message to createpublic void deleteMessage(java.lang.String id, boolean drop)
id
- Identifier of the messagedrop
- True if the message is deleted because of "dropping"
(e.g. buffer is full) or false if it was deleted for some other reason
(e.g. the message got delivered to final destination). This effects the
way the removing is reported to the message listeners.public java.lang.String toString()
toString
in class java.lang.Object
public boolean equals(DTNHost otherHost)
otherHost
- The other host
public int compareTo(DTNHost h)
compareTo
in interface java.lang.Comparable<DTNHost>
Comparable.compareTo(Object)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |