input
stringlengths 10
828
| output
stringlengths 5
107
|
|---|---|
public dice result roll multiple times int faces int times dice result result new dice result try dice d dice factory create dice faces result set result d roll times result set faces new int faces result set partial results new int d get partial results result set message dice constants success roll catch dice exception e result set message e get message return result
|
this method executes a times dice roll by the number of faces
|
public void set faces int faces this faces faces
|
sets the faces of the dices rolled
|
public void set partial results int partial results this partial results partial results
|
this method sets the rolled dices partial results
|
public void paint direction final graphics2 d g final point origin final point p final random r new random g set color color get hsbcolor r next float r next float r next float if origin null g draw line origin x origin y p x p y else g draw line this my location x this my location y p x p y g set color color black
|
draws a line using the
|
public void register person this building layout insert person
|
autoinstantiates a new person in the building
|
public void register person final point location final int index this building layout insert person this building layout get people index move to location
|
inserts a person at a parameterized particular point in the building
|
public void register destination final string name final room specs rs this building layout add destination name rs
|
adds a destination to the
|
public room specs get destination location final string dst name return this building layout get destination location dst name
|
gets the location as a
|
public void move to final point destination this my location destination this portable device set my location destination
|
moves this person to the parameterized location
|
public void draw directions final graphics2 d g final point origin final point p this portable device paint direction g origin p
|
paints a line in a random color on the parameterized
|
public string get directions final string dst name final point p return this portable device get directions dst name p
|
returns a human readable paragraph of text describing how to navigate
|
private jpanel get ui panel if this ui panel null final border layout border layout new border layout border layout set hgap 6 border layout set vgap 6 this ui panel new jpanel this ui panel set layout border layout this ui panel add get jbutton border layout south this ui panel add get jtext pane border layout center return this ui panel
|
this method initializes ui panel
|
private jbutton get jbutton if this j button null this j button new jbutton this j button set text speak directions this j button add action listener new action listener public void action performed action event arg0 try if main frame this speech process null main frame this speech process destroy main frame this speech process runtime get runtime exec say get jtext pane get text catch exception x joption pane show message dialog main frame this sorry this feature only works in mac os x return this j button
|
this method initializes j button
|
private jtext pane get jtext pane if this j text pane null this j text pane new jtext pane this j text pane set enabled false this j text pane set preferred size new dimension 260 0 return this j text pane
|
this method initializes j text pane
|
private jmenu bar get jjmenu bar if this j jmenu bar null this j jmenu bar new jmenu bar this j jmenu bar add get file menu return this j jmenu bar
|
this method initializes j jmenu bar
|
private jmenu get file menu if this file menu null this file menu new jmenu this file menu set text file this file menu add get nmnu load this file menu add get mnu exit return this file menu
|
this method initializes file menu
|
private jmenu item get nmnu load if this mnu load null this mnu load new jmenu item this mnu load set text load floorplan this mnu load add action listener new java awt event action listener public void action performed final java awt event action event e show floorplan return this mnu load
|
this method initializes nmnu load
|
private jmenu item get mnu exit if this mnu exit null this mnu exit new jmenu item this mnu exit set text exit this mnu exit add action listener new java awt event action listener public void action performed final java awt event action event e system exit 0 return this mnu exit
|
this method initializes mnu exit
|
public void set result valid image types type this result type get result type type get value
|
gets code result code attribute value
|
public void set maxheight float height this max height height
|
gets code maxheight code attribute value
|
public void set maxwidth float width this max width width
|
gets code maxwidth code attribute value
|
public void set area string area this area area
|
gets code area code attribute value
|
public void set bg string bg this background bg
|
gets code bg code attribute value
|
public void set media valid media types media this media type media get value
|
gets code media code attribute value
|
public void set dpi float dpi this dpi dpi
|
gets code dpi code attribute value
|
public void set lang string language this language language
|
gets code lang code attribute value
|
public void set classname string value this reader class name value
|
sets classname of an xml parser
|
public void set dest file file this dest file file
|
gets code dest code attribute value
|
public void set srcdir file dir this src dir dir
|
gets code srcdir code attribute value
|
protected destination type get result type string type if type equals destination type png str return destination type png else if type equals destination type jpeg str return destination type jpeg else if type equals destination type tiff str return destination type tiff else if type equals destination type pdf str return destination type pdf return null
|
returns the correct result image type object
|
protected boolean allowed to set quality destination type type if type to string equals destination type jpeg str return false return true
|
checks if the quality value can be set
|
private string get parser class name final string class name string name class name if class name equals jaxp parser set first jaxp parser throws build exception xmlreader reader jaxputils get xmlreader name reader get class get name log using class name to parse svg documents project msg verbose return name
|
returns name of an xml parser
|
public tick data point to tick tick data point tick new tick data point tick set buy get buy open tick set data source get data source tick set date time get date time tick set instrument get instrument tick set sell get sell open tick set buy volume get buy volume tick set sell volume get sell volume return tick
|
convert the candle to a tick based on opening price
|
public int get change return int buy close buy open get instrument pip value
|
the difference between the open close prices in points
|
public candle data point get candle time of week time int idx time period of week period start idx if is empty candle idx return null else return get candle idx
|
get the candle opening at or containing the specified time
|
public boolean exists fxdata request request file file file locator locate request get data source request get instrument request get date request get period return file exists
|
does the requested data exist in the local data store
|
private candle week retrieve fxdata request request throws ioexception return retrieve request get data source request get instrument request get date request get period
|
read from the local data store
|
private candle week retrieve fxdata source data source instrument instrument local date date period period throws ioexception candle week cw null if date null locate the data file file file file locator locate data source instrument date period log debug locating data store at file if file exists object input stream ois new object input stream new file input stream file try cw candle week ois read object ois close catch class not found exception ex log error error attempting to load from datastore ex finally ois close return cw
|
read from the local data store
|
public void clear store cache throws ioexception file store cache root new file file locator get data root file utils delete directory store cache root
|
wipe the local data store
|
public void add layout component component comp object constraints components add comp
|
adds a component to the layout using constraints provided
|
public void add layout component string name component comp components add comp
|
adds a component to the layout by name
|
public dimension minimum layout size container target insets insets target get insets int height 0 int width 0 for int i 0 i components size i component comp components get i dimension comp size comp get minimum size height comp size height if width comp size width width comp size width height components size 1 vertical gap return new dimension width insets left insets right height insets top insets bottom
|
retrieve the minimum size that this layout requires
|
public dimension preferred layout size container target insets insets target get insets int height 0 int width 0 for int i 0 i components size i component comp components get i dimension comp size comp get preferred size height comp size height if width comp size width width comp size width height components size 1 vertical gap return new dimension width insets left insets right height insets top insets bottom
|
retrieve the preferred size for the layout
|
public dimension maximum layout size container target insets insets target get insets int height 0 int width 0 for int i 0 i components size i component comp components get i dimension comp size comp get maximum size height comp size height if width comp size width width comp size width height components size 1 vertical gap return new dimension width insets left insets right height insets top insets bottom
|
retrieve the maximum size that this layout would need
|
public boolean has next job synchronized job allocation semaphore return block pointer permutations running
|
are there more jobs to be executed
|
public order book execute candle collection cc local date time date cc get start int idx 0 while keep going date is before cc get end candle week cw cc get candle week date for int i 0 n cw get candle count i n keep going i candle cw get candle i idx date date plus days 7 if keep going break return get order book
|
execute the test with all strategies
|
protected void close order btorder order candle data point candle order set close price get close price order candle order set close type get close type order candle order set close time candle get date time order book close order
|
close an order
|
public void set cabecera string ruta cabecera ca cabecera get bean cabecera ca set path ruta
|
p callback method that is called whenever a page containing
|
public boolean get orientation change return orientation change
|
gets the orientation change value
|
public void set orientation change boolean orientation change this orientation change orientation change
|
sets the orientation change value true radio button group is visivble
|
public void select orientation value change event event string temp title x if event get new value equals true set the orientation and reverse the axis labels horizontal true title x title y title y temp else set the orientation and reverse the axis labels horizontal false title x title y title y temp render the chart chart changed flag true
|
method called when the orientation is change by the user
|
public string get title x return title x
|
gets the title of the x axis
|
public void set title x string title x this title x title x
|
sets the title of the x axis
|
public string get title y return title y
|
gets the title of the y axis
|
public void set title y string title y this title y title y
|
sets the title of the y axis
|
public boolean new chart output chart component if chart changed flag chart changed flag false return true else return chart changed flag
|
determines whether or not the application should render based on status change
|
public void init perform initializations inherited from our superclass super init perform application initialization that must complete before managed components are initialized todo add your own initialiation code here editor fold defaultstate collapsed desc managed component initialization initialize automatically managed components note this logic should not be modified try init catch exception e log session bean1 initialization failure e throw e instanceof faces exception faces exception e new faces exception e editor fold perform application initialization that must complete after managed components are initialized todo add your own initialization code here set empleado new empleado
|
p this method is called when this bean is initially added to
|
public void stop set the thread to stop running is running false interrupt the thread so the user gets an immediate response if progress thread null progress thread interrupt
|
method to stop the progress thread
|
public string get character return character
|
return the character
|
public element save throws exception element em new element model element ec new element character ec set text string value of character em add content ec element ed new element dominant ed set text string value of dominant em add content ed element er new element recessive er set text string value of recessive em add content er return em
|
save this model in the jdom element format
|
private cage find cage array list cages int cid throws exception for int i 0 i cages size i cage c cage cages get i if c get id cid return c throw new genetics exception cannot find the specified cage
|
return the cage which id is the given cid
|
public element save throws exception element em new element model element ec new element character ec set text string value of character em add content ec element eho a new element homozygote a eho a set text string value of homo a em add content eho a element eho b new element homozygote b eho b set text string value of homo b em add content eho b element eho c new element homozygote c eho c set text string value of homo c em add content eho c return em
|
save this model in the jdom element format
|
public string get model info string buffer s new string buffer s append the current model is append get model name s append n the character is append character s append n the dominant trait is append dominant s append n the recessive trait is append recessive if get model no 3 s append n xx female xy male if get model no 5 s append n zz male zw female s append return s to string
|
return the model information
|
public string get model name return model 6 sex linked zw female zz male incomplete dominance
|
return the model name
|
public string get model info string buffer s new string buffer s append the current model is append get model name s append n the character is append character s append n homozygote trait a is append homo a s append n homozygote trait b is append homo b s append n homozygote trait c is append homo c if get model no 9 get model no 10 s append n xx female xy male if get model no 11 get model no 12 s append n zz male zw female s append return s to string
|
return the model information
|
public string to string string buffer s new string buffer s append n t character append character s append n t dominant append dominant s append n t recessive append recessive return s to string
|
for ascii printing purpose
|
public int get model no return 6
|
return the model number
|
public string to string string buffer s new string buffer s append n t character append character s append n t homozygote a append homo a s append n t homozygote b append homo b s append n t homozygote c append homo c return s to string
|
for ascii printing purpose
|
public void set cage id int i cage id i
|
set the cages id
|
private int get random sex type int num random next int 100 if num 50 return 0 male else return 1 female
|
return the sex type randomly chosen
|
public int get cage id return cage id
|
return the cages id which the organism is in
|
public void add organism organism o string phenotype o set cage id id o set id count count olist l olist children get phenotype if l null no such phenotype so create new array l new olist l add o children put phenotype l
|
add the given organism to the cage according to its phenotype
|
public cage populate cage c new cage 0 get the random number for amount of organism 20 40 int count random next int 20 0 19 count count 20 for int i 0 i count i int num1 random next int 100 first allele if num1 0 num1 33 c add organism new organism get random sex type homo1 homo1 homo1 2 homo1 else if num1 33 num1 66 c add organism new organism get random sex type homo1 homo2 hete 2 hete else c add organism new organism get random sex type homo2 homo2 homo2 2 homo2 return c
|
create the field population cage and return it
|
public int get sex type return sex
|
return the sex type
|
public string get character if character 0 return string character list get character else return null
|
return the character which is randomly chosen
|
public string get model name return model 2 autosomal incomplete dominance
|
return the model name
|
public organism get organism string p int id throws exception olist l olist children get p if l null return organism l find id throw new genetics exception cannot find the specified phenotype
|
return the organism at the given phenotype and index
|
public string get sex string if sex 0 return male else return female
|
return the sex type in string format
|
public string get genotype1 if genotype1 0 return string available traits get genotype1 else return null
|
return the first trait which is randomly chosen
|
public int get model no return 2
|
return the model number
|
public string get allele1 return allele1
|
return the first allele
|
public string get genotype2 if genotype2 0 return string available traits get genotype2 else return null
|
return the second trait which is randomly chosen
|
public array list get parents array list temp new array list temp add parent1 temp add parent2 return temp
|
return the two parents in the array list
|
public string get genotype1 if allele1 null if model no 3 model no 4 return y else if model no 5 model no 6 return w return allele1
|
return the first allele genotype
|
public string get genotype3 if genotype3 0 return string available traits get genotype3 else return null
|
return the third trait which is randomly chosen
|
public string get model name return model 9 sex linked xx female xy male n3 allele hierarchical dominance n a dominant to b and c b dominant to c c recessive to all
|
return the model name
|
public string get allele2 return allele2
|
return the second allele
|
public int get model no return 9
|
return the model number
|
public element save throws exception element traits new element traits element c new element character c set text string value of character traits add content c element g1 new element genotype1 g1 set text string value of genotype1 traits add content g1 element g2 new element genotype2 g2 set text string value of genotype2 traits add content g2 element g3 new element genotype3 g3 set text string value of genotype3 traits add content g3 return traits
|
save this traits values in the jdom element format
|
public string get genotype2 if allele2 null if model no 3 model no 4 return y else if model no 5 model no 6 return w return allele2
|
return the second allele genotype
|
public element save throws exception element em new element model element ec new element character ec set text string value of character em add content ec element ehe new element heterozygote ehe set text string value of hete em add content ehe element eho1 new element homozygote1 eho1 set text string value of homo1 em add content eho1 element eho2 new element homozygote2 eho2 set text string value of homo2 em add content eho2 return em
|
save this model in the jdom element format
|
public string get model info string buffer s new string buffer s append the current model is append get model name s append n the character is append character s append n the heterozygote trait is append hete s append n the first homozygote trait is append homo1 s append n the second homozygote trait is append homo2 if get model no 4 s append n xx female xy male if get model no 6 s append n zz male zw female s append return s to string
|
return the model information
|
private void update display label if m display label null string male info string female info if m male parent null organism o1 m male parent get organism male info male cage o1 get cage id 1 o1 get phenotype if m female parent null organism o2 m female parent get organism female info female cage o2 get cage id 1 o2 get phenotype m display label set text m display label repaint m display label set text female info male info m display label repaint
|
refreshes the display label to display the current male female organism
|
public string get phenotype return phenotype
|
return the phenotype
|
public string to string string buffer s new string buffer s append n t character append character s append n t heterozygote append hete s append n t homozygote1 append homo1 s append n t homozygote2 append homo2 return s to string
|
for ascii printing purpose
|
public void add organism o if o get sex type 0 if male add from front elements add 0 o male count else if o get sex type 1 if female add from end elements add o female count
|
add the given organism
|
public organism get int index return organism elements get index
|
return the organism which is at the given index
|
public element save throws exception element orga new element organism orga set attribute model no string value of model no orga set attribute id string value of id orga set attribute cage id string value of cage id orga set attribute sex type string value of sex if allele1 null orga set attribute allele1 string value of allele1 if allele2 null orga set attribute allele2 string value of allele2 if phenotype null orga set attribute phenotype string value of phenotype return orga
|
save this organism in the jdom element format
|
public organism find int id throws exception for int i 0 i elements size i organism o organism elements get i if o get id id return o throw new genetics exception cannot find organism
|
return the organism which has the given id
|
public int get male count return male count
|
return the number of male
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.