input
stringlengths
10
828
output
stringlengths
5
107
public int get user id return userid
returns the user id
public void clear int index value 1 index
set bit at index to false
public void set int index value 1 index
set bit at index to true
public void set int index boolean value if value set index else clear index
set bit at index to value
public number number value if size byte size return new byte byte value if size short size return new short short value if size integer size return new integer short value return value
get best fitting number
public void write request output stream output stream throws ioexception data output stream os new data output stream output stream os write short 21 os write long 0 os write utf fr os write utf sony ericsson k750 os write utf 1 3 1 os write utf web os write byte 27 os write int 0 os write int 0 os write int 3 os write utf os write int my cell id cell id os write int my lac lac os write int 0 os write int 0 os write int 0 os write int 0 os flush
pretend to be a french sony ericsson k750 that
public survey get by id int survey id return em find survey class survey id
retrieves the survey by the surveys id
public survey get by name string name throws missing template exception survey survey null query search query em create query select s from survey s where s name name search query set parameter name name try survey survey search query get single result catch no result exception e system out println error survey template not found name survey results ignored throw new missing template exception name return survey
this method is used to return a survey based on its name
public void delete string name em get transaction begin query delete query em create query delete from survey s where s name name delete query set parameter name name delete query execute update em get transaction commit
this method is used to delete a survey based on its name
public boolean survey exists string name query query em create query select count from survey survey where survey name 1 set parameter 1 name long count long query get single result return count 1
checks to confirm that a survey exists
public form get by question id int parse int query query em create query select form from form form where form parent question id 1 set parameter 1 parse int list results query get result list return form results null results size 1 results get 0 null
returns a form using a question id
public form new form survey survey form parent form form new form new form new form set questions new array list question new form set survey survey new form set parent form parent form return new form
this method returns a new form object
public void gira tantos grados xarticulacion int articulacion double grados dir sentido system out println giro articulacion switch articulacion case 1 int pulsos1 dame pulsos articulacion1 grados tx start motor mot m4 sentido 512 pulsos1 tx wait for motor mot m4 system out println art1 grados articulacion1 break case 2 int pulsos2 dame pulsos articulacion2 grados tx start motor mot m3 sentido 512 pulsos2 tx wait for motor mot m3 system out println art2 grados articulacion2 break
10 i count 0
public void double click
fired when double click
public void refilter final string s
refilter the display items by the given string
public void add element final string s
add a element to the current list by the given string
public void double click joption pane show message dialog null message get title joption pane ok option view list remove message this
the double click
public ilogin info get login info return new mock dm login info
factory method for an idf login info object
public iquery get query return new mock dm query
factory method for an idf query object
public iid get id string id return new mock dm id id
never called for mock
public void set identity string docbase ilogin info identity if identity get user null identity get password null if sess mger creds contains key docbase sess mger creds put docbase identity else sess mger creds remove docbase sess mger creds put docbase identity
session managers method do not set the identified session as current
public isession get session string docbase throws repository exception if sess mger sessions contains key docbase return this new session docbase dfc javadoc if session not existing created else return sess mger sessions get docbase
session managers method
public void test gcf addla zero test addla 0 1
when there are zero docbases the empty string is added to the
public void test gcf addla one test addla 1 1 dm initialize dm docbase
when there is only one docbase it is the only option and selected
public void test gcf addla multiple test addla 2 3
when there are multple docbases the empty string is added to the
private void assert is not error configure response response assert not null response assert equals response get message string form response get form snippet assert not null form assert contains form td assert not contains form color red
asserts that the given response is not an error
public void test properties map grandtype first throws repository exception map string set string properties map builder get properties map grandfoo foo new mock dm session set string types properties map get grandfoo attr assert equals set of grandfoo types
this triggers a comparison using is sub type of which matches
public void test properties map grandtype second throws repository exception map string set string properties map builder get properties map foo grandfoo new mock dm session set string types properties map get grandfoo attr assert equals set of grandfoo types
this triggers a comparison using get super type which fails
public void test properties map supertype second throws repository exception map string set string properties map builder get properties map foo superfoo new mock dm session set string types properties map get superfoo attr assert equals set of superfoo types
this triggers a comparison using get super type which matches
private static class mock document list implements document list public document next document return null public string checkpoint return null
a minimal document list all that is required is the construction
public void test get document list resume first throws repository exception the nulls in the checkpoint simulate new content with our exec query stub mock traversal manager mtm new mock traversal manager string checkpoint index 0 uuid null one last modified null 2010 04 01 00 01 00 document list document list mtm resume traversal checkpoint assert not null document list assert equals 1 mtm count
resumes the traversal on the first where clause with updates
public void test get document list resume second throws repository exception mock traversal manager mtm new mock traversal manager string checkpoint index 1 uuid one last modified 2010 04 01 00 01 00 document list document list mtm resume traversal checkpoint assert not null document list assert equals 1 mtm count
resumes the traversal on the second where clause with udpates
public void test get document list end throws repository exception mock traversal manager mtm new mock traversal manager string checkpoint index 0 uuid one another last modified 2010 04 01 00 01 00 2010 10 27 22 55 03 document list document list mtm resume traversal checkpoint assert null document list assert equals 2 mtm count
tests reaching the end of the traversal
public void set config keys list string config keys logger fine set config keys list if config keys null throw new illegal argument exception this config keys config keys
set the keys that are required for configuration
public authentication manager get authentication manager return new dctm authentication manager client x connector get docbase
gets an authentication manager
public authorization manager get authorization manager return new dctm authorization manager client x session manager connector get docbase
gets an authorization manager
public document list start traversal throws repository exception logger info start traversal return get document list forge start checkpoint
starts or restarts traversal from the beginning
private boolean lost connection try return session null session is connected catch exception e logger warning lost connectivity to server e return true
test connectivity to server
public void set batch hint int batch hint throws repository exception logger info batch hint of batch hint this batch hint batch hint
sets the preferred batch size
public void set config keys string config keys logger fine set config keys array set config keys arrays as list config keys
set the keys that are required for configuration
public string get insert id return insert id get insert index
r object id of the last item inserted
public date get insert date return insert date get insert index
r modify date of the last item inserted
public void test vc where clause results valid map put where clause mock dm query true where clause connector factory connector factory new where clause factory false configure response response type validate config valid map locale us connector factory if response null fail response get message
tests a basic where clause that returns results
public int get insert index return insert index
gets the index into the insert arrays
private boolean lost connection isession session try return session is connected catch exception e logger warning lost connectivity to server e return true
test connectivity to server
public string get delete id return delete id
r object id of the last item deleted
public void test vc where clause noresults valid map put where clause mock dm query false where clause connector factory connector factory new where clause factory false string expected resources get string additional too restrictive configure response response type validate config valid map locale us connector factory assert not null response assert equals expected response get message
tests a where clause that returns no results
public date get delete date return delete date
dm audittrail time stamp utc of the last item deleted
public void test vc where clause list valid map put where clause mock dm query true where clause connector factory connector factory new where clause factory false mock dm query true where clause configure response response type validate config valid map locale us connector factory if response null fail response get message
tests that multiple entries are valid
public void set insert checkpoint date date string object id remember previous insert checkpoint as a restore point old insert date insert date get insert index old insert id insert id get insert index set the new insert checkpoint insert date set insert index date insert id set insert index object id last action last action add
set the inserted items portion of the checkpoint
public void set delete checkpoint date date string object id remember the current delete checkpoint as a restore point old delete date delete date old delete id delete id set the new insert checkpoint delete date date delete id object id last action last action delete
sets the deleted items portion of the checkpoint
public void test vc where clause listnoresults valid map put where clause mock dm query true where clause connector factory connector factory new where clause factory false mock dm query false where clause string expected resources get string additional too restrictive configure response response type validate config valid map locale us connector factory assert not null response assert equals expected response get message
tests that an xml entry that returns no results leads to an error
public boolean has changed return next insert index insert index get insert date old insert date get insert id old insert id delete date old delete date delete id old delete id
returns true if some component of the checkpoint has changed
public void test vc where clause ignoremap valid map put where clause mock dm query true where clause connector factory connector factory new where clause factory true mock dm query alt true where clause string expected resources get string where clause not used configure response response type validate config valid map locale us connector factory assert not null response assert equals expected response get message
tests that ignoring a non empty map entry leads to an error
public void restore if last action last action add insert date set insert index old insert date insert id set insert index old insert id else if last action last action delete delete date old delete date delete id old delete id last action last action none
restores the checkpoint to its previous state
public boolean advance insert index next insert index if insert index insert id size insert id add null insert date add null next insert index increment modulo insert index insert index modulus last action last action none old insert id get insert id old insert date get insert date old delete id delete id old delete date delete date return insert index start insert index
advance to the next insert index if there is one
public void test vc where clause ignoremapnoresults valid map put where clause mock dm query true where clause connector factory connector factory new where clause factory true mock dm query false where clause list string expected new array list string collections add all expected resources get string where clause not used resources get string additional too restrictive configure response response type validate config valid map locale us connector factory assert not null response assert true response get message expected contains response get message
tests that an ignored map entry and an xml entry that returns no
public void test vc where clause ignoremapempty connector factory connector factory new where clause factory true mock dm query true where clause configure response response type validate config valid map locale us connector factory if response null fail response get message
tests that an empty map entry can be safely ignored
public void test vc where clause emptynoresults connector factory connector factory new where clause factory true mock dm query false where clause string expected resources get string additional too restrictive configure response response type validate config valid map locale us connector factory assert not null response assert equals expected response get message
tests that an empty map entry with an xml entry that returns no
private itype get super type itype type throws repository exception if type null return null map string itype super types traversal manager get super type cache string type name type get name if super types contains key type name return super types get type name else itype super type type get super type super types put type name super type return super type
return the supertype for the supplied type
public boolean can index boolean rep try if idf format null rep idf format can index else rep true catch df exception de rep true return rep
gets whether this format is configured for indexing on the
public boolean is false alarm return false alarm
check whether the alarm is false
public void reset start system current time millis delay long 1 math log math random constants sensor mean 1000 false alarm math random constants false alarms
reset the sensor
public void remove alarm unit au alarm units remove au
remove an alarm unit
public void replace start system current time millis delay long 1 math log math random constants battery mean 1000
replace the battery
public void run is running true while is running try connection conn a connection accept connection listener connection received conn sleep 10000 m koordineres med sleep i maincontrol skal egentlig ikke v re n dvendig men gir mer stabil tilkobling catch ioexception e er det feil under tilkobling s pr ver den bare p nytt catch exception e f rst og fremst interrupt feil med sleep ignoreres
the worker thread
public void run is running true try while is running string message a connection receive if message null listener message received message catch eofexception e a connection close is running false listener connection closed a connection catch ioexception e ignoreres pr ver p nytt
the worker thread
public void connect inet address remote address int remote port throws ioexception if state state closed throw new connect exception socket is not closed this remote port remote port this remote address remote address get host address try state state syn sent ktn datagram retur send helper construct internal packet flag syn last valid packet received retur kun for ikke ha denne med null verdi etter connection send ack retur false state state established catch exception e state state closed throw new ioexception error contacting host e
establish a connection to a remote location
public void send string msg throws connect exception ioexception if state state established throw new connect exception error sending not connected send helper construct data packet msg system out println packet succsessfully sent
send a message from the application
protected boolean is valid ktn datagram packet pakken m v re annet enn null ha riktig checksum og v re passende for den staten systemet er i if packet null packet calculate checksum packet get checksum is state valid packet last valid packet received packet fjernet pga ack feil return true return false
test a packet for transmission errors
public boolean force upright shape return force upright shape
returns true if the shape object has to be displayed upright
public tree impl graph graph node graph root node graph graph event broker new event broker build tree graph root node
create a tree from the given graph with the given root node
public uri get creator uri return this creator uri
get creator uri for this node
public void set creator uri uri creator uri this creator uri creator uri
set creator uri for this node
public source result get source result string uri query query throws source exception cancelled query exception try url url new url uri urlconnection connection url open connection input stream reader reader new input stream reader connection get input stream return new source result true reader null catch malformed urlexception url exc throw new source exception url uri specified for this ontology source is not well formed error url exc get message url exc catch ioexception io exc throw new source exception couldn t read input data source for uri error io exc get message io exc
get a source result from given uri
public source result get source result string relative path query query throws source exception cancelled query exception input stream stream get input stream from resource relative path input stream reader reader new input stream reader stream return new source result true reader null
get a source result from a given location in a jar file
public string get query type name return type name
get query type name
public void set relation links list edge type relation links relation links relation links
set relation types iterator
public void set depth int depth depth depth
set depth for recursive query
public query engine source source parser parser string ontology source uri this parser parser this source source this ontolgy source uri ontology source uri
execute a query to ontology server and get a query result
protected node exist same name node node iterator node it graph nodes iterator while it has next node tmp node it next if tmp node get identifier equals node get identifier return tmp node return null
help method for getting nodes with same name from the graph nodes list
protected edge exist same edge name edge edge iterator edge it graph edges iterator while it has next edge tmp edge it next if tmp edge get from node get identifier equals edge get from node get identifier if tmp edge get to node get identifier equals edge get to node get identifier if tmp edge get edge type get name equals edge get edge type get name return tmp edge return null
help method for getting nodes with same name from the graph nodes list
public void add node node node throws graph modification exception if graph nodes contains node throw new node already exists exception node graph nodes add node event broker process event new graph node added event this node
add a node to the graph
public double distance position3 d to return distance to get x to get y
get the distance from this node
public double get radius return distance 0d 0d
returns the radius for polar coordinates
public double get theta return math atan2 this x this y
returns the angle for polar coordinates
public void set polar coordinates double radius double theta this x radius math sin theta this y radius math cos theta
sets the polar coordinates
public void add focus changed observer object obj focus listener add obj
add focus observers to list
public void add position changed observer position changed observer observer position changed observer add observer
add a hyper observer
public void notify position moved iterator position changed observer it position changed observer iterator while it has next position changed observer hno it next hno position changed
tell all hyper observers of change
public boolean has clones if tree node get clones size 0 return true return false
return true if node impl has clones
public string get name return tree node get name
get the concept name
public position3 d get position return position
get the nodes position
public double get node radius return node radius
get the nodes radius
public void move double x double y set location position get x x position get y y
move node position by offset x and y
public void rotate double angle double node angle math atan2 this get x this get y angle 1 double r this get position distance 0 0 double x r math sin node angle double y r math cos node angle set location x y
rotate node about the center 0 0 by angle passed
public double distance hyper node other return this position distance other position
returns the distance to the other node
public void set location double x double y position set location x y notify position moved
set a new location for the hypernode
private font get font to display double scale if scale 1 return fonts maxfonts 1 int size int scale maxfonts maxfonts return fonts size
get the font size to display
public void set folded boolean state is folded state
set if ui is folded