input stringlengths 10 828 | output stringlengths 5 107 |
|---|---|
private void exit window window event evt this dispose if this button ok clicked new simulation configuration gui sim patrol gui this get parent set visible true | doesnt let the dialog window close |
private void port input state changed change event evt if integer this port input get value 0 this port input set value new integer 0 | executed when the port input changes |
private void logo panel mouse clicked mouse event evt todo | executed when the sim patrol logo is clicked |
private void cycled choice state changed change event evt boolean is selected this cycled choice is selected if this real time choice is selected is selected this real time choice set selected is selected | executed when the cycled simulation mode is chosen |
private void reset button action performed action event evt try this simulator stop simulation catch ioexception e joption pane show message dialog this io error ocurred the program will be closed io error joption pane error message e print stack trace traced io exception system exit 0 | executed when the reset button is clicked |
private void real time choice state changed change event evt boolean is selected this real time choice is selected if this cycled choice is selected is selected this cycled choice set selected is selected | executed when the real time simulation mode is chosen |
private void exit button action performed action event evt try this simulator exit catch ioexception e e print stack trace traced io exception system exit 0 | executed when the exit button is clicked |
private void create dynamicity controller robots obtains the dynamic objects dynamic dynamic objects this get dynamic objects if there are any dynamic objects if dynamic objects length 0 initiates the dynamic robots set this dynamic robots new hash set dynamicity controller robot for each one creates a dynamicity controller robot for int i 0 i dynamic objects length i this dynamic robots add new dynamicity controller robot dynamic objects i s dynamic robot s clock dynamic objects i else this dynamic robots null | obtains the dynamic objects and creates the respective dynamicity |
private void exit window window event evt try this simulator exit catch ioexception e e print stack trace traced io exception system exit 0 | exits the window and terminates the application |
private void create mortality controller daemons obtains the mortal objects mortal mortal objects this get mortal objects if there are any mortal objects if mortal objects length 0 initiates the mortal robots set this mortal robots collections synchronized set new hash set mortality controller robot for each one creates a mortality controller robot for int i 0 i mortal objects length i this mortal robots add new mortality controller robot mortal objects i s mortal robot s clock mortal objects i else this mortal robots null | obtains the mortal objects and creates the respective mortality |
private void start dynamicity controller robots if this dynamic robots null for dynamicity controller robot robot this dynamic robots robot start | starts each one of the current dynamicity controller robots |
public boolean all agents just acted for each society society societies this environment get societies for int i 0 i societies length i for each agent agent agents societies i get agents for int j 0 j agents length j if agents j get agent state agent states just acted return false default answer return true | verifies if all agents just acted |
public boolean all agents just perceived for each society society societies this environment get societies for int i 0 i societies length i for each agent agent agents societies i get agents for int j 0 j agents length j if agents j get agent state agent states just perceived return false default answer return true | verifies if all agents just perceived |
public void add perception daemon perception daemon perception daemon this perception daemons add perception daemon | adds a given perception daemon to the set of perception daemons |
private void start mortality controller robots if this mortal robots null for mortality controller robot robot this mortal robots robot start | starts each one of the current mortality controller robots |
public void lock agents perceptions boolean lock for perception daemon daemon this perception daemons daemon set is blocked lock | locks all the agents perceptions |
public void lock agents actions boolean lock for action daemon daemon this action daemons daemon set is blocked lock | locks or unlocks all the agents actions |
public perception daemon get perception daemon agent agent finds the perception daemon of which agent is the given one for perception daemon perception daemon this perception daemons if perception daemon get agent equals agent return perception daemon default answer return null | returns the perception daemon of which agent is the given one |
private void start stamina controller robots if this stamina robots null for stamina controller robot robot this stamina robots robot start | starts each one of the current stamina controller robots |
public void remove agent spent staminas agent agent this coordinator remove agent spent staminas agent | removes the eventual agent action spent stamina perception spent |
public void add action daemon action daemon action daemon this action daemons add action daemon | adds a given action daemon to the set of action daemons |
public void create and start mortality controler robot mortal object mortality controller robot robot new mortality controller robot object s mortal robot s clock object if this mortal robots null this mortal robots collections synchronized set new hash set mortality controller robot this mortal robots add robot robot start | creates and starts a mortality controller robot given its mortal object |
public action daemon get action daemon agent agent finds the action daemon of which agent is the given one for action daemon action daemon this action daemons if action daemon get agent equals agent return action daemon default answer return null | returns the action daemon of a given agent |
public void add metric daemon metric daemon metric daemon this metric daemons add metric daemon | adds a given metric daemon to the set of metric daemons |
private void stop and remove dynamicity controller robots if this dynamic robots null for dynamicity controller robot robot this dynamic robots robot stop acting this dynamic robots clear this dynamic robots null | stops and removes each one of the current dynamicity controller robots |
public void set environment environment environment this environment environment configures the eventual metrics of the patrolling task metric set environment this environment | configures the environment of the simulation |
private void stop and remove mortality controller robots if this mortal robots null for mortality controller robot robot this mortal robots robot stop acting this mortal robots clear this mortal robots null | stops each one of the current mortality controller robots |
public environment get environment return this environment | returns the environment of the simulation |
private void stop and remove stamina controller robots if this stamina robots null for stamina controller robot robot this stamina robots robot stop acting this stamina robots clear this stamina robots null | stops each one of the current stamina controller robots |
public double get update time rate return this update time rate | returns the time rate in seconds to update the internal model of the |
public void stop and remove mortality controller robot mortal object finds the mortality robot of the given object if this mortal robots null for mortality controller robot robot this mortal robots if robot get object equals object robot stop acting this mortal robots remove robot return | removes and stops the mortality controller robot that controls the given |
private void stop and remove perception daemons for each perception daemon stops it for perception daemon perception daemon this perception daemons perception daemon stop acting removes all perceptions daemons this perception daemons clear | stops and removes the perception daemons of the simulator |
public void stop and remove stamina controller robot agent agent finds the stamina robot of the given agent if this stamina robots null for stamina controller robot robot this stamina robots if robot get agent equals agent robot stop acting this stamina robots remove robot return | removes and stops the stamina controller robot that controls the given |
public agent get agent return this agent | returns the agent controlled by the robot |
private void stop and remove action daemons for each action daemon stops it for action daemon action daemon this action daemons action daemon stop acting removes all action daemons this action daemons clear | stops and removes the action daemons of the simulator |
public void set actions spent stamina double spent stamina this actions spent stamina spent stamina | configures how much stamina must be spent due to the execution of |
public double get actions spent stamina return this actions spent stamina | returns how much stamina must be spent due to the execution of compound |
public void set perceptions spent stamina double spent stamina this perceptions spent stamina spent stamina | configures how much stamina must be spent due to the production of |
private void stop and remove metric daemons for each metric daemon stops it for metric daemon metric daemon this metric daemons metric daemon stop acting removes all the metric daemons this metric daemons clear | stops and removes the metric daemons of the simulator |
public void start simulation double simulation time changes the state of the simulator this state simulator states simulating initiates the metrics controlled by the metric daemons for metric daemon metric daemon this metric daemons metric daemon start metric | starts the simulation |
public dynamic get object return object | returns the dynamic object controlled by this robot |
public void stop simulation throws ioexception stops and removes the perception daemons this stop and remove perception daemons stops and removes the the action daemons this stop and remove action daemons stops and removes the metric daemons this stop and remove metric daemons changes the state of the simulator this state simulator states configuring nullifies the environment this environment null resets the main daemon s connection this main daemon reset connection closes the eventual connections reserved for logging the events logger reset | stops the simulation |
public mortal get object return this object | returns the mortal object controlled by the robot |
public void exit throws ioexception if the simulator is simulating stops it if this state simulator states simulating this stop simulation stops the main daemon this main daemon stop acting | finishes the simulators work |
public double get elapsed time return system nano time this start time math pow 10 9 | returns the elapsed time of simulation measured in seconds |
public metric get metric return this metric | returns the metric of the configuration |
public double get simulation time return this simulation time | returns the time of simulation |
public double get cycle duration return this cycle duration | returns the duration in seconds of a cycle of measurement of the |
public void add item int socket number string agent id if this content null this content new linked list socket number and agent id this content add new socket number and agent id socket number agent id | adds the given socket number and correspondent agent id to the |
public string get society id return this society id | returns the id of the society where the new agent must be added |
public void start metric if this metric instanceof integral metric integral metric this metric start | starts the metric counting if the metric is an integral one |
private node get node string id for node node this nodes if node get object id equals id return node return null | returns the node of the graph that has the given id |
public void set is blocked boolean is blocked this is blocked is blocked | sets if this daemon can or cannot work |
public void set stamina robot stamina controller robot stamina robot this stamina robot stamina robot coordinator null | configures the stamina robot of this daemon |
public int get connection socket number return this connection get socket number | returns the number of the socket connection of the daemon |
public void start int local socket number throws ioexception if this connection is alive this connection start local socket number this connection add observer this if this instanceof main daemon this instanceof perception daemon super start | starts the work of the daemon |
public void stop acting this is active false stops the connection of the daemon this connection stop acting | stops the work of the daemon |
private void insert message string message if this received messages null this received messages new queue string adds the message to the received ones this received messages insert message | inserts the given message into the queue of received messages |
private self perception produce self perception limitation limitations holds an eventual stamina limitation double stamina 0 for each limitation tries to set the stamina limitation for int i 0 i limitations length i if limitations i instanceof stamina limitation stamina stamina limitation limitations i get cost developer new limitations must add code here if there s enough stamina to perceive if this agent get stamina this spent stamina stamina updates the spent stamina this spent stamina this spent stamina stamina returns the agent perceiving itself return new self perception this agent default answer return null | obtains the perception for the agent of itself given the eventual |
private edge get edge string id if this edges null for edge edge this edges if edge get object id equals id return edge return null | returns the edge of the graph that has the given id |
private void attend wait action wait action action return | attends a wait action |
public int get cycles count return this cycles count | returns the number of simulated cycles |
public void reset connection throws ioexception synchronized simulator simulator get state synchronization this buffer clear int local socket number this connection get socket number this connection stop acting waits until the connection is finished while this connection is alive creates a new connection and starts it this connection new server side tcpconnection this get name s connection this buffer this connection start local socket number | resets the main daemons connection |
public void remove agent spent staminas agent agent if this staminas null for agent and spent staminas agent staminas this staminas if agent staminas agent equals agent this staminas remove agent staminas return | removes the eventual agent action spent stamina perception spent |
private void force agents act as planned obtains the action daemons of the simulator action daemon action daemons simulator get action daemons for each action daemon forces the act method for int i 0 i action daemons length i action daemons i act | forces the agents to act as they eventually planned |
private void make agents perceive while there are agents that didn t perceive yet wait while simulator all agents just perceived simulator lock agents perceptions false try thread sleep 1 catch interrupted exception e todo auto generated catch block e print stack trace all agents perceived so don t let them perceive anymore simulator lock agents perceptions true agents shall be thinking now | forces the agents to perceive the environment |
private void make agents act forces the agents that have plans to act according to it this force agents act as planned while there are agents that didn t act yet wait while simulator all agents just acted simulator lock agents actions false simulator lock agents actions true | forces the agents to act |
private void init components uniform event time probability distribution etpd this etpd etpd this prob field set text string value of this etpd get probability this seed field set text string value of this etpd get seed | complements the initiation of the components of the gui |
public event time probability distribution get etpd return this etpd | returns the event time probability distribution manipulated by the gui |
public void init components empirical event time probability distribution etpd this etpd etpd default table model table model default table model this distribution table get model int row count table model get row count for int i 0 i row count i table model remove row 0 double distribution this etpd get distribution for int i 0 i distribution length i double content new double distribution i table model add row content this seed field set text string value of this etpd get seed | complements the initiation of the components of the gui |
private void init components normal event time probability distribution etpd this etpd etpd this mean field set text string value of this etpd get mean this std field set text string value of this etpd get standard deviation this seed field set text string value of this etpd get seed | complements the initiation of the components of the gui |
private void init components specific event time probability distribution etpd this etpd etpd this prob field set text string value of this etpd get probability this time field set text string value of this etpd get time this seed field set text string value of this etpd get seed | complements the initiation of the components of the gui |
private void initialize this set size new dimension 170 283 this set content pane get buttons pane this set jmenu bar get jjmenu bar this set title sim patrol environment editor this set default close operation jframe exit on close | this method initializes this |
private void init components2 society society int soc num environment env this society society this society number soc num this society panel new society jpanel this society env this tabbed panel set component at 0 this society panel if society instanceof closed society this society label set text closed society else this society label set text open society | complements the initiation of the components of the gui |
private jmenu get file menu if file menu null file menu new jmenu file menu set text environment file menu add get open file file menu add get save file file menu add get save as file file menu add get close file return file menu | this method initializes file menu |
private jmenu item get open file if open file null open file new jmenu item open o open file set accelerator key stroke get key stroke key event vk o event ctrl mask open file add action listener this return open file | this method initializes open file |
private jmenu item get save file if save file null save file new jmenu item save s save file set accelerator key stroke get key stroke key event vk s event ctrl mask save file add action listener this return save file | this method initializes save file |
private jmenu item get save as file if save as file null save as file new jmenu item save as save as file add action listener this return save as file | this method initializes save file |
private jmenu item get close file if close file null close file new jmenu item close file set text close close file add action listener this return close file | this method initializes close file |
private jpanel get buttons pane if buttons pane null buttons pane new jpanel buttons pane set layout new flow layout refresh buttons return buttons pane | this method initializes buttons pane |
private void init components2 jdialog owner society society environment env this owner owner this environment env this graph env get graph this agents new linked list agent if society instanceof closed society this is closed society true else this is closed society false this id field set text society get object id this label field set text society get label agent agents society get agents for int i 0 i agents length i string content agents i get object id default table model this agents table get model add row content this agents add agents i | complements the initiation of the components of the gui |
private jbutton get graph button if graph button null graph button new jbutton graph button set text create graph graph button set horizontal alignment swing constants center graph button set component orientation component orientation unknown graph button set preferred size new dimension 150 25 graph button set horizontal text position swing constants center graph button set maximum size null graph button add action listener this return graph button | this method initializes graph button |
private jbutton get create society button if create society button null create society button new jbutton create society button set text create society create society button set horizontal text position swing constants center create society button set preferred size new dimension 150 25 create society button add action listener this return create society button | this method initializes create society button |
protected void randstart button action performed action event evt node nodes graph get nodes for agent agent agents int nodenum nodes length while nodenum nodes length nodenum int math random nodes length agent set node nodes nodenum | executed when the randstart button is pressed |
private void open file throws parser configuration exception saxexception ioexception node not found exception edge not found exception jfile chooser fc new jfile chooser if environment file null fc set current directory new file environment file int return val fc show open dialog this if return val jfile chooser approve option environment file fc get selected file get path environment env environment translator get environment environment file graph env get graph societies env get societies refresh buttons | this method opens a file and gets the environment described |
private void init components2 agent agent society society environment env this agent agent this agents null this agent panel new agent jpanel this society agent env this editing panel set component at 0 this agent panel if agent instanceof perpetual agent this type label set text perpetual agent else this type label set text seasonal agent | complements the initiation of the components of the gui |
private void modify society string s id int i for i 0 i societies length i if societies i null societies i get object id equals s id break society gui society gui new society gui this societies i i new environment this graph societies society gui set visible true | this method launches the gui associated to the i th society |
private void create graph this graph new graph new node 0 modify graph | this method create a new graph and launches the associated gui |
private void modify graph graph gui graph gui new graph gui this this graph graph gui set visible true | this method launches the gui associated to the graph |
public void set society int soc num society soc societies soc num soc saved false refresh buttons | this method is used by society gui to save changes before closing |
public void close throws ioexception if this file reader null this file reader close this file reader null | closes the file |
public boolean is end of file return this next token line 0 | returns if the end of the read file was reached |
public boolean is end of line return this next token line this first line | returns if the end of a line was reached when reading the file |
public string read line throws ioexception if this lines count 0 return null string line this buffer this first line if this next char 0 if this next char line length line else line line substring this next char line length 1 this buffer this first line null this next char 0 this first line this lines count if this next token line 0 this next token line this first line this find next return line | reads an entire line from the file as a string |
public char read char throws ioexception if this lines count 0 return 0 char new char string line this buffer this first line if this next char line length new char n this read line else new char line char at this next char if new char this next token line 0 this find next return new char | reads the next char of the file including and n |
public string read string throws ioexception string next string null string line this buffer this next token line for int i this first line i this lines count i this buffer i null this buffer 0 line this next token line 0 this first line 0 this lines count 1 int i 0 int size line length for i this next token col i size i if line char at i break next string line substring this next token col i this next char i this find next return next string | reads a string from the file |
public int read int throws number format exception ioexception return integer value of this read string int value | reads an integer from the file |
public double read double throws number format exception ioexception return double value of this read string double value | read a double value from the file |
protected void finalize throws ioexception this close | forces the file closing when the garbage collector is called |
private void init buffer throws ioexception the buffer reads 5 lines per time this buffer new string 5 resets the controlling attributes of the reading task this next char 0 this next token line 0 this first line 0 this lines count 0 reads the first line if possible from the file to the buffer string line this file reader read line if line null this next token line 1 else this buffer 0 line this lines count this find next | initiates the buffer used to read the file content |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.