input stringlengths 10 828 | output stringlengths 5 107 |
|---|---|
public void notify glyph changed glyph the glyph string attr if get send live notify glyph change done the glyph attr true | tell other whiteboards that the glyph is in the process of being changed |
public void notify glyph moved glyph the glyph if get send live notify glyph move complete the glyph true | if we wanted to we could send out glyph moved commands |
public void notify glyph move complete glyph the glyph notify glyph move complete the glyph false | tell other whiteboards that the glyph has moved |
public void set can edit boolean f can edit f | this sets the edit field |
public boolean get share cursor return share cursor | are we actively sharing the cursor position with others |
public boolean get accept shared cursor return accept shared cursor | do we accept shared cursors |
public void mouse released mouse event e if get share cursor write cmd cursorup super mouse released e | send cursorup command if we are sharing |
public void set ignore user chat user user boolean ignore user set ignored ignore if avatar canvas null avatar canvas set ignore user ignore if text canvas null text canvas repaint | set whether the given user is being ignored or not |
public void set xtension string val delete key simple delete key xtension delete key extend iter iterator try iter add xtension new header card xtension val ntf header xtension 1 catch header card exception e system err println impossible exception at set xtension e | set the xtension keyword to the given value |
public void mouse dragged mouse event e debug wbc mouse dragged set highlight null int x e get x int y e get y if get share cursor int cx translate input x x int cy translate input y y if math abs lastx cx 2 math abs lasty cy 2 write cmd cursorpos xml node attr attr x cx xml node attr attr y cy lastx cx lasty cy super mouse dragged e | send cursorpos commands if sharing |
public void remove glyph glyph g super remove glyph g write cmd remove xml node attr attr id g get id | write the glyph remove command |
public void set bitpix int val iter iterator iter next try iter add bitpix new header card bitpix val ntf header bitpix 1 catch header card exception e system err println impossible exception at set bitpix e | set the bitpix value for the header |
public chat user get selected item if selected idx 0 selected idx users size return null return chat user users element at selected idx | return the currently selected user or null |
public void set naxes int val iter set key bitpix if iter has next iter next try iter add naxis new header card naxis val ntf header naxis 1 catch header card exception e system err println impossible exception at set naxes e | set the value of the naxis keyword |
public void toggle ignore chat user user get selected item if user null applet set ignore user user user get ignored repaint | if there is a currently selected user then have the chat applet toggle |
public void write gfx string sub xml write msg gfx sub xml | write the gfx message |
public boolean user ok return ignored false | is this user being ignored |
public void set naxis int axis int dim if axis 0 return if axis 1 iter set key naxis else if axis 1 iter set key naxis axis 1 if iter has next iter next try iter add naxis axis new header card naxis axis dim ntf header naxis n 1 catch header card exception e system err println impossible exception at set naxis e | set the dimension for a given axis |
public void write private chat user to string msg write msg private attr to to get id xml node encode msg | send a private message to the user |
public void create private message chat user other user private message dialog find other user this | find and or create the private message dialog for the given user |
public string make command tag string command name string attributes return xml node tag tag command xml node attr attr name command name attributes | create the whiteboard command xml |
public void process state xml node message super process state message string v message get attribute attr edit if v null set can edit new boolean v boolean value if room label null room label set text room room name get my user set name user name get my user set id user id | called from base class to handle message type state messages |
public boolean get persistent return false | we dont want to save this glyph off |
public string get category if misc equals this category category default parent null return parent get category return this category | get the category property |
public user glyph add user chat user user user glyph ug user glyph ugs get user if ug null ug new user glyph this last x last y user image image socket applet get image user get icon url if image null image socket applet get image resource com infocetera images smile1 gif ug set image image add glyph ug ugs put user ug last x ug get bounds width 20 if last x 400 last x 20 last y ug get bounds height 20 return ug | create a new user glyph if not created already for user name |
public void process users xml node message boolean show text vector children message get children for int i 0 i children size i xml node child xml node children element at i if child tag equals tag user continue string name child get attribute attr name if name null continue if show text get user name equals name put text new user name add user child get attribute attr id name child get attribute attr icon | add new users |
public void process user remove xml node message vector children message get children for int i 0 i children size i xml node child xml node children element at i string id child get attribute attr id if id null continue chat user old user chat user get user id int idx users index of old user if idx 0 continue user list remove user at idx users remove element old user put text user gone old user avatar canvas remove user old user | a user or users has gone |
public void mouse pressed mouse event e int x translate input x e get x int y translate input y e get y mouse down true if nearest glyph null repaint | select the clicked on user |
public boolean check url string body if body starts with url string url body substring 4 add file url url is image url return true return false | if a user types url http |
public boolean get for user if for user return false else don t inherit the for user return true if get parent null return get parent get for user return true | get the for user property |
public void paint inner graphics g super paint inner g g set color color black if highlighted glyph null ok to paint highlight highlighted glyph paint highlight g this if current command null current command do paint g | called from the base class |
public container do make contents if contents null border panel p new border panel gui utils border sunken p set layout new border layout p add center this contents gui utils do layout new component p get vscroll 100 500 2 gui utils ds yn gui utils ds yn return contents | create the gui |
public void add user string id string name string icon chat user new user chat user get user id name new user set icon url icon if users contains new user return users add element new user system err println adding user new user have list user list null if user list null user list add user new user avatar canvas add user new user | new user add it to the user list |
public void notify glyph moved glyph the glyph | we have these hooks here so that derived classes can do things based |
public void init connection super init connection write the message type session channel sessionid userid tag write msg session attr channel room attr sessionid session id write msg userlist write msg file | called at start up to tell the server what is the room |
public void put text string s | just a hook so derived classes can display some text to the user |
public void put text chat user u string t if text canvas null text canvas add message u t text area set text text area get text n u get name t | write the given text to the chat text area |
public void show files menu component src jpopup menu files menu new jpopup menu this add files menu files menu add make menu item add new url cmd files select if load files url null files menu add make menu item select file from server cmd files upload files menu add make menu item remove selected cmd files remove files menu add make menu item share selected cmd files share files menu add make menu item use as background cmd files view rectangle bounds src get bounds files menu show src 0 bounds height | popup the files menu |
public void set float boolean do float if do float floating return if floating old parent add center this float frame dispose invalidate old parent validate else old parent get parent float frame new frame float frame set layout new border layout float frame add center this float frame add window listener this float frame pack float frame show if first float init float float frame set size new dimension 500 600 first float false floating floating | float or embed the applet |
public string to string return o1 to string | for now just show the first object |
public color get color for int i 0 i color group size i image button tb image button color group element at i if tb state return tb color return color black | what is the color of the selected color button in the color palette |
public jmenu make align menu jmenu align menu new jmenu align align menu add make menu item top cmd align top align menu add make menu item center cmd align center align menu add make menu item bottom cmd align bottom align menu add make menu item left cmd align left align menu add make menu item middle cmd align middle align menu add make menu item right cmd align right return align menu | create the alignment menu |
public container do make color panel boolean vertical component color cbx new component colors length for int i 0 i colors length i image button cbx new image button color group resource com infocetera images check gif null colors i 0 color cbx i cbx if i 0 cbx set state true gui utils tmp insets new insets 1 1 0 0 return gui utils do layout color cbx vertical 1 color cbx length gui utils ds n gui utils ds n | create the color choosing palette |
private int find value string v string names int values int dflt if v null return dflt v v to lower case for int fidx 0 fidx names length fidx if v equals names fidx return values fidx return dflt | find the corresponding int value in the values array |
public void add attribute string name string value if attributes null attributes new hashtable attributes put name trim value | after an xml node has been parsed and created you can add attributes |
public void do popup jpopup menu popup component src int x int y this add popup popup show src x y | popup the menu at the location given with respect to the src component |
public void show gfx menu component src int x int y jpopup menu gfx popup new jpopup menu gfx popup add make display menu gfx popup add make align menu do popup gfx popup src x y | popup the menu that has the display and alignment menus |
public void show canvas menu component src int x int y jpopup menu popup new jpopup menu popup add make edit menu popup add make display menu popup add make align menu do popup popup src x y | called from the menu button click |
public void process graph xml node node if graph xml null graph xml node process xml node get children | set the graph xml member to the given node and process the children |
public void show edit menu component src int x int y jpopup menu edit popup new jpopup menu make edit menu edit popup edit popup add separator if selection sticky edit popup add make menu item make unsticky cmd edit sticky true else edit popup add make menu item make sticky cmd edit sticky true do popup edit popup src x y | show the edit menu |
public void show scale menu component src int x int y jpopup menu scale menu new jpopup menu int current get scale idx for int i 0 i scale factors length i int sf int scale factors i 100 0 if current i scale menu add make menu item sf cmd scale prefix i else scale menu add make menu item sf cmd scale prefix i this add scale menu rectangle bounds src get bounds scale menu show src 0 bounds height | show the zoom menu |
private void process node xml node xml node graph node the node graph node id to node get xml node get attribute graph node attr id badid if the node null if xml node get attribute attr merge false string old type the node get type name the node merge xml node if old type the node get type name remove node from list the node old type add node to list the node the node get type name return new node new graph node this xml node | process the node |
public void do paint graphics g g set color color light gray rectangle r canvas scale rect get rect gui utils draw rect g r x r y r width r height 2 | draw the currently dragged rectangle |
public canvas command do mouse dragged mouse event e int x int y current x x current y y canvas repaint return this | reset the dragged x y location and tell the canvas to repaint |
private void process canvas xml node node if canvas xml null canvas xml node process xml node get children simple gui node get attribute attr simplegui simple gui set the background color of the canvas color bg color node get attribute attr bgcolor color null if bg color null set background bg color set the background image if defined string value node get attribute attr bgimage if value null bg image null bg image graph applet get image value | process the canvas node |
public void remove child glyph g | a couple of methods so we dont have to |
public xml node get node type string node type graph node graph node xml node node null if graph node null graph node get is center node xml node node type map get node type center if node null node xml node node type map get centernode if node null node xml node node type map get node type if node null node new xml node tag nodetype new hashtable node type map put node type node node types add element node type return node | create if needed and return the xml node that represents |
public void bounds changed | hook for when the size or position of this glyph is changed |
public void set points int p int cnt | hook for setting points from the attribute line |
public xml node get edge type string type if type null return null return xml node edge type map get type | lookup the xml node that represents the given edge type |
public string get create string return get position attr get attrs null | return the string used to recreate this glyph |
public void item state changed item event e for int i 0 i node lists size i jlist node list jlist node lists element at i if e get source node list continue int idx node list get selected index if idx 0 string node type string list to node type get node list vector v vector node type to vector get node type graph node n graph node v element at idx if n null node select n return hide nodes and edges | handle the item changed event |
public boolean get draw edge labels return edge label | do we draw the edge labels |
public boolean get draw node labels return node label | do we draw the node labels |
public void print string s system err println s | utility to print a string |
public label get label string l label label new label l label set font label font return label | utility method for creating a label |
public color get fgcolor color bg if bg equals color black return color white if bg equals color blue return color white return color black | get an appropriate foreground color for the given bg color |
public dbquery id get query return query | begin user doc |
override protected void startup show new solitaire test view this | at startup create and show the main frame of the application |
public void save game | save the current game |
public void load game | load a saved game |
public void pile changed | reports that a pile was changed |
public void check finished | check if the game has finished |
public void check plausible moves | reports that a pile was changed |
public void show hint | shows a plausible move to the user |
public void test late colon throws uriexception uuri base uurifactory get instance http www example com path page uuri uuri1 uurifactory get instance base example html jsessionid deadbeef deadbeed parameter this value assert equals derelativize late colon uuri1 get uri http www example com path example html jsessionid deadbeef deadbeed parameter this value uuri uuri2 uurifactory get instance base example html parameter this value assert equals derelativize late colon uuri2 get uri http www example com path example html parameter this value | ensure that relative uris with colons in late positions |
public void test missing http colon throws uriexception string suspect uri http www test foo uuri base uurifactory get instance http www example com boolean exception thrown false try uuri bad uuri uurifactory get instance suspect uri bad uuri get referenced host not reached catch uriexception e should get relative uri no base exception exception thrown true finally assert true expected exception not thrown exception thrown uuri good uuri uurifactory get instance base suspect uri good uuri get referenced host | test motivated by her 616 the uuri class may throw |
public void test extreme port try uuri uuri uurifactory get instance http tel 016099117464 system out println uuri fail expected exception not thrown catch uriexception ue expected | test bad port throws uriexception not number format exception |
public string get message return message format format msg message arguments to array | get the error message |
public void delete settings object crawler settings settings super delete settings object settings file settings directory get settings directory file settings file settings to filename settings if settings file delete throw new runtime exception could not delete settings file settings file settings file get parent file while settings file is directory settings file list length 0 settings file equals settings directory if settings file delete logger warning could not delete settings file settings file settings file get parent file | delete a settings object from persistent storage |
public synchronized void tally crawl uri curi if curi get fetch status 0 fetch non responses return fetch responses total bytes curi get content size if curi get fetch status http status sc ok curi get fetch status 300 fetch successes success bytes curi get content size | examing the crawl uri and based on its status and internal values |
public void test html markup robots throws ioexception robotstxt r html markup robots assert false r get directives for anybot allows index html assert equals 30f r get directives for anybot get crawl delay | test handling of a robots |
public boolean allows all todo refine so directives that are all empty are also recognized as allowing all return agents to directives is empty | does this policy effectively allow everything no |
public float get crawl delay string user agent if robotstxt null return 1 return robotstxt get directives for user agent get crawl delay | get the crawl delay that applies to the given user agent or |
public void add credential avatar credential avatar ca if this avatars null this avatars new hash set credential avatar this avatars add ca | add an avatar |
public void check user agent and from throws fatal configuration exception don t start the crawl if they re using the default user agent string user agent this get user agent null string from this get from null if user agent matches acceptable user agent from matches acceptable from throw new fatal configuration exception unacceptable user agent or from correct your configuration | checks if the user agent and from field are set correctly in |
private void add extracted crawl uri curi string file try file urlencoder encode file utf 8 catch unsupported encoding exception e throw new assertion error e if logger is loggable level finest logger log level finest found file string base curi to string if base ends with base base substring 0 base length 1 try uuri n uurifactory get instance base file link link new link curi get uuri n navlink misc navlink hop curi add out link link catch uriexception e logger log level warning uri error during extraction e | adds an extracted filename to the curi |
private void add parent crawl uri curi if get extract parent curi return uuri uuri curi get uuri try if uuri get path equals there s no parent to add return string scheme uuri get scheme string auth uuri get escaped authority string path uuri get escaped current hier path uuri parent uurifactory get instance scheme auth path link link new link uuri parent navlink misc navlink hop curi add out link link catch uriexception e logger log level warning uri error during extraction e | extracts the parent uri from the given curi then adds that parent |
public void dump all pending to log throws database exception closure tolog new closure public void execute object curi log crawl uri curi pending uris for all pending do tolog | dump all still enqueued uris to the crawl |
public long get total budget return this total budget | retrieve the total expenditure level allowed by this queue |
public long get pending expenditure return pending expenditure | return the tally of all uri costs currently inside this queue |
protected void tally crawl uri curi stage stage tally per server per host per frontier class running totals crawl server server controller get server cache get server for curi if server null server get substats tally curi stage crawl host host controller get server cache get host for curi if host null host get substats tally curi stage frontier group group controller get frontier get group curi group get substats tally curi stage | report crawl uri to each of the three substats accumulators |
public void update final work queue frontier frontier crawl uri curi try insert frontier curi true catch ioexception e fixme better exception handling e print stack trace throw new runtime exception e | update the given crawl uri which should already be present |
private void configure proxy crawl uri curi host configuration config string proxy string get attribute either curi attr http proxy host int port 1 if proxy length 0 proxy null else string port string string get attribute either curi attr http proxy port port port string length 0 integer parse int port string 1 if proxy null config set proxy proxy port | setup proxy based on attributes in crawl uri and settings |
protected void increment queued uri count live queued uri count increment and get | increment the running count of queued uris |
private void configure bind address crawl uri curi host configuration config string address string string get attribute either curi attr http bind address if address string null address string length 0 try inet address local address inet address get by name address string config set local address local address catch unknown host exception e convert all to runtime exception so get an exception out if initialization fails throw new runtime exception unknown host address string in attr http bind address | setup local bind address based on attributes in crawl uri and settings |
protected void increment queued uri count long increment live queued uri count add and get increment | increment the running count of queued uris |
protected void decrement queued count long number of deletes live queued uri count add and get number of deletes | note that a number of queued uris have been deleted |
private void replenish session balance work queue queue uuri context uri queue get context uuri this todo consider confusing cross effects of this and ip based politeness queue set session balance integer get unchecked attribute context uri attr balance replenish amount int value reset total budget it may have changed todo is this the best way to be sensitive to potential mid crawl changes long total budget long get unchecked attribute context uri attr queue total budget long value queue set total budget total budget | replenish the budget of the given queue by the appropriate amount |
protected void increment succeeded fetch count live succeeded fetch count increment and get | increment the running count of successfully fetched uris |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.