input
stringlengths
10
828
output
stringlengths
5
107
public void logon string user string pass throws ioexception logon mapclient user pass
logon a user of the type
public void set lat lon fields string lat string lon coord lat field set text lat coord lon field set text lon
sets the latitude logitude fields
public void connect throws ioexception connect host port
connects to the hostname and port number set by
protected void connected event boolean connected for gpslistener listener listeners try listener connected connected catch runtime exception e broken listener listener e
publish a connected event
public void get users send message users get
send a request for a list of users to the server
public void connect string host int port throws ioexception disconnect existing connection if is closed disconnect connect to server socket new socket try socket connect new inet socket address host port catch ioexception e socket null throw e setup streams in stream socket get input stream out stream socket get output stream in new buffered reader new input stream reader in stream out new print stream out stream true connection update connected start socket data reader thread thread t new data reader thread demonize so that it doesn t prevent the program from closing t set daemon true t start
connect to server on specified port
public void get route route route if route null route list null return send message route get route get route id
gets complete route from server
public void set last update field string update update field set text update
sets the last updated field
public void set realtime route route route send message set route route get route id x
sets realtime route to track
public void get realtime routes send message realtime
gets realtime plotting routes from server
public void set route route route send message set route route get route id
sets route to track
protected void coord received int route id coordinate coord for map socket listener listener listeners try listener coord received route id coord catch runtime exception e broken listener listener e
publish a connection state change event to all listeners
protected void coords received list coordinate coords for map socket listener listener listeners try listener coords received coords catch runtime exception e broken listener listener e
publish a connection state change event to all listeners
public void get routes string username send message view routes username todo make it work with zip
request a list of routes for a given user
protected void users received list user users for map socket listener listener listeners try listener users received users catch runtime exception e broken listener listener e
publish an updated user list event to all listeners
public void disconnect from socket throws ioexception socket disconnect
disconnects from socket
protected void user received user user for map socket listener listener listeners try listener user received user catch runtime exception e broken listener listener e
publish updated user to all listeners
protected void send message object message if is connected todo it might be enough to check is closed because it might work to send a message while the socket is still connecting then it might send it right after successfully connecting this needs to be tested system out println socket not connected no use announcing disconnected state when already disconnected this must be detected somewhere else connection update disconnected return try send out stream message catch ioexception e socket error event e todo for testing purposes only system out println sent to server arrays to string message
sends a message to the server
protected void route received int route id list coordinate coords for map socket listener listener listeners try listener route received route id coords catch runtime exception e broken listener listener e
publish a route list update event to all listeners
protected void route list list route routes for map socket listener listener listeners try listener route list routes catch runtime exception e broken listener listener e
publish a route list update event to all listeners
public boolean is connected if socket null return false else return socket is connected
checks if the client is connected to the server
public void close port if s port null return status update notconnected system out println cloos s port close
closes the current com port
public boolean is closed if socket null return true else return socket is closed
checks if the client connection is closed
public void set port string port system out println port port com port port
sets a port to the active com port
public void create timer action listener listener timer new timer get interval 1000 listener
creates a new timer
public void set compression boolean compression enable compression compression
set if you want compression or not
protected void message loop throws ioexception string message while true message in read line if message null break delegate message handling else if message handler message break
checks for messages recieved from the server and pass them to the
public void start model get users
run when this window is activated by login
public void set server btn txt string text server button set text text
changes the text on the server button
public void set user box list user users user box remove all items for user user users user box add item user user box add item new user 0 realtime routes
adds user elements to user box
public void disconnect throws ioexception if logged in send message quit logged in false if is closed return todo server closes socket on quit but should have timeout on closing to ensure disconnection socket close socket null xxx hoping for close to kill the data reader thread connection update disconnected
disconnect from the socket
public boolean get compression return enable compression
checks if the client should use compression to send the
public void start recieve system out println recieve set to true recieve true
start recieve from the gps unit
public void set route box list route routes route box remove all items if routes null return for route route routes route box add item route
adds route elements to route box
public void update route info route route route route box get selected item if route null route info set text route get description r n is active route is active n is public route get visible n last updated route get last update string
updates route information in route info label
public void set gpsbtn txt string text gps button set text text
changes the text on the gps button
public void set interval int inte interval inte
set interval for recieving coordinates from the gps unit
public void stop recieve system out println recieve set to false recieve false
stop pause recieve from the gps unit
public void get box user user user user box get selected item
returns selected element in user box
public void get box route set route route route box get selected item
returns selected element in route box
public boolean is valid signal return valid signal
checks if the signal is valid
public void goto map form set map view nr box is selected dot box is selected map box is selected get thick model get route route form set info route user form goto map realtime route
will change selected window to map view panel
public void add get user btn listener action listener listener get users button add action listener listener
registers action listener to get user button
public void open file throws file not found exception out w new print writer new file output stream nmeaout txt
opens the given file
protected void socket error event ioexception exception for socket listener listener listeners try listener socket error exception catch runtime exception e broken listener listener e
publish a socket error event to all listeners
public void add config btn listener action listener listener goto map button add action listener listener
registers action listener to goto map button
public void add user box listener item listener listener user box add item listener listener
registers item listeners to user box
public void show error dialog string heading string error view show error dialog heading error
shows an error dialog
protected void invalid message string message system out println invalid message message xxx temporary for socket listener listener listeners try listener invalid message message catch runtime exception e broken listener listener e
publish an invalid message event to all listeners
protected void read excepion ioexception ioe for gpslistener listener listeners try listener read excepion ioe catch runtime exception e broken listener listener e
read exception has occured
public void add route box listener item listener listener route box add item listener listener
registers action listener to route box
public void add nr box listener item listener listener nr box add item listener listener
registers action listener to route box
protected void set coord list list coordinate coord list this coord list coord list
sets list of coordinates
public boolean is logged in return socket is logged in
checks if logged in to server
public void add dot box listener item listener listener dot box add item listener listener
registers action listener to route box
protected void connection update connection state state system out println connection update state xxx temporary update logged in status logged in state auth success for socket listener listener listeners try listener connection update state catch runtime exception e broken listener listener e
publish a connection state change event to all listeners
public void add map box listener item listener listener map box add item listener listener
registers action listener to route box
public void add thick spinner listener change listener listener thick spinner add change listener listener
registers action listener to route box
public string get coord date if gps coord null sync coords return gps coord get date string
gets the date time the coordinate was recieved
public void show login view show login form
shows the loginform
public void set route route route super set route route set description route
sets route to display info of
public void set route boolean realtime route route set route route this realtime realtime map set route route if realtime map set realtime realtime model set route route
asks server for coordinates to selected route
public void calc route list coordinate coord list if coord list null return distance calc dist coord list calc width coord list start coord coord list get 0 stop coord coord list get coord list size 1 double hours spent double stop coord get date get time start coord get date get time 1000 60 60 average speed calc speed hours spent distance time set text utils friendly string start coord get date stop coord get date speed set text utils round str average speed 1 km h
calculates information about route average speed distance and time
public void sync coords old coord gps coord gps coord gps get current coordinate
gets the current coordinate from the gps
public void route received int route id list coordinate coords if coords size 0 set state recieved empty route view set route coords return map set coord list coords view set route coords
called from model when route is recieved from server
public coordinate get current coord if old coord null return gps coord else return null
gets the current coordinate
public void users received list user users
unimplemented methods from interface
public boolean timer is running return timer is running
checks wether the timer is running or not
public coordinate get old coord if old coord null return old coord else return null
gets the old coordinate
public login form get login form return login form
returns login form
public void action performed action event e string username view get username string password view get password try model logon username password catch ioexception ioe view set message connection failed ioe get message return view set message checking information
invoked when an
public void save coord throws ioexception if old coord null gps coord get date equals old coord get date system out println dropping duplicate coord gps coord return else old coord gps coord if socket is logged in transfer to server active route get route id 1 send to server socket send coord gps coord system out println transferring else buffer to file store tmp coords gps coord system out println buffering
saves the coordinates based on connected to server or not
public void set zoom zoom set selected true get map set zoom
sets mouse klick to zoom in on klicked position
public void change transfer state transfer to server transfer to server system out println transfer to server is set to transfer to server
changes the state of transfer to server
public void set active route string route active route label set text route
sets the activeroute label
public void add login btn listener action listener listener login button add action listener listener
register a listener on the login button
public void reset map map reset
resets map to initial state
public boolean get transfer state return transfer to server
gets the state of transfer to server
private void search for cache todo implement search for existing cache update
search for existing cache and update internal cache data
public void create route string route desc socket make route route desc
creates a new route on server with the
public void transfer to server set status msg transferring to server set server btn txt transferring server button set icon img server
transferring to server changes status message
public void get routes string user socket get routes user
gets the routes for a given user
private void update map if limits null return double min x min y max x max y min x map lim 0 min y map lim 1 max x map lim 2 max y map lim 3 map provider set size get width get height map image map provider get map min x min y max x max y
update the map image in the background
public string get username return socket get username
gets the current username
public void set route on server route route socket set route route
sets the given route as the active route on server
private void move cursor boolean forward if forward cursor else cursor cursor i cursor mat length cursor j cursor mat length
move the cursor forward or backwards in the list and recalculate
public void reset set coord list coord list
resets map to initial size
public void buffer to file set status msg buffering to file set server btn txt buffering server button set icon img buffer
changes the text and icon on the server
public void clear history methods clear
clear the method call history
public int get route id route route return route get route id
returns a routes id
public void read excepion ioexception e view set status msg problems reading from the gps system out println read exception e xxx tmp remove
handles an read exception when trying to read
public void set realtime boolean realtime this realtime realtime
sets realtime if route is plotted realtime
public string get route desc route route route r route return r get description
returns a routes desciption
public void set active route route route system out println route active route route system out println active route is now active route get description
sets current route as active route locally
public void set dist field double dist distance dist if distance 1 dist field set text utils round distance 3 km else dist field set text utils round distance 1000 0 m
sets the distance field
public route get active route return active route
returns the active route
public void set zoom action 2
sets mouseklick to zoom to position
public boolean has signal return gps has signal
checks if the gps unit has a fixed position from
public boolean buffer file exists return output file exists
checks wheter the buffer file exists or not
public void set move action 1
sets mouseklick to move to position