input
stringlengths 10
828
| output
stringlengths 5
107
|
|---|---|
private void connect nodes in cells dtnhost node grid cell cells for int i 0 i cells length i list dtnhost list cells i get nodes for int j 0 n list size j n j node connect list get j
|
connects a node to all other nodes in a cell array
|
public boolean equals coord c if c this return true else return x c x y c y
|
checks if this coordinates location is equal to other coordinates
|
public void warmup movement model double time if time 0 return while sim clock get time update interval move hosts update interval sim clock advance update interval double final step sim clock get time move hosts final step sim clock set time 0
|
moves hosts in the world for the time given time initialize host
|
public void advance double time clock time time
|
advances the time by n seconds
|
public void change zoom int delta int new index zoom chooser get selected index delta if new index 1 new index 1 max zoom level is not accessible trough this if new index zoom levels length new index zoom levels length 1 this zoom chooser set selected index new index this update zoom scale true
|
changes the zoom level
|
public int hash code return x y hash code
|
returns a hash code for this coordinate
|
public void set time double time clock time time
|
sets the time of the clock
|
public string to string return sim time clock time
|
returns the current simulation time in a string
|
public int compare to coord other if this y other y return 1 else if this y other y return 1 else if this x other x return 1 else if this x other x return 1 else return 0
|
compares this coordinate to other coordinate
|
public string to string return get class get simple name of size this cols x this rows cell size this cell size
|
returns a string representation of the connectivity cells object
|
public void set next event queue event queue next queue scheduled updates double earliest next queue next events time find the queue that has the next event for event queue eq event queues if eq next events time earliest next queue eq earliest eq next events time this next event queue next queue this next queue event time earliest
|
goes through all event queues and sets the
|
public dtnhost get from return this from
|
returns the node this message is originally from
|
public void add node dtnhost node this nodes add node
|
adds a node to this cell
|
public dtnhost get to return this to
|
returns the node this message is originally to
|
private void ensure positive value double value string setting name if value 0 throw new settings error negative value value not accepted for setting setting name
|
makes sure that a value is positive
|
public void move node dtnhost node grid cell to to add node node boolean remove ok this nodes remove node assert remove ok node node not found from cell with nodes to string
|
moves a node in a cell to another cell
|
public void action performed action event e jbutton source jbutton e get source if source get client property host prop null button was a host button focus it on gui gui set focus dtnhost source get client property host prop else if source get client property msg prop null was a message button show information about the message message m message source get client property msg prop gui get info panel show info m
|
action listener for log entry host message buttons
|
public int get unique id return this unique id
|
returns an id that is unique per message instance
|
public string to string return get class get simple name with this nodes size nodes this nodes
|
returns a string representation of the cell
|
private void update hosts if this update order null randomizing is off for int i 0 n hosts size i n i hosts get i update else update order randomizing is on assert this update order size this hosts size nrof hosts has changed unexpectedly random rng new random sim clock get int time collections shuffle this update order rng for int i 0 n hosts size i n i this update order get i update
|
updates all hosts calls update for every one of them
|
public boolean simulate connections return this simulate connections
|
returns true if connections should be simulated
|
public void add node on path dtnhost node this path add node
|
adds a new node on the list of nodes this message has passed
|
public boolean is active return this movement is active
|
returns true if this node is active false if not
|
private void move hosts double time increment for int i 0 n hosts size i n i dtnhost host hosts get i host move time increment if con grid null con grid update location host
|
moves all hosts in the world for a given amount of time
|
public int get hop count return this path size 1
|
returns the amount of hops this message has passed
|
public int get world size x return this world size x
|
returns the width of the world
|
public int get ttl if this init ttl infinite ttl return integer max value else return int this init ttl 60 sim clock get time this time created 60 0
|
returns the time to live minutes of the message or integer
|
private void update zoom scale boolean center view string sel string this zoom chooser get selected item to string double scale double parse double sel string if center view coord center gui get center view coord this pf set scale scale gui center view at center else this pf set scale scale
|
updates zoom scale to the one selected by zoom chooser
|
private void set router message router router router init this msg listeners this router router
|
set a router for this host
|
public int get world size y return world size y
|
returns the height of the world
|
public void set ttl int ttl this init ttl ttl
|
sets the initial ttl time to live for this message
|
public message router get router return this router
|
returns the router of this host
|
public double get transmit range return this transmit range
|
returns the transmit range of this network layer
|
public void cancel sim this is cancelled true
|
asynchronously cancels the currently running simulation
|
public void set receive time double time this time received time
|
sets the time when this message was received
|
public double get update interval return update interval
|
returns update interval simulated seconds of the simulation
|
public int get transmit speed return this transmit speed
|
returns the transmit speed of this network layer
|
public int get address return this net get address
|
returns the network layer address of this host
|
public boolean is up return this is up
|
returns true if the connection is up
|
public double get receive time return this time received
|
returns the time when this message was received
|
public boolean is initiator dtnhost node return node this from node
|
returns true if the given node is the initiator of the connection false
|
public int get size x return this size x
|
returns the x size width of the world
|
public double get max host range return max host range
|
returns how long range the hosts radios have
|
public void set up state boolean state this is up state
|
sets the state of the connection
|
public double get transmit range return this net get transmit range
|
returns the transmit range of this hosts radio
|
public double get creation time return this time created
|
returns the time when this message was created
|
public int start transfer dtnhost from message m assert this msg on fly null already transferring this msg on fly from this msg from node to this get other node this msg from node can t start transfer of m from from this msg from node from message new message m replicate int ret val get other node from receive message new message from if ret val message router rcv ok this msg on fly new message this transfer done time sim clock get time 1 0 m get size this speed return ret val
|
sets a message that this connection is currently transferring
|
public void connect dtnhost another host if is scanning return if another host is active is within range another host create connection another host
|
tries to connect this host to another host
|
public void abort transfer assert msg on fly null no message to abort at msg from node int bytes remaining get remaining byte count this bytes transferred msg on fly get size bytes remaining get other node msg from node message aborted this msg on fly get id msg from node bytes remaining clear msg on fly this transfer done time 0 transfer is ready
|
aborts the transfer of the currently transferred message
|
public sim map get map return this sim map
|
returns the sim map this scenario uses or null if scenario doesnt
|
public double get transfer done time return this transfer done time
|
returns the time when the current transfer is done
|
public int get size y return this size y
|
returns the y size height of the world
|
public int get transmit speed return this net get transmit speed
|
returns the transmit speed of this hosts radio
|
public void set request message request this request msg request
|
if this message is a response to a request sets the request message
|
public void create connection dtnhost another host int con speed if is connected another host return already connected connection speed is the lower one of the two speeds con speed another host get transmit speed if con speed this transmit speed con speed this transmit speed connection con new connection this host another host con speed this connections add con notify connection listeners con up another host set up bidirectional connection another host get connections add con inform routers about the connection this host changed connection con another host changed connection con
|
creates a connection to another host
|
public int get remaining byte count int remaining if msg on fly null return 0 remaining int this transfer done time sim clock get time this speed return remaining 0 remaining 0
|
returns the amount of bytes to be transferred before ongoing transfer
|
public void add connection listener connection listener cl this connection listeners add cl
|
adds a new connection listener for all nodes
|
private void clear msg on fly this msg on fly null this msg from node null
|
clears the message that is currently being transferred
|
public void destroy connection dtnhost another host for int i 0 i this connections size i if this connections get i get other node this host another host remove connection by index i the connection didn t exist do nothing
|
disconnect a connection between this and another host
|
public void finalize transfer assert this msg on fly null nothing to finalize in this this bytes transferred msg on fly get size get other node msg from node message transferred this msg on fly get id msg from node clear msg on fly
|
finalizes the transfer of the currently transferred message
|
public module communication bus get com bus return this com bus
|
returns this hostss module communication bus
|
public dtnhost get node by address int address if address 0 address hosts size throw new sim error no host for address address address range of 0 hosts size 1 is valid dtnhost node this hosts get address assert node get address address node indexing failed node node in index address return node
|
returns a node from the world by its address
|
private void remove connection by index int index connection con this connections get index dtnhost another node con get other node this host con set up state false notify connection listeners con down another node tear down bidirectional connection if another node get connections remove con throw new sim error no connection con found in another node this host changed connection con another node changed connection con connections remove index
|
removes a connection by its position index in the connections array
|
public boolean is message transferred return get remaining byte count 0
|
returns true if the current message transfer is done
|
public double get double if xm 1 return double positive infinity double x do x xm math pow 1 rng next double 1 k while x max value return x
|
returns a pareto distributed double value
|
public void update for int i 0 i this connections size connection con this connections get i dtnhost another node con get other node this host all connections should be up at this stage assert con is up connection con was down if is within range another node remove connection by index i else i
|
updates the state of current connections i
|
public boolean is ready for transfer return this is up this msg on fly null
|
returns true if the connection is ready to transfer a message connection
|
public boolean is response return this request msg null
|
returns true if this message is a response message
|
public void changed connection connection con this router changed connection con
|
informs the router of this host about state change in a connection
|
public void add movement listener movement listener ml this movement listeners add ml
|
adds a new movement listener for all nodes
|
public message get message return this msg on fly
|
gets the message that this connection is currently transferring
|
private boolean is within range dtnhost another host double smaller range another host get transmit range if this transmit range smaller range smaller range this transmit range return this host get location distance another host get location smaller range
|
returns true if another node is within radio range of this node
|
public int get total bytes transferred if this msg on fly null return this bytes transferred else if is message transferred return this bytes transferred this msg on fly get size else return this bytes transferred msg on fly get size get remaining byte count
|
returns the total amount of bytes this connection has transferred so far
|
private boolean is connected dtnhost node for int i 0 i this connections size i if this connections get i get other node this host node return true return false
|
returns true if the given dtnhost is connected to this host
|
public void set response size int size this response size size
|
sets the requested response messages size
|
public coord get location return this location
|
returns the current location of this host
|
public void add update listener update listener ul this update listeners add ul
|
adds a new update listener for the world
|
public dtnhost get other node dtnhost node if node this from node return this to node else return this from node
|
returns the node in the other end of the connection
|
private void notify connection listeners int type dtnhost other host if this c listeners null return for connection listener cl this c listeners switch type case con up cl hosts connected this host other host break case con down cl hosts disconnected this host other host break default assert false type invalid type code
|
notifies all the connection listeners about a change in connections
|
public void set creation time double creation time this time created creation time
|
sets the time created property of this message
|
public void module value changed string key object new value if key equals scan interval id this scan interval double new value else if key equals speed id this transmit speed integer new value else if key equals range id this transmit range double new value else throw new sim error unexpected combus id key
|
this method is called by the
|
public string to string return from node to node speed bps is is up up down this msg on fly null transferring this msg on fly from this msg from node until this transfer done time
|
returns a string presentation of the connection
|
public int get response size return response size
|
returns the size of the requested response message or 0 if no response
|
public string to string return net layer of this host connections this connections
|
returns a string representation of the object
|
public grid cell get cur cell return this cur cell
|
return the current cell set by the set cur cell method
|
public void process event world world dtnhost to world get node by address this to addr dtnhost from world get node by address this from addr message m new message from to this id this size m set response size this response size from create new message m
|
creates the message this event represents
|
public void add property string key object value throws sim error if this values null this values contains key key check to prevent accidental name space collisions throw new sim error a value for the key key already exists this update property key value
|
adds a new property for this node
|
public object get property string key if this values null return null return this values get key
|
returns an object that was stored using the given key
|
public void process event world world get dtnhosts and pass messages between them dtnhost from world get node by address this from addr dtnhost to world get node by address this to addr switch stage case sending from send message id to break case transferred to message transferred id from break case aborted to message aborted id from 1 break default assert false invalid stage stage for this
|
relays the message
|
public void update property string key object value throws sim error if this values null lazy creation to prevent performance overhead for classes that don t use the property feature this values new hash map string object this values put key value notify listeners key value
|
updates a value for an existing property
|
public void set cur cell grid cell c this cur cell c
|
sets the current cell for cell based connection checking
|
public double update double string key double delta throws sim error double current try current double get property key update property key current delta catch class cast exception cce throw new sim error no double value for key key catch null pointer exception npe throw new sim error no value for key key return current delta
|
changes the double value with given key with the value delta
|
public double get double string key double na value throws sim error object value this get property key if value null return na value try return double value catch class cast exception cce throw new sim error no double value for key key
|
returns a double value from the communication bus
|
protected void copy from message m this path new array list dtnhost m path this time created m time created this response size m response size this request msg m request msg this init ttl m init ttl if m properties null set string keys m properties key set for string key keys update property key m get property key
|
deep copies message data from other message
|
protected void init reader input set done false reader new buffered reader input
|
initialize the reader to use a certain input reader
|
public void subscribe string key module communication listener module if this listeners null first listener for the whole node this listeners new hash map string list module communication listener list module communication listener list this listeners get key if list null first listener for this key list new array list module communication listener init capacity this listeners put key list list add module
|
subscribes a module to changes of a certain value
|
public void set location coord location this location location clone
|
sets the nodes location overriding any location set by movement model
|
public void set name space string namespace this old namespaces push this namespace this namespace namespace
|
sets the namespace to something else than the current namespace
|
public void add property string key object value throws sim error if this properties null this properties contains key key check to prevent accidental name space collisions throw new sim error message this already contains value for a key key this update property key value
|
adds a generic property for this message
|
public void unsubscribe string key module communication listener module list module communication listener list if this listeners null return no subscriptions list this listeners get key if list null return no subscriptions for the key list remove module
|
removes a notification subscription
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.