input
stringlengths
10
828
output
stringlengths
5
107
protected void paint component graphics g super paint component g reset fractional pixel plot curve flush fractional pixel
renders a curve object as a 1 d intensity plot
public void test oscillating plot y normalizer interpolator create 1 0 1 1 double domain span domain max domain min point2 d curr point null for int i 0 i 160000 i point2 d prev point curr point double x domain min domain span math pow i 0 25 20 0 curr point new point2 d double x math sin math pi i 64 0 if prev point null paint segment prev point curr point set curve curve
this method is for testing purposes
public void mouse pressed mouse event e if mouse is enabled double x round to tick in normal domain e get x if x clip to domain x edit mark reset edit point reset else if edit point equals edit mark edit point get x edit mark reset edit point set from mouse e
invoked when a mouse button has been pressed on a component
private double get ymin curve curve if curve y range null return curve y range get min double min double positive infinity for iterator u curve points u has next min math min min point2 d u next get y return double is infinite min 0 min
presumably temporary hopefully in future intensity plotters input will
private double get ymax curve curve if curve y range null return curve y range get max double max double negative infinity for iterator u curve points u has next max math max max point2 d u next get y return double is infinite max 0 max
presumably temporary hopefully in future intensity plotters input will
public void paint domain tick mark double x paint paint paint domain tick mark x paint default tick stroke
draws a tick mark at the specified x value using the specified paint
public void paint domain interval double x1 double x2 paint paint paint domain interval x1 x2 paint true true
paints a specified interval of the plot using the specified paint
public void mouse entered mouse event e if tool tip manager is mouse listener tool tip manager mouse entered e
invoked when the mouse enters a component
public void mouse exited mouse event e if tool tip manager is mouse listener tool tip manager mouse exited e
invoked when the mouse exits a component
public void mouse dragged mouse event e mouse moved e if mouse is enabled if edit mark is set edit mark copy from edit point edit point set from mouse e
invoked when a mouse button is pressed on a component and then
public void mouse moved mouse event e if tool tip manager is mouse motion listener tool tip manager mouse moved e
invoked when the mouse button has been moved on a component
public int get layer num with defined cross hairs boolean must be absolute int num layers get num layers for int i num layers i 0 if get layer i get cross hair positions must be absolute null return i throw new usage exception no layer with defined crosshairs exists
find crosshairs from layer return the largest layer number such that the
public void set picture filter settings int num picture filter settings set if num pfs length pfs num set
set pic filt settings array val num to pfs set
public void set cross hair position view model view model double ch position throws exception ch set position ch position ch set true
set the crosshairs position for the first layer currently in the overlay spec
public dimension minimum layout size container target set container properties target return util add insets get tile size get preferred scale target
calculates the minimum size dimensions for the specified
public dimension preferred layout size container target set container properties target return compute layout size target get preferred scale preferred aspect ratio
calculates the preferred size dimensions for the specified
public void update slice indices update slice indices false
this method uses an obsolete approach to calculate z index values
public void update slice indices without double checking int layer num mosaic model get current reference layer layer display model layer model mosaic model overlay display model get layer layer num for int i mosaic tiles length i 0 double depths layer model convert canonical index to depths in layer mosaic tiles i get canonical cross hair positions mosaic tiles i set zindex value depths mosaic model slice zaxis id dim num mosaic model num layers 1 layer num
computes each mosaic tiles z index value with respect to the current
public void state changed change event e overlay display model odm view model get overlay display model if odm get num layers 1 check layer compatibility odm
invoked when the target of the listener has changed its state
public void state changed change event e write path field
invoked when the layer selection changes
public void open scene string path try if path ends with csv array list data points dcsearch driver get points from file path open scene data points else uri uri uris default to file uri new uri path trim new scene builder scene uri path build scene view model this catch exception ex ex print stack trace the following six lines are replicated all over the place they should be refactored string message ex get message if string util is missing message trim message ex to string joption pane show message dialog this message invalid path joption pane error message
open a viewer window to display the file or files on the path
public void open scene array list points if points size 1 return double pt dcsearch driver get coord from point points get 0 open scene points pt
open the viewer to display the points over the reference file
public void action performed action event e if constants int to string constants action define timec equals e get action command run name null regressor name null open tce
this action is called when the matrix editor button is pressed
public color set color color c if c null log default log out bad assignment to regressor color null is not valid log warning else regressor chart properties set regressor color regressor name c regressor color regressor chart properties get regressor color regressor name return regressor color
set the color to the specified if non null color
public boolean equals image meta data other if other null return false return this run name null this run name equals other run name this regressor name null this regressor name equals other regressor name
image meta data is equal if run name and regressor name are equal
private image meta data get image meta data point p int index this location to index p image meta data image md null if index 0 image md image meta data this get model get element at index if image md null log out drag list get image meta data index index run image md run name reg image md regressor name log debug return image md
return the image meta data under the point
private void show row gui regressor table add rows gui table add rows gui regressor table data model datamodel regressor data get delegate jframe frame null java awt container con this while con null con con get parent if con instanceof jframe frame jframe con table add rows gui new regressor table add rows gui datamodel frame table add rows gui show break if frame null log default log out no jframe found to handle insert try the menu log warning return
show the run regressor adding gui
public void update chart string key string chart list get selected item check for no selected items if key null 1 key index of log default log out this no valid item selected no chart can be selected log warning return string run key substring 0 key index of string reg key substring key index of 1 key length regressor data set subset run reg this set chart key return
display the chart for the selected item in the chartlist combobox
public boolean remove int column image meta data img md active image data aid point p1 aid point hash map image list get column active image data adata null object removed null if image list null removed image list remove aid if removed null log out mdm remove did not find col column img md to string aid to string log warning return false update sorted cols column log out mdm removing col column img md to string aid to string log debug return true
removed the specified item from the column and model
public iterator get sorted column iterator int col if sorted cols null sorted cols new hash map integer key col new integer col vector v vector sorted cols get key col if v null v update sorted cols col if v null v new vector iterator sorted images v iterator return sorted images
return the sorted iterator for this colum if one exists
protected vector update sorted cols int col if sorted cols null sorted cols new hash map integer key col new integer col hash map unsorted col hash map get col vector v sort image list unsorted col sorted cols put key col v return v
update the sorted vector for the column
protected void do add jcomponent c if c validate all form components null return run name string run name field get normalized value regressor string regressor field get normalized value onset double onset field get normalized value double value duration double duration field get normalized value double value value double value field get normalized value double value regressor data add row run name regressor onset duration value onset field set text duration field set text value field set text run name field request focus
if the values present make a valid element add it to
private jcomponent validate all form components object o validatable field f jcomponent c err err null for int i 0 i form components size i o form components element at i if o instanceof validatable field f validatable field o c jcomponent o if f is valid value set alert component c err c return err
checks the form components list
private void set alert component jcomponent c c set border alert border c set enabled true
give the alert component a new border
private void clear alert component jcomponent c c set border normal border
remove the alert status from this component
public void set display string run string reg regressor data chart panes display run reg run reg
display the info and chart for the run and regressor
public double get onset time int row double d double get value at row onset time column return d double value
return the onset value as a double handles all the class casting
public double get duration int row double d double get value at row duration column return d double value
return the duration as a double handles all the class casting
public double get value int row double d double get value at row value column return d double value
return the value as a double handles all the class casting
public void test get selected array list out int out size exp size test data data source get test points 10 dp new display pane dp setup display test data point table model get default display array exp size 0 out dp get selected out size out size assert equals exp size out size
a weak test no selections made
public void test get selected or all array list out int out size exp size test data data source get test points 10 dp new display pane dp setup display test data point table model get default display array exp size 10 got 10 points in setup out dp get selected or all out size out size assert equals exp size out size
a weak test no selections made
public int get field for column int index if index display array length return display array index log out display error index index log error return display array 0
get the point field associated with the column index
public int set size int new size size new size return size
set the size number of values to be returned of the search
public int get prefered table width int width 0 int field 1 for int i 0 i display array length i field display array i if field point get field widths length width point get field widths field else width default width return width
sum the default widths for the fields in the display array
public int get diff field if has difference return difference field return 1
has this search got a difference operation
public string get diff val if has difference return difference value return null
the string value to be searched around with difference
public int add term int field int op string value if check op op log out no such op op log warning return 1 if point get field name field null error will be logged by point if bad field return 2 if op difference if has difference log out multiple differences log error return 3 difference field field difference value value has difference true should we add a term to the search return filter values size search term s new search term field op value filter values add s return filter values size
add a search term to the list of terms in the search
public class get column class int c int column get field for column c switch column all classes return as strings default return string class
overide the default class return of object
public void test decode line5 string testcols l precentral gyrus knob 4 m1 36 23 49 t 12574475 movement imagine movement file format format new file format try format set order map long cols catch data format exception e assert true false if we get here it is an error string out file data source decode line map long line format ignore null compare string arrays testcols out
test map with skip fields
public void test decode line7 string line a b c d e f g string out file data source decode line line new file format assert true out null
test the comment skipping
public void test decode line8 string refcols l precentral gyrus knob 36 23 49 t 12574475 movement imagine movement string empty line empty line l precentral gyrus knob 36 23 49 t 12574475 movement imagine movement int format cols 0 1 2 3 4 5 6 7 8 point grant id point fmridc id file format format new file format try format set order format cols catch data format exception e assert true false if we get here it is an error string out file data source decode line empty line format ignore null compare string arrays refcols out
test parsing when trailing empty commas are ommitted
public void test remove largest diff1 array list results get points for int i 0 i results size i point p point results get i p set difference 1 point p point results get 1 p set difference 10 file data source remove largest diff results assert equals results size 9 assert false results contains p
test the remove largest diff function from the
public boolean equals file format ff int other order ff get order if other order length column order length return false for int i 0 i column order length i if other order i column order i return false return true
two formats are equal if their maps are the same
public int get cols return column order length
the number of columns in the format including ignored fields
public int get num data cols return this valid fields
the number of columns in the map containing data not ignored
public string to string if column order length 0 return no format defined string s format format column order 0 for int i 1 i column order length i s format s format column order i return s format
the format as a string
public void test remove largest diff2 array list results get points for int i 0 i results size i point p point results get i p set difference 1 point p1 point results get 1 p1 set difference 10 point p2 point results get 1 p2 set difference 10 file data source remove largest diff results assert equals results size 9 assert false results contains p1
test2 a pair of pts with same diff
public void load load my file name
load the specfied file in the datasource
public void test search4 array list points get points array list results null file data source fds new file data source fds load test points results fds search new search should get just one point from the search assert equals results size 0
test searches with empty search object
public string get image file name return this image file name
get the name of the image file if any was specified
public void set image file name string name this image file name name
not sure this should be settable directly
public array list search int field point ref int num return search field ref get field field num
wrapper to allow search vs point not just data field
public void load test array list points out checkpoint loading points points size for testing log debug data points points
for testing allow outside source to specify the data used
public int get num points if data points null return 0 return data points size
how many points are in this file
public array list search int field point p1 return search field p1 default result size
see search field p1 num
public void test parse1 simple basic case string line format 2 1 3 4 5 6 7 8 9 10 11 12 13 14 15 0 int map 2 1 3 4 5 6 7 8 9 10 11 12 13 14 15 0 file format ff file data source parse format line assert equals ff get num data cols 16 compare int arrays map ff get order
mapping works as established in the decode tests
public string get short sys if short sys null short sys data coordinate system substring 0 1 to upper case return short sys
return a 1 letter label for the coordinate system
protected boolean set data source string s if data data source null equals data data source trim data data source s return true return false
datasource is an id of where the information
public void out string message int level log out message level
allow debug levels of output
public void load load my dburl
load just makes sure the connection is valid for a db
public int log search search s if search logging is selected session id session get session id session report search s return 1
attempt to log the search to the f mri dc database
public int get session id if session id 0 string response return session id
ask the fmridc db for a session id
public void test is cell editable the default display ar ptm new point table model get points int max ptm get column count int num rows 10 number of points returned by get points for int i 0 i max i for int j 0 j num rows j assert true ptm is cell editable j i
no cells should be editable
public void test get display column int da1 3 2 1 ptm gptm da1 assert equals ptm get field for column 0 3 assert equals ptm get field for column 1 2 assert equals ptm get field for column 2 1 test the overflow case return field 3 from pos 0 and report an error assert equals ptm get field for column 3 3 string errmsg log get last message from buffer log out display error index index log error assert true errmsg ends with index 3
test the column lookup functions
public void state changed change event e if the list of displayed items does not match the the checkboxes we need to enable the refresh display item int new display get display array from menu boolean enable refresh false if display array length new display length enable refresh true else for int i 0 i display array length i if display array i new display i enable refresh true if enable refresh reset the display array display array get display array from menu display pane set display array display array display pane revalidate
notice when one of the display menu checkbox items is toggled
public void csvto sql string csv file string sql file array list points points from db array list points points from file csv file string sql generate sql points write output sql sql file system out println done
do the whole process from csv to sql file
protected string generate study sql string pubmed string fmri string sql update study table set fmridc id fmri where pubmed id pubmed and fmridc id is null return sql
compose the sql for the study table
protected string get data value string val int spot val index of while val index of 0 this is a problem replace with val val replace while val index of 0 this is a problem val val replace return val
modify the string to make sure no illegal values in it
public void csvto sql string csv file string sql file array list points points from file csv file array list points points from db string sql generate sql points write output sql sql file
do the whole process from csv to sql file
protected void get dbsource try data new dbdata source for now just default source current datasource set text f mri data center online catch exception e log out dcsearch could not open db e e get localized message log error
this is currently redundant with the get url source the db output
public void set display array int display array model null table null sorter null setup display data display array
reset the display for different columns
public void set sort order int col if col 1 return sorter set sorting status col table sorter ascending
sort the display values of the column
public array list get selected array list selected new array list int rows table get selected rows for int i 0 i rows length i point p point data get rows i selected add p log out checkpoint returning selected size selected points log debug return selected
return an array list containing all the selected points
protected void set data source data source ds data ds
for testing allow specification of the data source externally
public array list get data return data
get all the data points
public int get col for x int x java awt point p new java awt point x 1 int tab col table column at point p int real col table convert column index to model tab col log out display pane get col for x raw table column tab col real col real col log debug return real col
for a given display x coord get the data column
public int get row for y int y int h table get row height int row 0 while y h row y y h if row table get row count return 1 log out display pane get row for y raw table row row log debug return row
get the row underneath the y coords
protected jtable make jtable table sorter sorter jtable table new jtable sorter implement table header tool tips protected jtable header create default table header return new jtable header column model public string get tool tip text mouse event e java awt point p e get point int col get col for x p x int real col model get field for column col return point get field desc real col return table
make a custom jtable to handle the tooltiptext on column headers
private int real col int column first convert back from moved column int modelcol table convert column index to model column then translate back within the model int real col model get field for column modelcol log out display pane real col raw column column model modelcol real real col log debug return real col
consult with the model to get the data column matching
public string get cell value int row int col string cell value sorter get value at row col log out displaypane sorter value at row row col col is cell value log debug return cell value
this is to help with testing
public boolean report search search s string search report if no report return false search report compose search report s for int i 0 i search report length i open url get urlcontent search report i return true
report the search to the db report success fail
public string filter to string search term st string op search ops st op string field point get field name st field string val search report url session id session id search id search number field safe field st field operator op substring 0 2 value open url safe url st value return val
generate the http post for the given filter
public int get session id log out session manager get session id session id log debug int temp 0 if session id 0 temp get new session id if temp 1 log out session manager session id failure temp temp session session id log warning else session id temp return session id
ask the db for a session id if none return 1
public int compare to final object object double this x this x double other x if object instanceof transition other x transition object x else if object instanceof number other x number object double value else throw new illegal argument exception transition compare to object object must be either a transition or number object return this x other x 1 this x other x 0 1
code compare to code provides the natural ordering
public int compare to object o real num other real num o if is na n other is na n throw new illegal argument exception cannot compare na n else if other instanceof big decimal num return other compare to this else return double compare double value other double value
inefficient imprecise implementation of code compare to code
public boolean equals object obj return obj instanceof real num compare to obj 0
inefficient imprecise implementation of code equals code
public boolean equals object obj return obj instanceof big decimal num value equals big decimal num obj value
caution as in the case of code java
public boolean equals object obj return obj instanceof double num value double num obj value
caution as in the case of code java
public void read in streamer source hierarchy hierarchy throws ioexception new reader source hierarchy read in
reads in the specified hierarchys header information from the specified
protected void fire state changed change event event if initialized entry put double get value super fire state changed event
invoked when this instance wishes to propagate a state change to