sidnet.stack.users.marco_project.image_charges.app
Class AppP2P_electrostatic

java.lang.Object
  extended by sidnet.stack.users.marco_project.image_charges.app.AppP2P_electrostatic
All Implemented Interfaces:
JistAPI.Proxiable, JistAPI.Timeless, AppInterface, CallbackInterface

public class AppP2P_electrostatic
extends java.lang.Object
implements AppInterface, CallbackInterface


Field Summary
static long ackSequenceNumber
           
 Treap activeCharges
           
 java.util.LinkedList<java.lang.Integer> activeRoutes
           
 short electrostaticIndex
           
 boolean estimatedSourceLocation
           
 Treap knownCharges
           
 java.util.LinkedList<java.lang.Integer> pendingRoutes
           
static long querySequenceNumber
           
static long rreqSequenceNumber
          Sequence numbers
 short shortestPathIndex
           
 Coordinate snk
           
 NetAddress snkIP
           
 Coordinate src
           
 NetAddress srcIP
           
static long updateSequenceNumber
           
 Query userQuery
           
 
Constructor Summary
AppP2P_electrostatic(Node myNode, short shortestPathIndex, short electrostaticIndex, StatsCollector stats, ExperimentDataImpl experimentData, TopologyGUI topologyGUI)
          Creates a new instance of the AppP2P
 
Method Summary
 double calculateMagnitude(Coordinate src, Coordinate snk)
           
 AppInterface getAppProxy()
          Return self-referencing APPLICATION proxy entity.
 void receive(Message msg, NetAddress src, MacAddress lastHop, byte macId, NetAddress dst, byte priority, byte ttl)
          On reception of a message, source/sink perform different tasks for different types of messages.
 void run()
          Run application.
 void run(java.lang.String[] args)
          This is your main execution loop at the Application Level.
 void selectFirstHops(int nrOfRoutes)
          Selects the first-hop nodes around a source node for specified number of routes.
 void sendMessage(Message msg)
          This methods handles the sending of DataMessages and RreqMessages via Electrostatic Routing.
 void sensing(java.util.List params)
          Periodically senses phenomena.
 void setNetEntity(NetInterface netEntity)
          Set network entity.
 void signalUserRequest()
          Handles reception of user-injected queries at the source node.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

shortestPathIndex

public short shortestPathIndex

electrostaticIndex

public short electrostaticIndex

rreqSequenceNumber

public static long rreqSequenceNumber
Sequence numbers


ackSequenceNumber

public static long ackSequenceNumber

updateSequenceNumber

public static long updateSequenceNumber

querySequenceNumber

public static long querySequenceNumber

snk

public Coordinate snk

snkIP

public NetAddress snkIP

pendingRoutes

public java.util.LinkedList<java.lang.Integer> pendingRoutes

activeRoutes

public java.util.LinkedList<java.lang.Integer> activeRoutes

userQuery

public Query userQuery

activeCharges

public Treap activeCharges

knownCharges

public Treap knownCharges

src

public Coordinate src

srcIP

public NetAddress srcIP

estimatedSourceLocation

public boolean estimatedSourceLocation
Constructor Detail

AppP2P_electrostatic

public AppP2P_electrostatic(Node myNode,
                            short shortestPathIndex,
                            short electrostaticIndex,
                            StatsCollector stats,
                            ExperimentDataImpl experimentData,
                            TopologyGUI topologyGUI)
Creates a new instance of the AppP2P

Parameters:
myNode -
shortestPathIndex -
electrostaticIndex -
stats -
Method Detail

run

public void run(java.lang.String[] args)
This is your main execution loop at the Application Level. Here you design the application functionality. It is simulation-time driven. The first call to this function is made automatically upon starting the simulation, from the Driver.

Specified by:
run in interface AppInterface
Parameters:
args -

run

public void run()
Description copied from interface: AppInterface
Run application.

Specified by:
run in interface AppInterface

sensing

public void sensing(java.util.List params)
Periodically senses phenomena. If userQuery is satisfied, a DataMessage is generated and sent via ElectrostaticRouting.

Specified by:
sensing in interface AppInterface
Parameters:
params -

selectFirstHops

public void selectFirstHops(int nrOfRoutes)
Selects the first-hop nodes around a source node for specified number of routes.

Parameters:
nrOfRoutes -

signalUserRequest

public void signalUserRequest()
Handles reception of user-injected queries at the source node. Callback registered with the terminal. The terminal will call this function whenever the user posts a new query or just closes the terminal window. You should inspect the myNode.localTerminalDataSet.getQueryList() to check for new posted queries that your node must act upon. Have a look at the TerminalDataSet.java for the available data that is exchanged between this node and the terminal

Specified by:
signalUserRequest in interface CallbackInterface

receive

public void receive(Message msg,
                    NetAddress src,
                    MacAddress lastHop,
                    byte macId,
                    NetAddress dst,
                    byte priority,
                    byte ttl)
On reception of a message, source/sink perform different tasks for different types of messages. This method dispatches the message handling.

Specified by:
receive in interface AppInterface
Parameters:
msg -
src -
lastHop -
macId -
dst -
priority -
ttl -

sendMessage

public void sendMessage(Message msg)
This methods handles the sending of DataMessages and RreqMessages via Electrostatic Routing. QueryMessages, AckMessages, and UpdateMessages and routed via ShortestPath.

Parameters:
msg -

calculateMagnitude

public double calculateMagnitude(Coordinate src,
                                 Coordinate snk)

setNetEntity

public void setNetEntity(NetInterface netEntity)
Set network entity.

Parameters:
netEntity - network entity

getAppProxy

public AppInterface getAppProxy()
Return self-referencing APPLICATION proxy entity.

Returns:
self-referencing APPLICATION proxy entity