input
stringlengths
10
828
output
stringlengths
5
107
public void test values registry key initialize registry key r new registry key root key hkey current user testkey assert not null values must not be null r values
tests that the code values code method returns an iterator
protected int get value return m value
returns the integer value used by the native windows registry functions
public void test expand bypass registry key initialize registry key r new registry key root key hkey current user testkey registry value v new registry value expand value type reg expand sz systemroot r set value v assert equals reg expand sz values should match but may vary by system c windows r get value expand get data r bypass expansion true assert equals reg expand sz values must match systemroot r get value expand get data r bypass expansion false assert equals reg expand sz values must match original values c windows r get value expand get data
tests reg expand sz reads are not expanded
public void set data boolean data set data new boolean data
sets this code registry value code s data
public registry key create subkey string name registry key r new registry key m root make path name r create return r
creates the specified subkey
public string get name return m path substring 1 m path last index of splitter
returns this code registry key code s code name code
public root key get root key return m root
returns this code registry key code s root key
public string to string return m name m type to string get string value
returns a string representation of this code registry value code
public long get last modified time this started with an estimate and was improved by newton s method final long ms between idiocy and epoch 11644473600000 l return math round get last modified file time 0 0001 ms between idiocy and epoch
returns a code long code representing the time since the epoch of
public boolean has subkey string name registry key r new registry key m root make path name return r exists
tests if this registry key possesses the specified subkey
public string make path string sub path string buffer path new string buffer m path if empty equals m path path append splitter path append sub path return path to string
builds a subpath based on this path and the code sub path code
public iterator subkeys return new key iterator this
returns an iterator for available subkeys
public string to string string buffer to string new string buffer m root to string if empty equals m path to string append splitter to string append m path return to string to string
returns a string representation of this code registry key code
public iterator values return new value iterator this
returns an iterator for available values
public void bypass expansion boolean do bypass m ignore expand do bypass
the default behavior when reading reg expand sz keys is to expand the
public upload request callback get callback return this callback
returns the callback previously set by
public string get header string header if this headers null return null return this headers get header
returns the value of a header previous set by
public void cancel if this xml http request null xmlhttp request xml http this xml http request this xml http request null xml http clear on ready state change xml http abort if this timer null this timer cancel
cancels a pending request
public boolean is pending if this xml http request null return false int ready state this xml http request get ready state switch ready state case xmlhttp request opened case xmlhttp request headers received case xmlhttp request loading return true return false
returns true if this request is waiting for a response
public void set callback upload request callback callback if callback null throw new null pointer exception callback must be set this callback callback
sets the response handler for this request
public void set header string header string value if header null equals header trim throw new illegal argument exception header must be set if this headers null this headers new hash map string string this headers put header value
sets a request header with the given name and value
public string get filename return new string file name 0 file name length 2
warning this filename may be either the short or long form
public void should display m boolean should display m m should display m should display m
sets whether or not this display should display an m
public void update string output m result get number to string old bad stuff if output contains decimal decimal string strings output split decimal decimal regex if strings length 2 if strings 1 equals number string zero output strings 0 decimal decimal else output decimal decimal use following block instead if output contains decimal decimal output decimal decimal string m if m should display m m m else m m output m output m text field set text output system out println output
updates this display
public void update m display update
updates the gui display
public void display m boolean should display m m display should display m should display m m display update
displays or hides an m on the display of the calculator
private void add digit button int i calculator calculator string sn string value of i int in i jbutton j new jbutton sn digit d new digit in new digit button d calculator j m button panel add j
adds a digit button to the given calculator with the given number
private void add operator button operator operator calculator calculator jbutton plus jbutton new jbutton operator to string new operator button operator calculator plus jbutton m button panel add plus jbutton
adds an operator button to the given calculator with the given operator
public void handle response player msg hdr header switch header get subtype case player wifi mac break default if is debugging system err println wifi debug unexpected response header get subtype of size header get size break
handle acknowledgement response messages
protected void handle response player msg hdr header system err println player device general handle responce was triggered
abstract handle response method
protected void load if file main file return file main file entities clear if file null return for waypoint i file waypoints entities add i for route r file routes for waypoint i r entities add i for track r file tracks for track segment s r get array for waypoint i s entities add i fill output html null
update the google map view if the main file has changed not otherwise
public void select waypoint wp selwp wp selected 1 if wp null selected 0 paintinfo
displays the properties of a waypoint
public int calc zoom double prev diff 100000000 double cur diff int i for i 0 i 17 i cur diff scale zoom levels i if cur diff 0 if cur diff prev diff 0 5 i break if cur diff prev diff prev diff cur diff else break return i 1
calculate the google maps zoom level based on the current scale
public void select track trk seltrk trk selected 2 paintinfo
displays the properties of a track
public void set enabled boolean x enabled x
sets enabled status
public void set desc string x desc x
set description parameter
public void select route rt selrt rt selected 3 paintinfo
displays the properties of a route
public void select group g if g route size 1 g track size 0 g waypoint size 0 select g get route 0 else if g route size 0 g track size 1 g waypoint size 0 select g get track 0 else if g route size 0 g track size 0 g waypoint size 1 select g get waypoint 0 else if g route size 0 g track size 0 g waypoint size 0 select else selgrp g selected 4 paintinfo
displays the properties of a group
protected void paintinfo prints a changing test string to the frame painttest g2d return the code below prints different info based on what type of data is selected switch selected case 0 paintnull break case 1 paintwp break case 2 painttrk break case 3 paintrt break case 4 paintgrp break
changes the information to be displayed on the panel depending on the
protected void paintnull disables button setcolor set enabled false set att set enabled false sets the text to mllabel set text
disables both buttons and displays nothing in the text area
protected void paintgrp disables button setcolor set enabled false set att set enabled true sets the text to string text name selgrp name n if selgrp get enabled text text concat status enabled n else text text concat status disabled n text text concat number of waypoints selgrp waypoint size n text text concat number of tracks selgrp track size n text text concat number of routes selgrp route size n mllabel set text text scroll window back to top mllabel set caret position 0
displays some information about the group
public void select int x int y if file null focustrack null return this is so we play nice with the existing functions in the map view eventhandler it uses data as the current selected track i think data focustrack point2 d click new point2 d double x y waypoint min w null min w get track point focustrack click if min w null main view select min w main selected select min w state state tk rt wp
unlike basic map view we have to ensure were only selecting waypoints on
public void test gpxgroup1 boolean exception has been thrown false try gpximporter importer new gpximporter group new group new group importer import gpx new group panda txt end try catch exception e exception has been thrown true end catch assert equals exception has been thrown true end test gpxgroup1
test gpxgroup1 tests the importer when the file given does not exist
public void test gpxgroup2 boolean exception has been thrown false try gpximporter importer new gpximporter group new group new group importer import gpx new group null end try catch exception e exception has been thrown true end catch assert equals exception has been thrown true end test gpxgroup2
test2 test the importer when the input is null
public void test gpxgroup3 boolean exception has been thrown false try gpximporter importer new gpximporter importer import gpx group null null end try catch exception e exception has been thrown true end catch assert equals exception has been thrown true end test gpxgroup3
test2 test the importer when the input is null
public void test gpxgroup4 boolean exception has been thrown false try gpximporter importer new gpximporter importer import gpx group null junk gpx end try catch exception e exception has been thrown true end catch assert equals exception has been thrown true end test gpxgroup4
test3 test the importer when the file given is junk
public void test gpxgroup5 boolean exception has been thrown false try gpximporter importer new gpximporter group new group new group importer import gpx new group test file1 gpx end try catch exception e exception has been thrown true end catch assert equals exception has been thrown false end test gpxgroup5
test4 test the importer when the file contains nothing
protected string format distance double distance kilometers if distance 1000 distance math rint distance 100 10 divide by 1000 round to 1 decimal place return distance km meters else distance math rint distance 10 10 round to 1 decimal place return distance m
formats a distance for display to the user
public void action performed action event e if e get action command equals set color if selected 1 color clr jcolor chooser show dialog parent color chooser selwp get color selwp set color clr else if selected 2 color clr jcolor chooser show dialog parent color chooser seltrk get color seltrk set color clr else if selected 3 color clr jcolor chooser show dialog parent color chooser selrt get color selrt set color clr parent refreshmap else if e get action command equals set att dispattdialog
displays a dialog when a button is pressed
public void test gpxdatabase1 boolean exception has been thrown false try gpximporter importer new gpximporter database new group new database importer import gpx new group panda txt end try catch exception e exception has been thrown true end catch assert equals exception has been thrown true end test gpxdatabase1
test gpxgroup1 tests the importer when the file given does not exist
public void test gpxdatabase2 boolean exception has been thrown false try gpximporter importer new gpximporter database new group new database importer import gpx new group null end try catch exception e exception has been thrown true end catch assert equals exception has been thrown true end test gpxdatabase2
test2 test the importer when the input is null
public void test gpxdatabase3 boolean exception has been thrown false try gpximporter importer new gpximporter importer import gpx database null null end try catch exception e exception has been thrown true end catch assert equals exception has been thrown true end test gpxdatabase3
test2 test the importer when the input is null
public void test gpxdatabase4 boolean exception has been thrown false try gpximporter importer new gpximporter importer import gpx database null junk gpx end try catch exception e exception has been thrown true end catch assert equals exception has been thrown true end test gpxdatabase4
test3 test the importer when the file given is junk
public void test gpxdatabase5 boolean exception has been thrown false try gpximporter importer new gpximporter database new group new database importer import gpx new group test file1 gpx end try catch exception e exception has been thrown true end catch assert equals exception has been thrown false end test gpxdatabase5
test4 test the importer when the file contains nothing
public void test gpxgroup1 boolean exception has been thrown false try gpxexporter exporter new gpxexporter exporter export to gpx group null null end try catch exception e exception has been thrown true end catch assert equals exception has been thrown true end test gpxgroup1
test export1 test the kml exporter when the input is not valid
public void test gpxgroup2 boolean exception has been thrown false try group file new group file add waypoint new waypoint waypoint1 1 1 0 0 gpxexporter exporter new gpxexporter exporter export to gpx file null end try catch exception e exception has been thrown true end catch assert equals exception has been thrown true end test gpxgroup2
test export2 test the kml exporter when the input is not valid
public void test gpxgroup3 boolean exception has been thrown false try gpxexporter exporter new gpxexporter exporter export to gpx group null export group gpx end try catch exception e exception has been thrown true end catch assert equals exception has been thrown true end test gpxgroup3
test export3 test the kml exporter when the input is not valid
public void test ulti gpxdatabase1 boolean exception has been thrown false try gpximporter importer new gpximporter database new group new database importer import ulti gpx new group panda txt end try catch exception e exception has been thrown true end catch assert equals exception has been thrown true end test ulti gpxdatabase1
test gpxgroup1 tests the importer when the file given does not exist
public void test gpxgroup4 boolean exception has been thrown false try group file new group file add waypoint new waypoint waypoint1 1 1 0 0 gpxexporter exporter new gpxexporter exporter export to gpx file export group1 gpx end try catch exception e exception has been thrown true end catch assert equals exception has been thrown false end test gpxgroup4
test export4 test the kml exporter when you want to export a waypoint
public void test gpxgroup5 boolean exception has been thrown false try group file new group route new route new route new route set name trial route new route add new waypoint waypoint1 first waypoint 2 2 0 1000 new route add new waypoint waypoint2 second waypoint 2 7 2 5 0 2000 file add route new route gpxexporter exporter new gpxexporter exporter export to gpx file export group2 gpx end try catch exception e exception has been thrown true end catch assert equals exception has been thrown false end test gpxgroup5
test export5 test the kml exporter when you want to export a route
public void test ulti gpxdatabase2 boolean exception has been thrown false try gpximporter importer new gpximporter database new group new database importer import ulti gpx new group null end try catch exception e exception has been thrown true end catch assert equals exception has been thrown true end test ulti gpxdatabase2
test2 test the importer when the input is null
public void test tulit gpxdatabase3 boolean exception has been thrown false try gpximporter importer new gpximporter importer import ulti gpx database null null end try catch exception e exception has been thrown true end catch assert equals exception has been thrown true end test ulti gpxdatabase3
test2 test the importer when the input is null
public void test gpxdatabase1 boolean exception has been thrown false try gpxexporter exporter new gpxexporter exporter export to gpx database null null end try catch exception e exception has been thrown true end catch assert equals exception has been thrown true end test gpxdatabase1
test export1 test the kml exporter when the input is not valid
public void test ulti gpxdatabase4 boolean exception has been thrown false try gpximporter importer new gpximporter importer import ulti gpx database null junk gpx end try catch exception e exception has been thrown true end catch assert equals exception has been thrown true end test ulti gpxdatabase4
test3 test the importer when the file given is junk
public void test gpxdatabase2 boolean exception has been thrown false try database file new database file add waypoint new waypoint waypoint1 1 1 0 0 gpxexporter exporter new gpxexporter exporter export to gpx file null end try catch exception e exception has been thrown true end catch assert equals exception has been thrown true end test gpxdatabase2
test export2 test the kml exporter when the input is not valid
public void test gpxdatabase3 boolean exception has been thrown false try gpxexporter exporter new gpxexporter exporter export to gpx database null export database gpx end try catch exception e exception has been thrown true end catch assert equals exception has been thrown true end test gpxdatabase3
test export3 test the kml exporter when the input is not valid
public void test ulti gpxdatabase5 boolean exception has been thrown false try gpximporter importer new gpximporter database new group new database importer import ulti gpx new group test file1 ulti gpx end try catch exception e exception has been thrown true end catch assert equals exception has been thrown false end test ulti gpxdatabase5
test4 test the importer when the file contains nothing
public void test gpxdatabase4 boolean exception has been thrown false try database file new database file add waypoint new waypoint waypoint1 1 1 0 0 gpxexporter exporter new gpxexporter exporter export to gpx file export database1 gpx end try catch exception e exception has been thrown true end catch assert equals exception has been thrown false end test gpxdatabase4
test export4 test the kml exporter when you want to export a waypoint
public void test gpxdatabase5 boolean exception has been thrown false try database file new database route new route new route new route set name trial route new route add new waypoint waypoint1 first waypoint 2 2 0 1000 new route add new waypoint waypoint2 second waypoint 2 7 2 5 0 2000 file add route new route gpxexporter exporter new gpxexporter exporter export to gpx file export database2 gpx end try catch exception e exception has been thrown true end catch assert equals exception has been thrown false end test gpxdatabase5
test export5 test the kml exporter when you want to export a route
public void test ulti gpxgroup1 boolean exception has been thrown false try gpxexporter exporter new gpxexporter exporter export to ulti gpx group null null end try catch exception e exception has been thrown true end catch assert equals exception has been thrown true end test ulti gpxgroup1
test export1 test the kml exporter when the input is not valid
public void test ulti gpxgroup2 boolean exception has been thrown false try group file new group file add waypoint new waypoint waypoint1 1 1 0 0 gpxexporter exporter new gpxexporter exporter export to ulti gpx file null end try catch exception e exception has been thrown true end catch assert equals exception has been thrown true end test ulit gpxgroup2
test export2 test the kml exporter when the input is not valid
public void test ulti gpxgroup3 boolean exception has been thrown false try gpxexporter exporter new gpxexporter exporter export to ulti gpx group null export group ultigpx end try catch exception e exception has been thrown true end catch assert equals exception has been thrown true end test ulti gpxgroup3
test export3 test the kml exporter when the input is not valid
public void test ulti gpxgroup4 boolean exception has been thrown false try group file new group file add waypoint new waypoint waypoint1 1 1 0 0 gpxexporter exporter new gpxexporter exporter export to ulti gpx file export group1 ultigpx end try catch exception e exception has been thrown true end catch assert equals exception has been thrown false end test ulti gpxgroup4
test export4 test the kml exporter when you want to export a waypoint
public void test ulti gpxgroup5 boolean exception has been thrown false try group file new group route new route new route new route set name trial route new route add new waypoint waypoint1 first waypoint 2 2 0 1000 new route add new waypoint waypoint2 second waypoint 2 7 2 5 0 2000 file add route new route gpxexporter exporter new gpxexporter exporter export to ulti gpx file export group2 ultigpx end try catch exception e exception has been thrown true end catch assert equals exception has been thrown false end test ulti gpxgroup5
test export5 test the kml exporter when you want to export a route
public void test ulti gpxdatabase1 boolean exception has been thrown false try gpxexporter exporter new gpxexporter exporter export to ulti gpx database null null end try catch exception e exception has been thrown true end catch assert equals exception has been thrown true end test ulti gpxdatabase1
test export1 test the kml exporter when the input is not valid
public void test ulti gpxdatabase2 boolean exception has been thrown false try database file new database file add waypoint new waypoint waypoint1 1 1 0 0 gpxexporter exporter new gpxexporter exporter export to gpx file null end try catch exception e exception has been thrown true end catch assert equals exception has been thrown true end test ulti gpxdatabase2
test export2 test the kml exporter when the input is not valid
public void test ulti gpxdatabase3 boolean exception has been thrown false try gpxexporter exporter new gpxexporter exporter export to ulti gpx database null export database ultigpx end try catch exception e exception has been thrown true end catch assert equals exception has been thrown true end test ulti gpxdatabase3
test export3 test the kml exporter when the input is not valid
public void test ulti gpxdatabase4 boolean exception has been thrown false try database file new database file add waypoint new waypoint waypoint1 1 1 0 0 gpxexporter exporter new gpxexporter exporter export to ulti gpx file export database1 ultigpx end try catch exception e exception has been thrown true end catch assert equals exception has been thrown false end test ulti gpxdatabase4
test export4 test the kml exporter when you want to export a waypoint
public void test ulti gpxdatabase5 boolean exception has been thrown false try database file new database route new route new route new route set name trial route new route add new waypoint waypoint1 first waypoint 2 2 0 1000 new route add new waypoint waypoint2 second waypoint 2 7 2 5 0 2000 file add route new route gpxexporter exporter new gpxexporter exporter export to ulti gpx file export database2 ultigpx end try catch exception e exception has been thrown true end catch assert equals exception has been thrown false end test ulti gpxdatabase5
test export5 test the kml exporter when you want to export a route
public void set parent track x parent x
set parent track of track segment
public track get parent return parent
return parent track of track segment
public void test kmlgroup1 boolean exception has been thrown false try gpxexporter exporter new gpxexporter exporter export to kml group null null end try catch exception e exception has been thrown true end catch assert equals exception has been thrown true end test kmlgroup1
test export1 test the kml exporter when the input is not valid
public void test kmlgroup2 boolean exception has been thrown false try group file new group file add waypoint new waypoint waypoint1 1 1 0 0 gpxexporter exporter new gpxexporter exporter export to kml file null end try catch exception e exception has been thrown true end catch assert equals exception has been thrown true end test kmlgroup2
test export2 test the kml exporter when the input is not valid
public void test kmlgroup3 boolean exception has been thrown false try gpxexporter exporter new gpxexporter exporter export to kml group null export group kml end try catch exception e exception has been thrown true end catch assert equals exception has been thrown true end test kmlgroup3
test export3 test the kml exporter when the input is not valid
public void test kmlgroup4 boolean exception has been thrown false try group file new group file add waypoint new waypoint waypoint1 1 1 0 0 gpxexporter exporter new gpxexporter exporter export to kml file export group1 kml end try catch exception e exception has been thrown true end catch assert equals exception has been thrown false end test kmlgroup4
test export4 test the kml exporter when you want to export a waypoint
public void test kmlgroup5 boolean exception has been thrown false try group file new group route new route new route new route set name trial route new route add new waypoint waypoint1 first waypoint 2 2 0 1000 new route add new waypoint waypoint2 second waypoint 2 7 2 5 0 2000 file add route new route gpxexporter exporter new gpxexporter exporter export to kml file export group2 kml end try catch exception e exception has been thrown true end catch assert equals exception has been thrown false end test kmlgroup5
test export5 test the kml exporter when you want to export a route
public void add track track t track add t if t get name null t name track track size
add track to file
public void add route route r route add r if r get name null r name route route size
add route to file
public void test kmldatabase1 boolean exception has been thrown false try gpxexporter exporter new gpxexporter exporter export to kml database null null end try catch exception e exception has been thrown true end catch assert equals exception has been thrown true end test kmldatabase1
test export1 test the kml exporter when the input is not valid
public void add waypoint waypoint w waypoint add w
add waypoint to file
public void add group group g group add g
add group to file
public void test kmldatabase2 boolean exception has been thrown false try database file new database file add waypoint new waypoint waypoint1 1 1 0 0 gpxexporter exporter new gpxexporter exporter export to kml file null end try catch exception e exception has been thrown true end catch assert equals exception has been thrown true end test kmldatabase2
test export2 test the kml exporter when the input is not valid
public void test kmldatabase3 boolean exception has been thrown false try gpxexporter exporter new gpxexporter exporter export to kml database null export database kml end try catch exception e exception has been thrown true end catch assert equals exception has been thrown true end test kmldatabase3
test export3 test the kml exporter when the input is not valid
public void add track segment t this track segments add t
add a track segment t to the tracks list
public void remove track segment t this track segments remove t
remove a track segment t from the tracks list
public boolean contains track segment t return this track segments contains t
check if a track segment is in this track
public void test kmldatabase4 boolean exception has been thrown false try database file new database file add waypoint new waypoint waypoint1 1 1 0 0 gpxexporter exporter new gpxexporter exporter export to kml file export database1 kml end try catch exception e exception has been thrown true end catch assert equals exception has been thrown false end test kmldatabase4
test export4 test the kml exporter when you want to export a waypoint
public double get distance double distance 0 0 double ndist for track segment s this track segments distance distance s get distance return distance
get the total distance of the track
public int size return this track segments size
return the size of the track segment array
public void refresh dist double dist 0 0 waypoint last null for track segment ts this track segments for waypoint wp ts if last null dist last distance to wp wp dist dist last wp
refreshes the internal waypoints dist parameter