input
stringlengths
10
828
output
stringlengths
5
107
public vector return query as vector string query connection con return execute query query con
the methos return the result of a query as vector
public void add layout component string constraint component comp
other layout manager 2 methods that are unused by this class
public void close synchronized this lock if page null page dispose send page to the printer job end terminate the job
this is the close method that all writer subclasses must implement
public void set font style int style synchronized this lock try to set a new font but restore current one if it fails font current font try font new font monospaced style fontsize catch exception e font current if a page is pending set the new font otherwise newpage will if page null page set font font
set the font style
public void set theme string theme name look up the theme in the resource bundle theme theme new theme resources theme name make it the current theme metal look and feel set current theme theme re apply the metal look and feel to install new theme try uimanager set look and feel new metal look and feel catch unsupported look and feel exception e propagate the new l f across the entire component tree of the frame swing utilities update component tree ui frame
look up the named theme and apply it to the frame
public string get display name string theme name return resources get string theme name name null
get the display name or label of the named theme
public string get default theme name return resources get string default theme null
get the name of the default theme or null
public string get string string key string default value try return bundle get string key catch missing resource exception e return default value
this method is like the inherited get string method except that
public jmenu get theme menu string names get all theme names string default name get default theme name jmenu menu new jmenu themes button group buttongroup new button group for int i 0 i names length i final string theme name names i string display name get display name theme name jmenu item item menu add new jradio button menu item display name buttongroup add item if theme name equals default name item set selected true item add action listener new action listener public void action performed action event event set theme theme name return menu
get a jmenu that lists all known themes by display name and
public boolean get boolean string key throws missing resource exception string s bundle get string key s s to lower case if s equals true return true else if s equals false return false else if s equals yes return true else if s equals no return false else if s equals on return true else if s equals off return false else throw new malformed resource exception boolean key
look up the named resource and try to interpret it as a boolean
public boolean get boolean string key boolean default value try return get boolean key catch missing resource exception e if e instanceof malformed resource exception system err println warning e get message return default value
as above but return the default instead of throwing an exception
public int get int string key int default value try return get int key catch missing resource exception e if e instanceof malformed resource exception system err println warning e get message return default value
as above but with a default value
protected void newline charnum 0 reset character number to 0 linenum increment line number if linenum lines per page if we ve reached the end of page page dispose send page to printer page null but don t start a new page yet
this internal method begins a new line
public double get double string key throws missing resource exception string s bundle get string key try return double parse double s catch number format exception e throw new malformed resource exception double key
return a resource of type double
public double get double string key double default value try return get double key catch missing resource exception e if e instanceof malformed resource exception system err println warning e get message return default value
as above but with a default value
public font get font string key throws missing resource exception font decode always returns a font object so we can t check whether the resource value was well formed or not return font decode bundle get string key
look up the named resource and convert to a font
public font get font string key font default value try return get font key catch missing resource exception e return default value
as above but with a default value
public void action performed action event e object o e get source if o quit system exit 0 else if o print print demo page
handle the button presses
public color get color string key throws missing resource exception try return color decode bundle get string key catch number format exception e it would be useful to try to parse color names here as well as numeric color specifications throw new malformed resource exception color key
look up the named resource and convert to a color
public color get color string key color default value try return get color key catch missing resource exception e if e instanceof malformed resource exception system err println warning e get message return default value
as above but with a default value
public object get resource string key class type object default value try return get resource key type catch missing resource exception e if e instanceof malformed resource exception system err println warning e get message return default value
like the 2 argument version of get resource but return a default value
public void display page string href try display page new url href catch malformed urlexception ex message line set text bad url href
like display page url but takes a string instead
timer animator new javax swing timer 125 new action listener public void action performed action event e animate
this object calls the animate method 8 times a second
protected void select next window jinternal frame frames desktop get all frames for int i 0 i frames length i if frames i get title equals constants order list title continue if frames i is selected find next frame that isn t an icon and can be selected int next i 1 frames length while next i if frames next is icon try all other frames are icons or veto selection frames next set selected true frames next to front frames i to back return catch property veto exception e e print stack trace next next 1 frames length
brings the next non iconified internal frame to the front
protected void open opder table2 front string order id string title order table title 1 order id jinternal frame frames desktop get all frames for int i 0 i frames length i if frames i get title starts with title continue try if frames i is icon frames i set icon false frames i set selected true frames i to front catch property veto exception e e print stack trace return
brings the open opder table frame to the front
private void write string message if message null if log is debug enabled if message starts with password log debug writing message out print message crlf string out flush
writes the specified output message to the client
public void normalise assert is point if is point rt logger global error error vector normalise here do we still want to throw an exception throw new runtime exception error vector normalise double len get mag if len 0 double n factor 1 0 len x n factor y n factor z n factor
normalis a vector
protected boolean is normalised assert is point only making sence if it is a vector if is point rt logger global error error vector normalise throw new runtime exception error vector normalise double eps 1 e 8 double len get mag return len eps 1 0 len eps 1 0
test whether a vector is a unit vector or not
public void add rt vector a assert is point a is point if is point a is point rt logger global error error vector add throw new runtime exception error vector add x a x y a y z a z w a w
add two rtvector instances
public void add double x double y double z this x x this y y this z z
add x y z to an rt vector
public void sub rt vector a assert is vector a is vector if is vector a is point rt logger global error error vector sub throw new runtime exception error vector sub x a x y a y z a z w a w
subtract two rt vector instances
public void scale double s assert is point if is point rt logger global error error vector scale throw new runtime exception error vector scale x s y s z s
scale a vector
public void scale double xs double ys double zs x xs y ys z zs
scaling a vector a different way
public double get mag assert is vector return math sqrt x x y y z z
return the magnitude of a vector
public double get dist to origin assert is point return math sqrt x x y y z z
return the distance from the point to the origin
public boolean is vector return w 0
return true if it is a vector
public boolean is point return w 1
return true if it is a point
public rt vector get normal ray r double t return new rt vector 0 0 1 0 if r u z 0 return new rt vector 0 0 1 0 else return new rt vector 0 0 1 0
get the normal of the hit point
private boolean in shadow ray shadow ray double time to light for int i 0 i the objects size i primitive obj to test primitive the objects get i if obj to test get shader cast shadow continue ray transformed ray new ray shadow ray obj to test get inverse transform double shadow time obj to test find intersect time shadow ray if shadow time 0 shadow time time to light return true return false
receives a ray starts at point u and direction v
public void on console set level level info logger set level level info
switch on the logger
public void off console set level level off logger set level level off
switch off the logger
public color get color assert r 0 g 0 b 0 if r 1 r 1 if g 1 g 1 if b 1 b 1 int rgb 0 rgb int math round r 255 0xff 16 rgb int math round g 255 0xff 8 rgb int math round b 255 0xff return new color rgb
return an instance of java
public int get rgb return get color get rgb
return the integer representation of the rgb value
protected double diff rt color color return math abs r color r math abs g color g math abs b color b 3
find difference between two colors
public ray get mirrored ray ray ray rt vector world normal rt vector world hit out double sf 2 rt vector dot ray getv world normal rt vector sv rt vector scale world normal sf rt vector mirror dir rt vector sub ray getv sv return new ray world hit out mirror dir ray get refractive index
returns the refracted ray
public double get intensity color ambient color new color image get rgb pos x pos y return 0 0 double ambient color get red 255 0
method should return the appropriate intensity value
public rt vector get normal ray r double t switch plane hit case 0 return new rt vector 0 0 1 0 case 1 return new rt vector 0 0 1 0 case 2 return new rt vector 0 1 0 0 case 3 return new rt vector 0 1 0 0 case 4 return new rt vector 1 0 0 0 default return new rt vector 1 0 0 0
get the normal of the hit point
public rt vector get normal ray r double t rt vector v rt vector scale r v t rt vector normal rt vector add r u v normal sub center assert normal is vector return normal
get the normal of the hit point
public double get mag return math sqrt x x y y z z w w
return the magnitude of a quaternion
public string to string return float x t float y t float z t float w
convert the quaternion to a string representation
public string to string string result for int i 0 i 4 i for int j 0 j 4 j result data i 4 j result n return result
returns string of matrix in a human readable format
public rt matrix get inverse transform return inv t
return the inverse of the transformation matrix
public void normalise if is point rt logger global error error vector normalise here do we still want to throw an exception throw new runtime exception error vector normalise double len get mag if len 0 double n factor 1 0 len x n factor y n factor z n factor
normalis a vector
protected boolean is normalised only making sence if it is a vector if is point rt logger global error error vector normalise throw new runtime exception error vector normalise double eps 1 e 8 double len get mag return len eps 1 0 len eps 1 0
test whether a vector is a unit vector or not
public void add rt vector a if is point a is point rt logger global error error vector add throw new runtime exception error vector add x a x y a y z a z w a w
add two rtvector instances
public void sub rt vector a if is vector a is point rt logger global error error vector sub throw new runtime exception error vector sub x a x y a y z a z w a w
subtract two rt vector instances
public void scale double s if is point rt logger global error error vector scale throw new runtime exception error vector scale x s y s z s
scale a vector
public rt color render double x double y double x pos x w view double w image double w view 2 double y pos y h view double h image double h view 2 rt vector dir new rt vector x pos constants camera position x y pos constants camera position y constants camera position z 0 ray to trace new ray constants camera position dir trace a ray and set color return ray trace to trace ref level
render a given point
private hit result get intersection ray ray hit result nearest hit new hit result for int i 0 i the objects size i primitive cur obj primitive the objects get i hit result cur hit info cur obj find intersect info ray if cur hit info num solutions 0 if cur hit info t nearest hit t nearest hit t 0 nearest hit t cur hit info t nearest hit num solutions cur hit info num solutions nearest hit closest cur hit info closest nearest hit prim ray cur hit info prim ray return nearest hit
this receives a ray u v and finds the intersection info
private boolean in shadow ray shadow ray double time to light for int i 0 i the objects size i primitive obj to test primitive the objects get i ray transformed ray new ray shadow ray obj to test get inverse transform double shadow time obj to test find intersect time shadow ray if shadow time 0 shadow time time to light return true return false
receives a ray starts at point u and direction v
public void print matrix for int i 0 i 4 i for int j 0 j 4 j system err print data i 4 j system err println
print out matrix in a human readable format
private boolean in shadow ray shadow ray double time to light for int i 0 i the objects size i primitive obj to test primitive the objects get i ray transformed ray new ray shadow ray obj to test get transform double shadow time obj to test intersect transformed ray if shadow time 0 0 shadow time 0 time to light return true return false
receives a ray starts at point u and direction v
public string read throws ioexception file file new file file name buffered reader reader new buffered reader new java io file reader file long file length file length int array length file length integer max value integer max value int file length char chars new char array length reader read chars return new string chars
reads only first 2 gb of the file
public void open audio source2 src if we have a source already clear off its listeners and dispose of it if this src null this src remove audio state listeners this src close move the slider back to the far left jsld seek set value 0 set the new source this src src set source volume based on the position of the volume slider this src set volume jsld volume get value 100 0 tell the source to open itself this src open
open a given audio source
public void pause file must be open and playing or seeking to pause if opened playing is seeking stopping true tell the listeners were taking a break fire audio state event audio state event audio state pausing
attempt to pause the audio source
public void set volume double gain store the new db value it will be used when a source is opened this d b float math log gain math log 10 0 20 0 if a source is already opened set the new db value if opened gain control set value d b
sets the audio source volume to the gain level specified
public void add tag parse listener tag parse listener tpl tag parse listeners add tpl
adds a tag parse listener to be notified when a stream
public void remove tag parse listener tag parse listener tpl tag parse listeners add tpl
removes a tag parse listener so it wont be notified when
public void fire tag parse event tag parse event tpe for int i 0 i tag parse listeners size i tag parse listener l tag parse listener tag parse listeners get i l tag parsed tpe
fires the given event to all registered listeners
protected void read initial headers throws ioexception string line null while line read crlfline equals int colon index line index of does it have a separator if colon index 1 continue icy tag tag new icy tag line substring 0 colon index line substring colon index 1 system out println tag add tag tag
assuming were at the top of the stream read lines one
public mp3 tag get tag return tag
get the tag that was parsed
public int read throws ioexception if bytes until next metadata 0 bytes until next metadata return super read else if bytes until next metadata 0 we need to read next metadata block read metadata bytes until next metadata metaint 1 1 because we read byte on next line return super read else no metadata in this stream return super read
reads and returns a single byte
public int read byte buf throws ioexception return read buf 0 buf length
trivial code return read buf 0 buf
protected void read metadata throws ioexception int block count super read if debug system out println blockcount block count system out println blocks to read block count int byte count block count 16 16 bytes per block if byte count 0 return wtf byte metadata block new byte byte count int index 0 build an array of this metadata while byte count 0 int bytes read super read metadata block index byte count index bytes read byte count bytes read now parse it if block count 0 parse inline icy tags metadata block read metadata
read the next segment of metadata
protected void add tag icy tag tag tags put tag get name tag fire this as an event too tag parse support fire tag parsed this tag
adds the tag to the hash map of tags we have encountered
public mp3 tag get tag string tag name return mp3 tag tags get tag name
get the named tag from the hash map of headers and
public hash map get tag hash return tags
returns a hash map of all headers and in stream tags
public void add tag parse listener tag parse listener tpl tag parse support add tag parse listener tpl
adds a tag parse listener to be notified when this stream
public void remove tag parse listener tag parse listener tpl tag parse support remove tag parse listener tpl
removes a tag parse listener so it wont be notified when
protected boolean supports persistence return false
file inputs cannot be persisted returns false
protected void on detach if file upload null force close streams on detach file upload close streams file upload null super on detach
clean up at the end of the request
public list infer approximate segments list exact infer segments 0 list approximate infer segments 1 return exact size 2 approximate size exact approximate
creates a java
public list infer exact segments return infer segments 0
creates a java
public void save as file file throws ioexception output stream out stream null try out stream new file output stream file out stream write red out stream write green out stream write blue finally if out stream null try out stream close catch ioexception e
writes this lut object as a lut file
public void state changed change event e build content jcomponent get content pane revalidate
invoked when the target of the listener has changed its state
public iterator points return null
describe code points code method here
public range x range return null
describe code x range code method here
public range y range return null
describe code y range code method here
private void add int insertion point car newcar cars add insertion point newcar
code add int car code helper method which is merely a wrapper
protected car remove float onset car car new car onset 0f 0f int index collections binary search cars car return remove index
code remove code the car which intersects with the supplied
protected void paint component graphics g super paint component g if state selection exists validate cached paint paint domain interval state get original start state get original end cached paint for original selection paint domain interval state get updated start state get updated end cached paint for updated selection
paints the selected region if any using the paint given by get paint
protected car remove int index if index 0 index cars size return null return car cars remove index
code remove code the car with the specified index
protected car delete float onset car car new car onset 0f 0f int index collections binary search cars car return delete index
code delete code the car which intersects with the supplied
protected car delete int index if index 0 index cars size return null we need to know the duration of the car that is being deleted because we need to shift the remaining cars that are to its right car car car cars remove index this should never throw an overlap exception try shift cars index cars size car duration catch overlap exception e e print stack trace throw new runtime exception bug in delete overlap exception should be impossible return car
code delete code the car with the specified index
public int compare to object object car other car object return this onset this duration other onset 1 other onset other duration this onset 1 0
code compare to code part of the java
public boolean equals object object return object instanceof car compare to object 0
code equals code overriden from code object code to compare
public string to string return onset onset duration duration value value n
code to string code convenience method to get a
public void key typed key event e system out println got key typed e get key char
invoked when a key has been typed
protected void paint component graphics g super paint component g double x pixels left clip for iterator u curve points u has next x pixels right clip x map domain xto plot x point2 d u next paint tick mark x map value to color 1 0
draws a tick mark at the x value for each impulse
public dimension get preferred scrollable viewport size return new dimension preferred viewport width get preferred height
returns the preferred size of the viewport for a view component