input
stringlengths
10
828
output
stringlengths
5
107
public string get current indentation if is indentation string buffer tabs new string buffer for int i 0 i get current indetation count i tabs append tab return tabs to string else return
generates the current tab indentation
public int get inital tab count return inital tab count
the initial tab count
public int get current indetation count return tab count
returns the current tab count
public int get current recursive count return recursive count
returns the current recursive count
private string fix pattern string p return p replace all
pattern can be of form val
public void add function string name list commands debug adding function name commands functions put name commands
adds a new function to this shell
public list tokenize string s linked list l new linked list string tokenizer st new string tokenizer s boolean escaped space false while st has more tokens string nv st next token if escaped space string prev string l get l size 1 string escaped string prev substring 0 prev length 1 nv l set l size 1 escaped string else l add nv if nv ends with escaped space true else escaped space false return l
tokenizes given argument
private object instantiate list args object o null string c name null try c name string args remove 0 class c class for name c name todo constructor args o c new instance catch class not found exception cnfe system out println class not found c name catch exception e return o
first arg is the class name
public string get option char opt return string options get opt
gets the value of given option
public game player kick player string str player check arguments are valid and if commanding player has rights to kick if this is admin game player player null try try to kick player by id player server get player by id integer parse int str player catch number format exception e try kick by name if id failed player server get player by name str player if player null if player found close connection and return kicked player player close return player return null
kick a player the kicked player will be disconnected from the server
public void append string string text attribute set a batch add new batch element text a
adds a string assumed to not contain linefeeds for
public void append line feed attribute set a batch add new batch element n a
adds a linefeed for later batch processing
public void add current pass new passenger name passport seat pref passengers add current pass selected trip num passengers
add a passenger to the list passenger and decrement the counter of remaining
public void set j2 dacolor color this red color red this blue color blue this green color green this alpha color alpha
sets the color
public j2 dacolor darker return new j2 dacolor red 0 1f green 0 1f blue 0 1f alpha 0 1f
creates a darker version of this color
public j2 dacolor lighter return new j2 dacolor red 0 1f green 0 1f blue 0 1f alpha 0 1f
creates a lighter version of this color
public color to awtcolor return new color red green blue alpha
creates te awt version of this color
public game panel get game panel game frame renderer renderer return new jogl game panel renderer
returns a game panel
public game frame get game frame game frame renderer renderer string title int width int height boolean decorated return new jogl game frame renderer title width height decorated
returns a windowed game frame
private void init panel int width int height this width width this height height hack for now int bpp 32 glcapabilities caps new glcapabilities caps set red bits bpp 4 caps set green bits bpp 4 caps set blue bits bpp 4 caps set alpha bits bpp 4 canvas gldrawable factory get factory create glcanvas caps canvas add glevent listener this canvas set no auto redraw mode true canvas set focusable true canvas request focus animator new animator canvas set layout new border layout add canvas
initialise this panel
public game frame get game frame game frame renderer renderer string title int width int height int bpp int refresh return new jogl game frame renderer title width height bpp refresh
returns a fullscreen game frame
public void start animator start
starts the game panel
public sprite get sprite game panel game panel string ref throws ioexception return new jogl sprite game panel ref
returns a sprite
public void draw int xpos int ypos int grid x int grid y gl gl push matrix tex bind gl gl gl translatef xpos ypos 0 gl gl call list base grid x grid y xcount gl gl pop matrix
draws a single sprite element
public sprite sheet get sprite sheet game panel game panel string ref int xcount int ycount throws ioexception return new jogl sprite sheet game panel ref xcount ycount
returns a sprite sheet
public void stop animator stop
stops the game panel
public void draw int xpos int ypos float rotation int grid x int grid y gl gl push matrix tex bind gl gl gl translatef xpos ypos 0 gl gl rotatef rotation 0 0 1 gl gl call list base grid x grid y xcount gl gl pop matrix
draws a single sprite element
public void draw line int x1 int y1 int x2 int y2 draw line x1 y1 x2 y2 j2 dacolor white
draw a white line
public bitmap font get bitmap font game panel game panel string ref int xcount int ycount throws ioexception return new jogl bitmap font game panel ref xcount ycount
returns a bitmap font
public geom drawer get geom drawer game panel game panel return new jogl geom drawer game panel
returns the geometry drawer for a given game frame
public sprite get sprite game panel game panel image image throws ioexception return new jogl sprite game panel image
build a sprite from a specified image
public void draw line int x1 int y1 int x2 int y2 j2 dacolor color gl gl push matrix gl gl bind texture gl gl texture 2 d 0 gl gl line width 2 0f gl gl translatef x1 y1 0 0f gl gl color4f color red color green color blue color alpha gl gl begin gl gl lines gl gl vertex2d 0 0 gl gl vertex2d x2 x1 y2 y1 gl gl end gl gl color3f 1 1 1 gl gl pop matrix
draws a colored line
public void set buffered image buffered image buffer this buffer buffer
set the buffered image this texture came from
public void dispose animator stop stop renderer true
disposes this game panel
public void draw rect rectangle rectangle draw rect rectangle x rectangle y rectangle width rectangle height j2 dacolor white
draw a white rectangle
public void draw rect rectangle rectangle j2 dacolor color draw rect rectangle x rectangle y rectangle width rectangle height color
draws a colored rectangle
public void draw rect int x int y int width int height draw rect x y width height j2 dacolor white
draw a white rectangle
public void display gldrawable drawable if stop renderer return if is visible return gl gl clear gl gl color buffer bit gl gl depth buffer bit gl gl matrix mode gl gl modelview gl gl load identity gl gl translatef float xoffset float yoffset 0 draw gl gl flush frame count if time util get time last time 1000 fps frame count frame count 0 last time time util get time
renders the panel and its contents via the renderer
public void set renderer game frame renderer renderer this renderer renderer init
sets the renderer used to draw the contents of this panel
public void init renderer init this
initialises the renderer
public void draw renderer draw this
renders the frame using the renderer currently specified
public void display changed gldrawable drawable boolean mode changed boolean device changed
display changed event
public void draw int xpos int ypos string msg draw xpos ypos msg j2 dacolor white
draw a message into the game frame at a specified locaiton
public void draw int xpos int ypos string msg j2 dacolor color ypos height xpos 3 gl gl push matrix gl gl color4f color red color green color blue color alpha gl gl translatef xpos ypos 0 tex bind gl gl gl list base base 32 gl gl call lists msg get bytes length gl gl byte msg get bytes gl gl color3f 1 1 1 gl gl pop matrix
draw a message into the game frame at a specified locaiton
public void init gldrawable drawable gl canvas get gl gl gl enable gl gl texture 2 d gl gl enable gl gl blend gl gl blend func gl gl src alpha gl gl one minus src alpha gl gl clear color 0 0 0 0 gl gl viewport 0 0 width height gl gl shade model gl gl flat gl gl disable gl gl depth test gl gl color3f 1 1 1 init
initialises the gl setup
public int get width return tex get image width
returns the width of this sprite
protected void additional gl gl gl translatef width 5 0 0
addition gl commands that are performed on a per cell basis
public int get character width return width 4
returns the width of a single character
public void reshape gldrawable drawable int x int y int width int height this width width this height height gl gl matrix mode gl gl projection gl gl load identity gl gl ortho 0 width height 0 1 1
reshapes the panel
public int get character height return height
returns the height of a single character
public int get height return tex get image height
returns the height of this sprite
public void draw int x int y draw x y 0 tex get image width tex get image height
draws this sprite at a specified location
public void draw int x int y float rotation draw x y rotation tex get image width tex get image height
draws this sprite at a specified location
public void set drawing offset int x int y xoffset x yoffset y
sets the offset at which the contents of this panel should be
public boolean add sprite sprite spr long duration frames add new frame spr duration return true
adds a frame to the animated sprite
public void dispose animator stop stop renderer true if old display mode null graphics device device graphics environment get local graphics environment get default screen device try device set display mode old display mode device set full screen window null thread sleep 200 catch exception e system err println error shutting down graphics context
disposes this game frame
public texture loader get texture loader if texture loader null texture loader new texture loader this return texture loader
gets the texture loader used to load textures into this gl
public int get width return super get width
the width of the component
public boolean add image resource factory factory game panel panel string ref long duration throws ioexception boolean loaded false add sprite factory get sprite panel ref duration loaded true return loaded
adds a frame to the animated sprite
public int get heigth return super get height
the heigth of the component
public int get current return current frame
returns the index of the frame current showing
public component to component return this
returns the component that actually represents this frame
public void draw float x float y float rotation draw x y rotation tex get image width tex get image height
draws this sprite at a specified location
public int next sprite if playing current frame if current frame frames size current frame 0 frame frame frame frames get current frame frame start frame return current frame
move to the next frame of animation
public void draw float x float y float rotation float width float height draw x y rotation width height j2 dacolor white
draws the sprite at a specified location scaled to a specified size
public void play playing true
starts playing the animation
public void draw int x int y check display next frame frame frame frame frames get current frame if frame null sprite cur frame sprite cur set overblended over blended cur draw x y
draws the sprite at the specified location
public void set overblended boolean over blended this over blended over blended
indicates that this sprite should be overblended
public void added container container this font container get font this drawer container get geom drawer view count bounds width 10 font get character width super added container
notification that the widget has been added to a container
public void draw int x int y float rotation check display next frame frame frame frame frames get current frame if frame null sprite cur frame sprite cur set overblended over blended cur draw x y rotation
draws the sprite at the specified location with the specified rotation
public void draw int x int y float rotation int width int height check display next frame frame frame frame frames get current frame if frame null sprite cur frame sprite cur set overblended over blended cur draw x y rotation width height
draws the sprite at the specified location at a specified size
public void set text string text buffer set data text
set the text in the field
public void added container container this container container added true
notification that this widget has been added to a specified container
public void draw int x int y float rotation int width int height j2 dacolor col check display next frame frame frame frame frames get current frame if frame null sprite cur frame sprite cur set overblended over blended cur draw x y rotation width height col
draws the sprite at the specified location at a specified size
public string get text return buffer get raw data
get the text from the field
public boolean is focused return is focused
checks if this widget is current the focused
public void set echo char char c override display true override char c
set the character to use instead of the actual
public void draw float x float y check display next frame frame frame frame frames get current frame if frame null sprite cur frame sprite cur set overblended over blended cur draw x y
draws the sprite at the specified location
public void key pressed key event e if e get key code key event vk enter container fire action this if get next focus null get next focus request focus if e get key code key event vk left buffer cursor left if e get key code key event vk right buffer cursor right
notification that a key has been pressed in the field
public void draw float x float y float rotation check display next frame frame frame frame frames get current frame if frame null sprite cur frame sprite cur set overblended over blended cur draw x y rotation
draws the sprite at the specified location with the specified rotation
public void request focus if added false return container request focus this is focused true
request that this widgets gains focus
public void key typed key event e if e get key char 8 buffer del else buffer add e get key char
notification that a key has been typed in the field
public bitmap font get font return font
get the font to use in the widgets
public void set next focus widget next focus this next focus next focus
set the widget to be next in line for focus
public widget get next focus return next focus
get the next widget in focus order
public void draw float x float y float rotation float width float height check display next frame frame frame frame frames get current frame if frame null sprite cur frame sprite cur set overblended over blended cur draw x y rotation width height
draws the sprite at the specified location at a specified size
public void release focus is focused false
release the focus on this widget
public geom drawer get geom drawer return drawer
get the geometry drawer to use in the widgets
public void activate panel get active component add mouse listener mouser panel get active component add mouse motion listener mouser panel get active component add key listener keyer
activate controls in the container
public void draw float x float y float rotation float width float height j2 dacolor col check display next frame frame frame frame frames get current frame if frame null sprite cur frame sprite cur set overblended over blended cur draw x y rotation width height col
draws the sprite at the specified location at a specified size
public int get cusor pos return cursor pos
get the current cursor position
public void mouse entered mouse event e boolean mouse down
notification that the mouse cursor has entered this component
public void deactivate panel get active component remove mouse listener mouser panel get active component remove mouse motion listener mouser panel get active component remove key listener keyer
dectivate controls in the container
public void mouse exited mouse event e boolean mouse down
notification that the mouse cursor has exited this component
public void add widget widget if widgets contains widget widgets add widget widget added this
add a widget to this container
public void set data string text this data text cursor pos data length view offset 0
set the contents of the buffer
public void set selected index int selected selected index selected
set the selected index 1 to clear
public void remove widget widget widgets remove widget
remove a widget from this container
public void added container container this drawer container get geom drawer this font container get font view count bounds height 10 font get character height view width bounds width 20 font get character width super added container
notification that this widget has been added to a container
public void cursor left if cursor pos 0 if cursor pos view offset view offset cursor pos
move the cursor left