input
stringlengths
10
828
output
stringlengths
5
107
public string ping syndicator try tw iceutil set request header stub syndicator create ice header null syndicator ping return ping success catch exception e logger instance log logger error logger prefix tw icesubscriber ping syndicator e return ping failure e to string
pings the syndicator and returns the response
public void on module load root panel root panel root panel get final vertical panel vertical panel new vertical panel root panel add vertical panel 0 0 vertical panel set size 100 100 final label gilead sample application label new label gilead app engine sample application gilead sample application label set style name title vertical panel add gilead sample application label vertical panel add create user panel vertical panel add new html hr vertical panel add create upload panel
module entry point
public url find resource string name if is url class loader return urlclass loader wrapped class loader find resource name else return super find resource name
find resource simple override
public void add association class sourceclass class targetclass domain to target map put sourceclass targetclass target to domain map put targetclass sourceclass
add an association between source and clone class where source is the
public void set associations map class class mappings domain to target map clear target to domain map clear iterator class iter mappings key set iterator while iter has next class src class name iter next class target class name mappings get src class name add association src class name target class name
set the associations between source and clone class
public serializable unserialize object object precondition checking if object null return null if object instanceof string false throw new runtime exception cannot unserialize object object was expecting a string string string string object if log is debug enabled log debug unserialization of string string checking if string length 0 return null convert back to bytes and serializable return serializable xstream from xml string
regenerate serializable from string
public void test source to clone mapping throws exception assert equals domain class1 dto class mapper get target class domain class1 class assert equals domain class2 dto class mapper get target class domain class2 class
test source clone mapping
public void test target class caching assert null mapper get cached association domain class1 class assert null mapper get cached association domain class1 dto class assert equals domain class1 dto class mapper get target class domain class1 class assert equals domain class1 dto class mapper get cached association domain class1 class assert equals domain class1 class mapper get cached association domain class1 dto class
test clone source caching strategy
public void test source class caching assert null mapper get cached association domain class1 class assert null mapper get cached association domain class1 dto class assert equals domain class1 class mapper get source class domain class1 dto class assert equals domain class1 dto class mapper get cached association domain class1 class assert equals domain class1 class mapper get cached association domain class1 dto class
test source clone caching strategy
public void test map source to clone throws exception assert equals double class mapper get target class integer class assert equals string class mapper get target class boolean class
test source clone mapping
public void test clone to source mapping throws exception assert equals domain class1 class mapper get source class domain class1 dto class assert equals domain class2 class mapper get source class domain class2 dto class
test clone source mapping
public void test nonexistent associations throws exception assert null mapper get target class string class assert null mapper get source class boolean class
error test for mapping
public void test map clone to source throws exception assert equals integer class mapper get source class double class assert equals boolean class mapper get source class string class
test clone source mapping
public short blob byte bytes allocate new memory this bytes new byte bytes length copy the bytes system arraycopy bytes 0 this bytes 0 bytes length
constructor default one ommited
public int compare to short blob other byte other bytes other get bytes for int i 0 i math min bytes length other bytes length i int v1 bytes i 0xff int v2 other bytes i 0xff if v1 v2 return v1 v2 return bytes length other bytes length
simplified implementation of original code
public int compare to object object return compare to short blob object
b unsafe behavior b of
public int hash code return arrays hash code bytes
calculate the hash
public int compare to link l return value compare to l value
safe comparator implementation
public int compare to object object return compare to link object
b unsafe behavior b of
private user
default constructor required by serialization api hidden from usage
public string get auth domain return auth domain
returns the authentication domain
private int compare to user user return email compare to user email
the private comparator for this class
public void file chooser file chooser new jfile chooser file chooser set current directory new file jpeg new jpegfilter jpg new jpgfilter cs232 new cs232 filter file chooser add choosable file filter jpeg file chooser add choosable file filter jpg file chooser add choosable file filter cs232 file chooser set accept all file filter used true
open and save codes
public int get seed return this seed
returns the seed of the random number generator
public void set next bool counter int next bool counter this next bool counter next bool counter for int i 0 i this next bool counter 1 i this rn distributor next int
configures the next bool counter attribute and assures the distributor
public double get probability return this probability
returns the probability value of the distribution
public int get time return this time
returns the time when the dices must be thrown
public double get standard deviation return this standard deviation
returns the standard deviation of the probability distribution
public void start this clock start
starts the collecting of the metric
public void set society open society society this society society
configures the society of the agent
public void stop acting this clock stop acting
stops the collecting of the metric
public void remove agent seasonal agent agent this agents remove agent
removes a given agent from the society
public int get perception type return this perception type
returns the type of the allowed perception
public boolean has agent agent agent registers if the agent exists in the society boolean agent exists false for agent compared agent this agents if compared agent equals agent agent exists true adds the agent if possible if agent exists return true return false
verifies if a given agent exists in this society
public void set limitations limitation limitations if limitations null limitations length 0 this limitations new hash set limitation for int i 0 i limitations length i this limitations add limitations i else this limitations null
configures the limitations of a permission
public int get agent state return this state
returns the state of the agent
public void set agent state int state this state state
configures the state of the agent
public dynamic edge get copy node source copy node target copy registers if the original edge is directed boolean directed this source is target of this the copy dynamic edge answer new dynamic edge source copy target copy directed this length this enabling tpd this disabling tpd this is enabled answer id this id answer visibility this visibility returns the answer return answer
obtains a copy of the edge with the given copies of nodes
public void set length double len this length len
returns the length of the edge
public void set edge edge edge double elapsed length this edge edge this elapsed length elapsed length if this edge null this edge get length this elapsed length this elapsed length this edge get length
configures the edge of the agent as well as its position on it
public void add stigma stigma stigma if this stigmas null this stigmas collections synchronized set new hash set stigma this stigmas add stigma
adds the given stigma to the graph
public boolean is in enabled edges edge edge return this enabled edges contains edge
verifies if a given edge is in the memory of enabled edges
public void add enabled edge edge edge this enabled edges add edge
adds a given edge to the memory of enabled edges of the node
public double get elapsed length return this elapsed length
returns where the agent is on the edge i
public boolean is visible return this visibility
verifies the visibility of the edge
public void set stamina double stamina if stamina this max stamina this stamina stamina else this stamina this max stamina
configures the stamina of the agent
public dynamic node get copy dynamic node answer new dynamic node this label this enabling tpd this disabling tpd this is enabled answer id this id answer priority this priority answer visibility this visibility answer fuel this fuel answer last visit time this last visit time return answer
returns a copy of the node with no edges
public double get stamina return this stamina
returns the stamina of the agent
public void set is enabled boolean is enabled if is enabled is true verifies if its nodes are enabled if is enabled if the source is a dynamic node and is not enabled if this source instanceof dynamic node dynamic node this source is enabled return if the target is a dynamic node and is not enabled if this target instanceof dynamic node dynamic node this target is enabled return this is enabled is enabled
configures if the edge is enabled
public void dec stamina double factor this stamina this stamina factor if this stamina 0 this stamina 0
decrements the stamina of the agent by the given factor
public void inc stamina double factor this stamina this stamina factor if this stamina this max stamina this stamina this max stamina
increments the stamina of the agent by the given factor
public node get source return this source
returns the source of the edge
public void set max stamina double max stamina this max stamina max stamina if this stamina this max stamina this stamina this max stamina
configures the maximum possible value for the stamina of the agent
public node get target return this target
returns the collector of the edge
public double get max stamina return this max stamina
returns the maximum possible value for the stamina of the agent
public void add edge edge edge as the edge is not an arc it must be added to both in and out edge sets if this in edges null this in edges new hash set edge if this out edges null this out edges new hash set edge this in edges add edge this out edges add edge
adds the passed edge to the node
public edge get copy node source copy node target copy registers if the original edge is directed boolean directed this source is target of this the copy edge edge copy new edge source copy target copy directed this length edge copy id this id edge copy visibility this visibility edge copy is enabled this is enabled returns the answer return edge copy
obtains a copy of the edge with the given copies of nodes
public void add out edge edge out arc if this out edges null this out edges new hash set edge this out edges add out arc
adds the passed edge as a way out arc to the node
public void add in edge edge in arc if this in edges null this in edges new hash set edge this in edges add in arc
adds the passed edge as a way in arc to the node
public void remove edge string edge id for edge myedge in edges if myedge get object id edge id in edges remove myedge continue for edge myedge out edges if myedge get object id edge id out edges remove myedge continue
removes the passed edge to the vertex
public double get priority return this priority
returns the priority of the vertex
public boolean has node node node if this nodes contains node return true else for node compared node this nodes uses xmlable s equals method based on objects ids if node equals compared node return true return false
verifies if the given node is part of the graph
public double get initial speed return this initial speed
returns the initial speed of the movement
public double get acceleration return this acceleration
returns the acceleration of the movement
public node get node return this goal node
returns the goal node of the movement
public void assure teleport visibility effect assures the visibility of the destiny of the teleport this node set visibility true if this edge null this edge set visibility true assures the visibility of the other registered objects if this visible objects null for visible visible this visible objects visible set visibility true
assures the visibility of the objects that must become visible as a
public boolean is fuel return this fuel
verifies if the node is a fuel recharging point
public int get message depth return this message depth
returns the depth of the graph that the broadcasted message must reach
public double get cost return this cost
returns the cost of the limitation
public void set fuel boolean fuel this fuel fuel
configures if the node is a fuel recharging point
public double get speed return this speed
returns the speed limit imposed by the limitation
public boolean has edge edge edge if this edges null if this edges contains edge return true else for edge compared edge this edges uses xmlable s equals method based on objects ids if edge equals compared edge return true return false
verifies if the given edge is part of the graph
public void set last visit time double time this last visit time time
configures the last time this node was visited
public stigma get copy node node copy return new stigma node copy
obtains a copy of the stigma given the copy of its node
public stigma get copy edge edge copy return new stigma edge copy
obtains a copy of the stigma given the copy of its edge
public void set idleness double idleness this last visit time this last visit time idleness
configures the idleness of the node
public double get idleness if node time counter null return node time counter get elapsed time this last visit time else return math abs this last visit time
calculates the idleness of the node at the current moment
public double get combined idleness return this get idleness this get priority
returns the product of the idleness by the priority
public string receive throws ioexception byte buffer new byte udpsocket buffer size datagram packet packet new datagram packet buffer buffer length this socket receive packet this remote socket number packet get port this remote socket address packet get address return new string packet get data 0 packet get length
implements the reception of a message
public int get socket number return this server socket get local port
returns the local number of the tcp socket
public boolean send string message throws ioexception if this remote socket address null this remote socket number 1 datagram packet packet new datagram packet message get bytes message length this remote socket address this remote socket number this socket send packet return true return false
implements the sending of a message to the last remote contact
public boolean is connected if this client socket null return this client socket is connected else return false
verifies if this tcp socket connected successfully to a remote another
public boolean connect throws ioexception try this client socket server socket accept catch socket timeout exception e this input null this output null this client socket null return false this client socket set so timeout server side tcpsocket reading time interval this input new buffered reader new input stream reader this client socket get input stream this output new print stream this client socket get output stream this output flush return true
tries to establish a connection between the local server and the remote
public boolean is target of edge edge if this in edges null return false return this in edges contains edge
verifies if the node is the target of a given edge
public int get socket number return this local socket number
returns the number of the udp socket
public boolean send string message if this output null this output println message this output flush return true return false
sends a given message to the remote client
public int generate socket number return math abs this rn distributor next int
generates a number for the socket
public string receive throws ioexception if this input null try return this input read line catch interrupted ioexception e return null return null
receives a message from the remote client
public boolean is source of edge edge if this out edges null return false return this out edges contains edge
verifies if the node is the source of a given edge
public void disconnect throws ioexception if this output null this output close this output null if this input null this input close this input null if this client socket null this client socket close this client socket null this server socket close
disconnects the remote client however does not close the tcp socket
public void set step double step this step step
changes the clocks counting step
public void stop acting this is active false
indicates that the clock must stop acting
public boolean is empty return this heap is empty
verifies if the heap has some element
public node get copy node answer new node this label answer id this id answer priority this priority answer visibility this visibility answer fuel this fuel answer last visit time this last visit time return answer
returns a copy of the node with no edges
public void assure minimum heap for int i this heap size 2 1 i 0 i this heapfy i
assures the heap is correct using the bottom up strategy
public comparable remove smallest if this heap is empty comparable answer this heap remove 0 if this heap is empty comparable last element this heap remove this heap size 1 this heap add 0 last element this heapfy 0 return answer else return null
removes the smallest object from the heap
private void heapfy int pos pos while pos heap size 2 int index smallest son 2 pos if pos heap size 0 5 if this heap get 2 pos 1 1 is smaller than this heap get 2 pos 1 index smallest son 2 pos 1 if this heap get index smallest son 1 is smaller than this heap get pos 1 comparable temp this heap get pos 1 this heap set pos 1 this heap get index smallest son 1 this heap set index smallest son 1 temp pos index smallest son else return
heapfies the dynamic array starting from the given position
public void start int local socket number throws ioexception super start
starts the connections work
public boolean is connected if this socket null return this socket is connected else return false
verifies if this tcp connection is established with another remote one
protected void reset throws ioexception 1 disconnects the tcp socket this socket disconnect 2 resets it this socket new server side tcpsocket this socket get socket number
resets this tcp connection in the case of the remote contact being down