input stringlengths 10 828 | output stringlengths 5 107 |
|---|---|
private void find next throws ioexception string line this buffer this first line if line null int size line length for int i this next char i size i if line char at i this next token col i return this next token line 1 this next token col 1 while line this file reader read line null int size line length for int i 0 i size i if line char at i this next token col i this next token line this append line line return this append line line | finds the position of the next token to be read |
private int append line string string if this lines count 0 this first line 0 if this first line this lines count this buffer length string src this buffer if this lines count this buffer length this buffer new string 2 this buffer length system arraycopy src this first line this buffer 0 this lines count this next token line this first line this first line 0 buffer this first line this lines count string this lines count return this first line this lines count 1 | puts a line read from the file to the buffer |
public permission get permission linked list limitation limitations list new linked list limitation if this depth check is selected limitations list add this depth limitation if this stamina check is selected limitations list add this stamina limitation if this speed check is selected limitations list add this speed limitation if this acceleration check is selected limitations list add this acceleration limitation limitation limitations new limitation limitations list size for int i 0 i limitations length i limitations i limitations list get i this permission set limitations limitations return this permission | returns the permission object configured by the gui |
private void init components2 graph graph this graph graph this label field set text graph get label this vertex panel new node jpanel this graph this tabbed panel set component at 0 this vertex panel this node panel new edge jpanel this graph this tabbed panel set component at 1 this node panel this xml area set text this graph full to xml 0 actual panel 0 | complements the initiation of the components of the gui |
protected void label field key released key event evt graph set label label field get text | executed when the label field is modified |
private void ok button action performed java awt event action event evt string myname graph get label if actual panel 0 this graph this vertex panel get graph if actual panel 1 this graph this node panel get graph if this get owner null this graph set label myname editor this get owner set graph this graph this dispose | executed when the ok button is pressed |
private void cancel button action performed java awt event action event evt this dispose | executed when the cancel button is pressed |
private void tabbed panel state changed javax swing event change event evt string myname graph get label if actual panel 0 this graph this vertex panel get graph if actual panel 1 this graph this node panel get graph graph set label myname this xml area set text this graph full to xml 0 actual panel this tabbed panel get selected index switch actual panel case 0 this vertex panel refresh graph this graph break case 1 this node panel refresh graph this graph break default break | executed when the tabbed panel changes |
public void mod edge string edge id this graph this vertex panel get graph this tabbed panel set selected index 1 actual panel 1 this node panel refresh graph this graph edge id | called by the vertex panel buttons add edge and modify edge |
private void init components speed limitation limitation this limitation limitation this speed field set text string value of this limitation get speed | complements the initiation of the components of the gui |
private void init components acceleration limitation limitation this limitation limitation this acceleration field set text string value of this limitation get acceleration | complements the initiation of the components of the gui |
public limitation get limitation return this limitation | returns the limitation configured by the gui |
private void init components depth limitation limitation this limitation limitation this depth spinner set value new integer limitation get depth | complements the initiation of the components of the gui |
private void init components stamina limitation limitation this limitation limitation this cost field set text string value of this limitation get cost | complements the initiation of the components of the gui |
public string get next line throws ioexception string next line logfile read line if next line null return if next line contains graph string continue line logfile read line while continue line contains graph next line continue line continue line logfile read line next line continue line return next line if next line contains society string continue line logfile read line while continue line contains society next line continue line continue line logfile read line next line continue line return next line return next line | reads the next line |
public void set speed double speed elapsed time new date get time last speed change replay speed replay speed speed last speed change new date get time mycanvas update rtdelay int 1000 replay speed no speed check 0 | changes the replay speed |
public void stop working this stop working true | indicates that the client must stop working |
protected void configure environment string events for string event events try if graph null societies null return if event contains graph event contains society continue else event environment event environment element first str translator parse string event if graph null graph graph translator get graphs first str 0 else societies society translator get societies first str graph catch parser configuration exception e todo auto generated catch block e print stack trace catch saxexception e todo auto generated catch block e print stack trace catch ioexception e todo auto generated catch block e print stack trace | translates the beginning of the file stream into the simulation environment |
protected boolean manage events string events throws exception boolean skip false for string event events try element my event manage event event string turn val my event get attribute time incoming turn double value of turn val int value string skip txt my event get attribute skip skip boolean value of skip txt catch parser configuration exception e todo auto generated catch block e print stack trace catch saxexception e todo auto generated catch block e print stack trace catch ioexception e todo auto generated catch block e print stack trace return skip | manages a list of events as read in the file stream |
public void configure canvas reset of the variables turn 0 time 0 mytimer new my timer if application logger get type contains replay display speed true else display speed false if application logger get type contains turn display turn true else display turn false | configures the display from the log type |
public void add drawable idrawable d if d get type agent agents add d else if d get type node nodes add d else edges add d repaint | adds a idrawable to the display |
public void remove drawable idrawable d if d get type agent agents remove d else if d get type node nodes remove d else edges remove d repaint | removes a idrawable to the display |
public void clear agents clear nodes clear edges clear repaint | clears the display of all the idrawables |
public list find nodes point p list l new array list for iterator iter nodes iterator iter has next idrawable element idrawable iter next if element get rectangle contains p l add element return l | finds all the idrawables that have the point p in their drawing rectangle |
public void update drawables list modified nodes new linked list for iterator iter nodes iterator iter has next idrawable element idrawable iter next if node circle element is modified modified nodes add element for iterator iter agents iterator iter has next idrawable element idrawable iter next agent triangle element update agent nodes for iterator iter edges iterator iter has next idrawable element idrawable iter next edge line element update edge modified nodes for iterator iter modified nodes iterator iter has next idrawable element idrawable iter next node circle element set modified false | updates the idrawables |
public void update time for iterator iter nodes iterator iter has next node circle element node circle iter next element increment timer 1 turn 1 | updates the internal timer of nodes and increments the turn |
public void update time int i for iterator iter nodes iterator iter has next node circle element node circle iter next element increment timer i turn i | updates the internal timer of nodes and increments the turn |
public void correct rttime double t time t | forces the canvas clock to t |
public void update rtdelay int d for iterator iter nodes iterator iter has next node circle element node circle iter next element change timer d mytimer set initial delay d 2 mytimer set delay d 2 | changes the speed of the timers of the visual objects to |
public void start nodes for iterator iter nodes iterator iter has next node circle element node circle iter next element start timer mytimer start | starts the timers of the nodecircles and the canvas |
public void restart nodes for iterator iter nodes iterator iter has next node circle element node circle iter next element reset timer mytimer restart | resets and restarts the timers of the nodecircles and the canvas |
public void pause nodes for iterator iter nodes iterator iter has next node circle element node circle iter next element stop timer mytimer stop | stops the timers of the nodecircles and the canvas |
private void initialize2 jdialog owner graph graph this owner owner this graph graph this node graph get nodes this edges graph get edges this directed new boolean edges length for int i 0 i edges length i if edges i get source is target of edges i edges i get source is target of edges i edges i get target is target of edges i edges i get target is source of edges i directed i false else directed i true if edges length 0 populate edges selected edge 0 edge selected 0 change from ui true | complements the initiation of the components of the gui |
public void page complete boolean complete true complete file path get text content equals if logger type get selection index 0 complete ip adress get text content equals complete port get text content equals set page complete complete | checks if the fields are completed |
public void refresh graph graph graph initialize2 owner graph | is called to refresh the graph |
public void mouse dragged mouse event e if drawable null drawable move to e get point node circle drawable set modified true canvas update drawables canvas repaint | moves the idrawable and set it to modified |
public void mouse pressed mouse event e list selected drawables canvas find nodes e get point if selected drawables size 0 return drawable idrawable selected drawables get 0 | selects the idrawable thats under the mouse when clicked |
public void mouse released mouse event e if drawable null drawable move to e get point node circle drawable set modified true drawable null canvas update drawables canvas repaint | unselects the idrawable after setting it to modified then |
public void refresh graph graph graph string edge id change from ui false if edge id for int i 0 i edges length i if edges i get object id edge id selected edge i else addedge buttonaction performed new action event owner 0 edge id edge selected selected edge change from ui true | is called to refresh the graph and choose create an edge |
public void close if this out null this out close this out null | closes the file |
public void print char c this out print string value of c | writes the given character into the file |
public void print string string this out print string | writes the given string into the file |
public void print int i this out print i | writes the given integer value into the file |
public void print double d this out print d | writes the given double value into the file |
public void print double d int dec this out print this format double d dec | writes the given double into the file respecting the given number of |
public void println this out println | writes a new line into the file |
public void println char c this out println string value of c | writes the given character and a new line into the file |
public void println string string this out println string | writes the given string and a new line into the file |
private void populate edges int nrow default table model this edge table get model get row count for int i 0 i nrow i default table model this edge table get model remove row 0 for int i 0 i edges length i string content edges i get object id edges i get source get object id edges i get target get object id default table model this edge table get model add row content | this function populates the edge table from the edge list |
public void println int i this out println i | writes the given integer value and a new line into the file |
public void println double d this out println d | writes the given double value and a new line into the file |
public void println double d int dec this out println this format double d dec | writes the given double respecting the given number of decimal places |
public void flush this out flush | saves the data from the buffer of the file to the disk |
private string format double double d int dec if dec 0 return string value of math round d string buffer res new string buffer long aprox int math round d math pow 10 dec if d 0 aprox aprox res append string num string value of aprox int n num length dec if n 0 res append 0 for int i 0 i n i res append 0 res append num else char array num to char array res append array 0 n append append array n dec return res to string | returns the string that represents the given double rounded by the given |
private void edge selected edge selected this edge table get selected row | this function calls the next one using the selected |
public string get remote socket adress string complete address this socket get remote socket address to string int socket index complete address index of return complete address substring 1 socket index | returns the socket address of the remote contact in ip format |
public void stop working throws ioexception super stop working this output close this input close this socket close | indicates that the connection must stop working |
public void send string message throws ioexception this output println message this output flush | sends a given string message to the remote contact |
protected void receive throws ioexception string buffer buffer new string buffer string message line null do try message line this input read line if message line null buffer append message line if buffer index of perception 1 break else if buffer index of perception 1 buffer index of message 1 buffer index of 1 break else this stop working catch interrupted ioexception e break catch ioexception e break while true if buffer length 0 this buffer insert buffer to string | implements the receiving of a message |
public void stop working throws ioexception this stop working true | indicates that the connection must stop working |
public void send string message throws ioexception datagram packet packet new datagram packet message get bytes message length this remote socket address this remote socket number this socket send packet | sends a given string message to the remote contact |
protected void receive throws ioexception byte buffer new byte buffer size datagram packet packet new datagram packet buffer buffer length this socket receive packet this buffer insert new string packet get data 0 packet get length | implements the receiving of a message |
public boolean add agent agent agent return agents add agent | adds a given agent to the society |
public void set edge edge edge double elapsed length this edge edge this elapsed length elapsed length | configures the edge of the agent as well as its position on it |
private void set birth tpd dynamic edge selected event time probability distribution chosen birth tpd selected get enabling tpd if chosen birth tpd null this enabtpd combo set selected index 0 else if chosen birth tpd instanceof uniform event time probability distribution this enabtpd combo set selected index 1 else if chosen birth tpd instanceof empirical event time probability distribution this enabtpd combo set selected index 2 else if chosen birth tpd instanceof normal event time probability distribution this enabtpd combo set selected index 3 else this enabtpd combo set selected index 4 | sets the combobox for the birth time probability distribution |
private void set death tpd dynamic edge selected event time probability distribution chosen death tpd selected get disabling tpd if chosen death tpd null this disabltpd combo set selected index 0 else if chosen death tpd instanceof uniform event time probability distribution this disabltpd combo set selected index 1 else if chosen death tpd instanceof empirical event time probability distribution this disabltpd combo set selected index 2 else if chosen death tpd instanceof normal event time probability distribution this disabltpd combo set selected index 3 else this disabltpd combo set selected index 4 | sets the combobox for the death time probability distribution |
public edge get copy node copy emitter node copy collector registers if the original edge is oriented boolean oriented this emitter is collector of this the copy edge copy edge new edge copy emitter copy collector oriented this length this id returns the answer return copy edge | obtains a copy of the edge with the given copies of nodes |
private void init components2 jdialog owner graph graph this owner owner this graph graph this node graph get nodes populate node change from ui true | complements the initiation of the components of the gui |
public boolean has node node node object nodes array this nodes to array for int i 0 i nodes array length i if node nodes array i equals node return true return false | verifies if the given node is part of the graph |
public void refresh graph graph graph init components2 owner graph | is called to refresh the graph |
public boolean has edge edge edge if this edges null object edges array this edges to array for int i 0 i edges array length i if edge edges array i equals edge return true return false | verifies if the given edge is part of the graph |
private void populate node int nrow default table model this node table get model get row count for int i 0 i nrow i default table model this node table get model remove row 0 for int i 0 i node length i string content node i get object id default table model this node table get model add row content | this function populates the node table from the node list |
public double get distance node node 1 node node 2 if distances table null distances table is empty this calculate distances for int i 0 i distances table size i if distances table get i node equals node 1 list node with distance list distances table get i distances list for int j 0 j list size j if list get j node equals node 2 return list get j distance return double max value | returns for two given nodes the distance between them |
private void node selected node selected this node table get selected row | this function calls the next one using the selected |
private node get node string id object nodes array this nodes to array for int i 0 i nodes array length i node current node node nodes array i if current node get object id equals id return current node return null | returns the node of the graph that has the given id |
private void set birth tpd dynamic node selected event time probability distribution chosen birth tpd selected get enabling tpd if chosen birth tpd null this enabtpd combo set selected index 0 else if chosen birth tpd instanceof uniform event time probability distribution this enabtpd combo set selected index 1 else if chosen birth tpd instanceof empirical event time probability distribution this enabtpd combo set selected index 2 else if chosen birth tpd instanceof normal event time probability distribution this enabtpd combo set selected index 3 else this enabtpd combo set selected index 4 | sets the combobox for the birth time probability distribution |
private edge get edge string id if this edges null object edges array this edges to array for int i 0 i edges array length i edge current edge edge edges array i if current edge get object id equals id return current edge return null | returns the edge of the graph that has the given id |
public boolean equals graph graph if graph null if graph label equals this label return false node nodes graph get nodes for int i 0 i nodes length i node node this get node nodes i get object id if node null node get idleness nodes i get idleness return false edge edges graph get edges for int i 0 i edges length i edge edge this get edge edges i get object id if edge null return false return true return false | compares a given graph to this one |
private void set death tpd dynamic node selected event time probability distribution chosen death tpd selected get disabling tpd if chosen death tpd null this disabltpd combo set selected index 0 else if chosen death tpd instanceof uniform event time probability distribution this disabltpd combo set selected index 1 else if chosen death tpd instanceof empirical event time probability distribution this disabltpd combo set selected index 2 else if chosen death tpd instanceof normal event time probability distribution this disabltpd combo set selected index 3 else this disabltpd combo set selected index 4 | sets the combobox for the death time probability distribution |
protected void removenode buttonaction performed action event e int vnum node length node new node new node vnum 1 for int i 0 i selected node i new node i node i for int i selected node 1 i vnum i new node i 1 node i node new node populate node node selected 0 | removes a node from the list and refreshes the gui |
public void set idleness int idleness this idleness idleness | configures the idleness of the node |
public int get idleness return this idleness | returns the idleness of the node |
public boolean is collector of edge edge return this in edges contains edge | verifies if the node is the collector of a given edge |
public boolean is emitter of edge edge return this out edges contains edge | verifies if the node is the emitter of a given edge |
protected void addnode buttonaction performed action event e int vnum node length node new node new node vnum 1 for int i 0 i vnum i new node i node i new node vnum new node n vnum 1 new node vnum set object id n vnum 1 long to hex string system current time millis node new node populate node | add a node to the list and refreshes the gui |
public node get copy node answer new node this label answer id this id answer priority this priority answer idleness this idleness answer fuel this fuel return answer | returns a copy of the node with no edges |
protected void removeedge buttonaction performed action event evt edge del edge node selected node get edges edge table get selected row synchronized node selected node del edge get other node node selected node remove edge del edge get object id node selected node remove edge del edge get object id node selected selected node | removes an edge |
public node get vertex return this goal vertex | returns the goal vertex of the movement |
public node get vertex return this vertex | returns the goal vertex of the teleport |
protected void modifyedge buttonaction performed action event evt edge del edge node selected node get edges edge table get selected row graph gui owner mod edge del edge get object id | opens the edge gui to modify the selected edge |
private void initialize this set size new dimension 500 400 this set resizable true this set jmenu bar get jjmenu bar this set title visua log this set default close operation jframe exit on close this init components | this method initializes this |
private jmenu get file menu if file menu null file menu new jmenu file menu set text commands file menu add get setup wizard file menu add get close return file menu | this method initializes file menu |
private jmenu item get setup wizard if setup wizard null setup wizard new jmenu item setup wizard set text setup setup wizard add action listener this return setup wizard | this method initializes open file |
protected void enable checkaction performed action event evt if node selected node null dynamic node node selected node set is enabled enable check is selected | manages the enabled property |
protected void visible checkaction performed action event e if node selected node null dynamic node node selected node set visibility visible check is selected | manages the visible property |
protected void fuel fieldaction performed action event evt if node selected node null if fuel field get selected index 0 node selected node set fuel false else node selected node set fuel true | manages the fuel property |
public void configure canvas reset of the variables turn 0 time 0 mytimer new my timer if visua log visualog get logger get type contains replay display speed true else display speed false if visua log visualog get logger get type contains turn display turn true else display turn false | configures the display from the log type |
protected void priority field key released key event evt if node selected node null node selected node set priority integer value of priority field get text | manages the priority property |
private void label field key released key event evt if node selected node null node selected node set label label field get text | manages the label property |
public void page complete boolean complete true complete file path get text content equals if logger type get selected index 0 complete ip adress get text content equals complete port get text content equals validate set enabled complete set page complete complete | checks if the fields are completed |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.