input
stringlengths
10
828
output
stringlengths
5
107
override protected void startup show new jasakview this get application get main frame set default close operation jframe exit on close
at startup create and show the main frame of the application
private date get last updated throws malformed timestamp exception no such value exception element root element dom get document element string date string get string root element waypoint gpxmember name last updated return parse timestamp date string
helper function to return a date object representation of
private date parse timestamp string timestamp throws malformed timestamp exception int index timestamp index of t if index 1 throw new malformed timestamp exception timestamp timestamp substring 0 index date date null try date format df new simple date format yyyy mm dd date df parse timestamp catch parse exception pe throw new malformed timestamp exception return date
helper function to remove unnecessary and unparseable data from the
private waypoint text get waypoint text element el string code hash map waypoint text attribute object attributes new hash map waypoint text attribute object attributes put waypoint text attribute code code attributes put waypoint text attribute note put waypoint string attribute attributes el waypoint text attribute hint waypoint text xmlmember name hint put waypoint string attribute attributes el waypoint text attribute long description waypoint text xmlmember name long description put waypoint string attribute attributes el waypoint text attribute short description waypoint text xmlmember name short description waypoint text wpt new waypoint text attributes wpt set exists false return wpt
builds and returns a waypoint text object based on the data in the
public string get chained message string buffer sb new string buffer throwable t this do sb append t get localized message n t t get cause while t null string message sb to string return message
returns the chained message associated with the exception
public string get localized message locale locale if translate return get message messages resource get adapted resource if resource null return get message if get arguments null return resource get message locale get message get arguments else return resource get message locale get message
creates a localized description of this throwable in order to produce a
private string get caller class old string caller try stack trace element stack trace new throwable get stack trace if is mode debug caller stack trace 3 get class name else caller stack trace 2 get class name log debug caller caller is mode debug is mode debug log debug caller class reflection get caller class 3 get name return caller catch no such method error e return noot supported
obsolete method that we maintain provisionally
protected void set id int id id id
used by scale library
public void test to string throws assertion failed exception system out println to string string exp result apakakaburk scale instance new scale exp result new int string result instance to string assert equals exp result result
test of test to string method of class scale
public int get length int length 0 for int i 0 i 12 i if 1 i data 0 length return length
the number of notes in this scale
public void test get common name throws assertion failed exception system out println get common name string exp result apakakaburk scale instance new scale exp result new int string result instance get common name assert equals exp result result
test of test get common name method of class scale
public void test to string throws assertion failed exception system out println to string assert equals 7 interval major seventh to string
test of test to string method of class interval
public note add interval interval char next natural char a symbol a interval degree 1 7 int semitones to next natural get note next natural c distance 12 c distance accidental 12 int remainder degree to semitones interval degree semitones to next natural note note get note next natural remainder accidental interval accidental return note
returns the note acquired by adding the interval to the note
public void test from semitones throws assertion failed exception system out println from semitones test scale note 1 test scale ionian 123456 7 test scale dorian 12b34567 test scale phrygian 1b2b345b67 test scale lydian 123 456 7 test scale mixolydian 1234567 test scale aeolian 12b345b67 test scale locrian 1b2b34b5b67 test scale blues 1b34b557 test scale new scale 6th new int 9 16 test scale new scale 7th new int 10 17
test of test from semitones method of class interval
public void test clone throws assertion failed exception system out println clone
test of test clone method of class interval sequence
public void put scale scale int id library size scale set id id scale names 0 scale get common name id library add element scale
inserts a scale in this library and assigns a unique integer id
public void test reset throws assertion failed exception system out println reset
test of test reset method of class interval sequence
public scale get scale by index int index integer key new integer index scale scale scale library element at index if scale null throw new no such element exception key to string return scale
retrieves a scale by a positive integer index so that 0 index
public scale get scale by name string name for int i 0 i library size i scale scale scale library element at i if scale get common name equals name return scale throw new no such element exception no such scale name
used by unit testing
public void test to string throws assertion failed exception system out println to string
test of test to string method of class note
public string to string return symbol accidental to string accidental
the string representation of the note in english notation system
public void test accidental to string throws assertion failed exception system out println accidental to string
test of test accidental to string method of class note
private void calculate tuning font int string spacing if tuning font l get height string spacing font tuning font l else if tuning font m get height string spacing font tuning font m else font tuning font s
finds the font that fits the magnification level
protected void draw finger graphics g int x int y boolean is root draw finger g x y 6 7 is root
this method belongs to the middle level of the draw finger functions
public void zoom to fit throws ioexception util println zoom to fit int number visible frets app get neck get number frets fretboard set show guide false fretboard set image width width app get neck get number frets number visible frets 1 int new string spacing fretboard get string spacing tuning set string spacing fretboard get string spacing if new string spacing bitmap finger diameter bitmap finger spacing fretboard set finger get bitmap finger else vector finger vf get vector finger fretboard set finger vf fretboard set width width fretboard x position
zooms to fit the entire neck on the available space
public void set label mode int mode label mode mode
controls the information displayed on the finger labels
public void set finger finger finger finger set diameter string spacing 1 finger set label mode finger get label mode finger finger
sets the finger
public void paint graphics g neck neck app get neck graphics offscreen image get graphics offscreen set color 0 draw strings offscreen neck draw frets offscreen neck draw nut offscreen neck draw inlays offscreen neck root fret 1 lowest played fret integer max value highest played fret 0 app get player set listener this off screen graphics offscreen on screen graphics g app get player compose app off screen graphics on screen graphics null draw g offscreen
draws the neck on the graphics object
public void test get number positions throws assertion failed exception system out println get number positions whole neck compositor instance new whole neck compositor assert equals 1 instance get number positions null
test of test get number positions method of class whole neck compositor
public void test get position type name throws assertion failed exception system out println get position type name whole neck compositor instance new whole neck compositor string exp result 1 string result 1 instance get position type name assert equals whole neck result 1
test of test get position type name method of class whole neck compositor
public int get number positions scale scale util println compositor get number positions position sequence positions new position sequence scale get interval sequence min position distance int number positions 1 int interval 0 while interval positions get next 12 number positions return number positions
calculates the number of possible positions subject to the limitation
public void destroy app boolean unconditional util print we re being destroyed program state state program state get instance neck canvas write state state try state storage get instance store state catch record store exception rse util println failed to store state
called to signal the midlet to terminate
public void test get tuning distance throws assertion failed exception system out println get tuning distance neck neck new neck ebgdae assert equals 5 neck tuning distance 6 5 assert equals 5 neck tuning distance 5 4 assert equals 5 neck tuning distance 4 3 assert equals 4 neck tuning distance 3 2 assert equals 5 neck tuning distance 2 1 assert equals 14 neck tuning distance 4 1 assert equals 24 neck tuning distance 6 1
test of test get tuning distance method of class neck
public void test get open notes throws assertion failed exception
test of test get open notes method of class neck
public string get pattern position type name return compositor get position type name
returns the name of the scale pattern position type
public void test get number strings throws assertion failed exception system out println get number strings neck instance null int exp result 1 0 int result 1 instance get number strings assert equals exp result 1 result 1 fail the test case is a prototype
test of test get number strings method of class neck
public void test to string throws assertion failed exception system out println to string neck instance null string exp result 1 string result 1 instance to string assert equals exp result 1 result 1 fail the test case is a prototype
test of test to string method of class neck
public void test get instance throws assertion failed exception system out println get instance application exp result 1 null application result 1 application get instance assert equals exp result 1 result 1 fail the test case is a prototype
test of test get instance method of class application
public void test add listener throws assertion failed exception system out println add listener neck instance null fretboard listener listener 1 null instance add listener listener 1 fail the test case is a prototype
test of test add listener method of class neck
public void test get number frets throws assertion failed exception system out println get number frets neck instance null int exp result 1 0 int result 1 instance get number frets assert equals exp result 1 result 1 fail the test case is a prototype
test of test get number frets method of class neck
public void test set scale throws assertion failed exception system out println set scale application instance null scale scale 1 null instance set scale scale 1 fail the test case is a prototype
test of test set scale method of class application
public void set scale scale scale scale index scale get id make sure that the pattern is still valid for the new scale pattern util frame pattern 1 compositor get number positions scale notify observers
switches scale to the new scale
public void test play throws assertion failed exception system out println play application instance null instance play fail the test case is a prototype
test of test play method of class application
public int tuning distance int low string int high string if low string high string return tuning distance high string low string int distance 0 for int i low string i high string i distance strings i 2 get tuning c distance 12 strings i 1 get tuning c distance 12 util print strings low string 1 get tuning strings high string 1 get tuning distance return distance
the distance in semitones between the open notes of two strings
public void test get neck throws assertion failed exception system out println get neck application instance null neck exp result 1 null neck result 1 instance get neck assert equals exp result 1 result 1 fail the test case is a prototype
test of test get neck method of class application
public void test get number scale positions throws assertion failed exception system out println get number scale positions application instance null int exp result 1 0 int result 1 instance get number scale positions assert equals exp result 1 result 1 fail the test case is a prototype
test of test get number scale positions method of class application
public int get number positions scale scale return 1
when composing on the whole neck there is only one position
public int get interval fretboard event event int interval app get neck get cdistance event get string event get fret app get key c distance 12 12 return interval
computes the number of semitones from the root of the applications
protected void compose neck neck note key scale scale int position interval sequence intervals scale get interval sequence for int string neck get number strings string 1 string rollup the intervals to the open string int rollup 0 int discrepancy neck get cdistance string 12 key c distance 12 while rollup discrepancy rollup intervals get next int fret rollup discrepancy do notify fret played new fretboard event string fret 1 fret intervals get next while fret neck get number frets intervals reset
composes the scale on the entire neck
public void test get scale index throws assertion failed exception system out println get scale index application instance null int exp result 1 0 int result 1 instance get scale index assert equals exp result 1 result 1 fail the test case is a prototype
test of test get scale index method of class application
public void test reset throws assertion failed exception not implemented
test of test reset method of class position sequence
public int get semitone distance fretboard event event return get neck get cdistance event get string event get fret get key c distance 12 12
returns the number of semitones from the root
public void test get pattern position throws assertion failed exception system out println get pattern position application instance null int exp result 1 0 int result 1 instance get pattern position assert equals exp result 1 result 1 fail the test case is a prototype
test of test get pattern position method of class application
public void test set scale index throws assertion failed exception system out println set scale index application instance null int scale index 1 0 instance set scale index scale index 1 fail the test case is a prototype
test of test set scale index method of class application
public void test notify observers throws assertion failed exception system out println notify observers application instance null instance notify observers fail the test case is a prototype
test of test notify observers method of class application
public void test get pattern mode throws assertion failed exception system out println get pattern mode application instance null int exp result 1 0 int result 1 instance get pattern mode assert equals exp result 1 result 1 fail the test case is a prototype
test of test get pattern mode method of class application
public int get neck ypos return get effective finger diameter top padding
the absolute y coordinate of the first string
public void test add observer throws assertion failed exception system out println add observer application instance null observer listener 1 null instance add observer listener 1 fail the test case is a prototype
test of test add observer method of class application
public void test get scale throws assertion failed exception system out println get scale application instance null scale exp result 1 null scale result 1 instance get scale assert equals exp result 1 result 1 fail the test case is a prototype
test of test get scale method of class application
public int get neck width neck neck return get string spacing neck get number strings 1
the width of the neck same as the length of one fret staff
public void test set key throws assertion failed exception system out println set key application instance null note key 1 null instance set key key 1 fail the test case is a prototype
test of test set key method of class application
public void test get key throws assertion failed exception system out println get key application instance null note exp result 1 null note result 1 instance get key assert equals exp result 1 result 1 fail the test case is a prototype
test of test get key method of class application
public int calculate image height neck neck return neck get number strings 1 get string spacing get effective finger diameter 2
the height of the image in pixels
public void test get player throws assertion failed exception system out println get player application instance null compositor exp result 1 null compositor result 1 instance get player assert equals exp result 1 result 1 fail the test case is a prototype
test of test get player method of class application
public void test set pattern mode throws assertion failed exception system out println set pattern mode application instance null int pattern mode 1 0 instance set pattern mode pattern mode 1 fail the test case is a prototype
test of test set pattern mode method of class application
public void test set neck throws assertion failed exception system out println set neck application instance null neck neck 1 null instance set neck neck 1 fail the test case is a prototype
test of test set neck method of class application
public void test set pattern position throws assertion failed exception system out println set pattern position application instance null int position 1 0 instance set pattern position position 1 fail the test case is a prototype
test of test set pattern position method of class application
public boolean open string hostname throws unknown host exception ioexception return open hostname 21
connect to a ftp server on default port 21
public boolean busy return this busy
is the data channel busy
public boolean success return this success
was the file transfer completed
public int transferred return this transferred
how many bytes transferred
public void close this busy false try this data output close this ftpdata close catch ioexception e
close the data connection
public void close this busy false try this data input close this ftpdata close catch ioexception e
close the data connection
public boolean open string hostname int port throws unknown host exception ioexception this host hostname this client new socket hostname port this output new print stream client get output stream this input new buffered reader new input stream reader this client get input stream check if the connection went fine this get response if this response code ready this connected true return true else if connection failes close the socket this connected false this close return false
connect to a ftp server
public boolean close int response code logout from the server if this connected try this command quit catch ioexception e this connected false closing connections try this output close this input close this client close catch ioexception e return this connected
log out from the server and close the connection
public boolean connected return this connected
returns true if connected to a server
public string host return this host
returns the name of the server
public string command string command throws ioexception if debug system out println command this output println command return this get response
execute a command on the server
public boolean login string user string pass throws ioexception this command user user if this response code passwd req this command pass pass if this response code login ok return true else return false else if this response code login ok if just username without password is ok return true else return false
login to a ftp server
public boolean cdup throws ioexception this command cdup if this response code cmd ok system out println changed to parent directory return true else return false
go to parent directory
public boolean mv string from string to throws ioexception this command rnfr from if this response code ren req this command rnto to if this response code cmd ok return true else return false else return false
rename a file or a directory
public boolean mkdir string dir throws ioexception this command mkd dir if this response code dir ok return true else return false
create a directory
public boolean rmdir string dir throws ioexception this command rmd dir if this response code cmd ok return true else return false
delete a directory
public boolean binary throws ioexception this command type i if this response code cfg ok return true else return false
set file transfer mode to binary
public boolean chmod string filename int mod throws ioexception this command site chmod mod filename if this response code cfg ok return true else return false
change file permissions does not work with every server
public int size string filename throws ioexception this command size filename if this response code size string temp string tokenizer temp token stripping out the response code from the response temp token new string tokenizer this response temp temp token next token response code temp temp token next token file size stripping out linefeed from the end of the response temp token new string tokenizer temp n temp temp token next token converting response to integer int number integer parse int temp system out println 2 number return number else return 1
file size in bytes
public boolean get string filename throws ioexception file local file new file filename return get filename local file
download a file from the server
public boolean put file filename throws ioexception return put filename get name filename
upload a file to the server
public boolean put string server file file local file throws ioexception if this busy check if data channel is in use this binary setting server to binary int port this passive setting server to passive opening data channel this put file new put file this host port local file this this put file start start the file upload in new thread this command stor server file if this response code data ok this response code conn ok return true else return false else return false
upload a file to the server and define the server filename
public int transferred if this get file null if this get file busy return this get file transferred else if this put file null if this put file busy return this put file transferred return 1
returns how many bytes are transferred or 1 if no transfer active
public collection get all technologies return technologies values
get an array of known technologies
public technology bean dwr get technology int id return technology bean dwr technologies get new integer id
get a single technology pojo
public boolean delete technology technology bean dwr to delete technology manager remove technology new integer to delete get id return technologies remove new integer to delete get id null
remove a technology from our list of all technologies
public void add technology technology bean dwr to add if to add get id 1 technology manager add technology to add get name technology tec technology manager get technology to add get name to add set id tec get id else technology manager save technology to add get id to add get name technologies put new integer to add get id to add
add a technology to our list of all technologies
private void create technologies set technology tempset technology manager get technologies for technology techno tempset technology bean dwr tec new technology bean dwr tec set id techno get id tec set name techno get name technologies put new integer tec get id tec
setup the list of technologies
protected image resource create image resource string uri image img return new image resource awtfsimage create legacy image img
factory method to generate image resources from a given image
public void clear selection selection end null selection start null int selection start x1 1 selection start x selection start x1 int selection end x1 1 selection end x selection end x1
description of the method
public void update selection box box if box selection end in selection false if box selection start in selection true if box selection end box selection start in selection false
description of the method
public boolean in selection box box if box selection end box selection start return true return in selection
description of the method
public box get selection start return selection start
gets the selection start attribute of the context object