input
stringlengths 10
828
| output
stringlengths 5
107
|
|---|---|
private component build main panel jscroll pane main pane create stripped scroll pane my table panel main pane add build image return main pane
|
builds and answers the main panel
|
protected void execute on exit prop set property gui gui position main key this get name divider location split pane get divider location
|
execute on exit is called after the frames close button is used
|
public void receive input stream in try value in read if value 1 what can we do catch ioexception e e print stack trace
|
loads the next byte from the given input stream
|
public void send output stream out try out write value catch ioexception e e print stack trace
|
save the instance as one byte to the given output stream
|
public void receive input stream in try big endian int val in read if val 0 ioexception e new ioexception throw e value val 256 val in read if val 0 ioexception e new ioexception throw e value val catch ioexception e todo auto generated catch block e print stack trace
|
load the next two bytes from the given input stream
|
public void send output stream out try big endian out write value 256 out write value 256 catch ioexception e todo auto generated catch block e print stack trace
|
save the instance as two bytes to the given output stream
|
public void receive input stream in value bin byte c new bin byte for int i 0 i fixlen i c receive in value char c get value log debug receive fix string value
|
reads the next bytes from a given input stream
|
public void send output stream out string tmp value while tmp length fixlen tmp log debug send fix string tmp bin byte c new bin byte for int i 0 i fixlen i c set value tmp char at i c send out
|
writes the string to the given output stream
|
public void set value string i value i
|
sets the string
|
static public byte count get instance if null instance instance new byte count return instance
|
returns the instance creates one if necessary
|
public void receive input stream in try value in read if value 1 what can we do byte count get instance increment catch ioexception e e print stack trace log debug receive bin byte value
|
loads the next byte from the given input stream
|
public void increment count
|
increment the counter
|
public void send output stream out try log debug send bin byte value out write value byte count get instance increment catch ioexception e e print stack trace
|
save the instance as one byte to the given output stream
|
public void set value int i value i
|
sets the value
|
public void send output stream out boolean part2 new boolean 8 system arraycopy bitset 8 part2 0 8 bit8 lo new bit8 bitset bit8 hi new bit8 part2 log debug send bit16 hi send out lo send out
|
save the array of boolean to the given output stream
|
public boolean get value int index check index index return bitset index
|
get one of the boolean from the array
|
public void set value boolean value int index check index index this bitset index value
|
set one boolean in the array
|
public void receive input stream in try big endian int val in read if val 0 ioexception e new ioexception throw e value val 256 val in read if val 0 ioexception e new ioexception throw e value val byte count get instance increment byte count get instance increment catch ioexception e todo auto generated catch block e print stack trace log debug receive bin word value
|
load the next two bytes from the given input stream
|
public void send output stream out try log debug send bin word value big endian out write value 256 out write value 256 byte count get instance increment byte count get instance increment catch ioexception e todo auto generated catch block e print stack trace
|
save the instance as two bytes to the given output stream
|
public void set int index check index index this bitset index true
|
set the boolean to true
|
public void clear int index check index index this bitset index false
|
set the boolean to false
|
public void send output stream out int value 0 for int i 8 i 0 i value 2 if is set i value 0x01 log debug send bit8 value bin byte bits new bin byte bits set value value bits send out
|
save the array of boolean to the given output stream
|
public void set content pane container content pane jpanel panel new jpanel new border layout panel add this tool bar border layout north panel add content pane border layout center panel add build status bar border layout south super set content pane panel
|
sets the content pane
|
public void set status text string text this status text set text text
|
sets the status text line
|
private component build status bar jpanel status bar new jpanel new border layout this status text create centered label drmm status bar add this status text return status bar
|
builds and answers the status bar
|
private jlabel create centered label string text jlabel label new jlabel text label set horizontal alignment jlabel center label set border new empty border 3 3 3 3 return label
|
creates and answers a code jlabel code that has the text
|
private void configure ui uimanager put options use system fonts app key boolean true options set global font size hints font size hints mixed options set default icon size new dimension 18 18 string laf name look utils is windows xp options get cross platform look and feel class name options get system look and feel class name string laf name options get cross platform look and feel class name try uimanager set look and feel laf name catch exception e system err println can t set look feel e
|
configures the ui tries to set the system look on mac
|
public void window closing window event e log debug std frame event window closing execute on exit gui save position std frame this log debug std frame event system exit 0 bye bye system exit 0
|
this method handles the window closing event by saving the frames position
|
public reg exp filter string filter boolean regexp this extension filter this regexp regexp
|
put your documentation comment here
|
public float get base price return base price
|
returns the base price
|
public void set base price float base price this base price base price
|
set the base price
|
public float get market price return market price
|
returns the market price
|
public void set market price float market price this market price market price
|
set the market price
|
public string get image2 return image2
|
returns the image2
|
public void set image2 string image2 this image2 image2
|
set the image2
|
public void set sex string sex user set sex sex
|
set the sex
|
public void set real name string real name user set real name real name
|
set the real name
|
public string get image1 return image1
|
returns the image1
|
public void set password string password user set password password
|
set the password
|
public void set image1 string image1 this image1 image1
|
set the image1
|
public string get image3 return image3
|
returns the image3
|
public void set user name string user name user set user name user name
|
set the user name
|
public void set image3 string image3 this image3 image3
|
set the image3
|
public integer get user phone return user phone
|
returns the user phone
|
public void set user phone integer user phone user set user phone user phone
|
set the user phone
|
public void set email string email user set email email
|
set the email
|
public string get user address return user address
|
returns the user address
|
public void set user address string user address user set user address user address
|
set the user address
|
public void write int type string data try write type data get bytes us ascii if type lc sys out 0 system out print data catch unsupported encoding exception e e print stack trace
|
writes a string with specified type to log
|
public void on chat joined string id string name
|
called when a chat is joined
|
public object lookup string key object returned null try returned local node lookup key inet address get local host node default port catch exception e system err println e debug returned is local node get lookup return if returned null system out println sorry could not be found return returned
|
this method looks up a key starting on the local node
|
public void put string key serializable value local node add object key value
|
this method puts on object on the ring starting from the local node
|
public string get string addr int x addr hash code our hash x x 0xffff debug new hash of node get x for predecessor if x 0 return node addr get finger 0 successor and following int ret 0 for int i 0 i ring oversize i int two i int math pow 2 i int two ii int math pow 2 i 1 if x two i x two ii ret i 1 return node addr get finger ret get string addr
|
returns the host name port from the address
|
public void join ring finger table arrays ft while true try socket server sock accept socket in server sock in accept socket out server sock out accept catch exception e system err println e runnable c new my runnable thread t1 new thread c t1 start while
|
creates and joins the newly created ring
|
public void copy finger hash map integer string some finger node addr put all some finger update the this finger from the given finger table set integer keys some finger key set for int a keys this add get a copy finger hash map
|
copies the given finger into our finger table
|
private void debug string msg if debug system out println msg debug string
|
prints out the debugging message
|
public void leave ring
|
leaves the ring and updates the two surrounding nodes
|
public void stabalize ring
|
updates all nodes for when nodes join or leave the ring
|
public int hash code object o int x o hash code x x 0xffff return x
|
obtain the hash code for the local hostname port of this node
|
private void debug string msg if debug system out println msg
|
prints out debugging information when debug is set to true
|
public scripted user service list script super google afyd connector test 0 this call count 0 this script script
|
constructs a user service which returns results from a script list
|
public void test ok with no users throws repository exception users is empty entries is empty assert null doc list next document assert null doc list next document even when traversal is restarted
|
in this test we ensure that the document list safely returns no documents
|
public void test ok with no entries throws repository exception there are some users users add a users add b users add c users add d entries is empty will be returned this way for each user assert null doc list next document assert null doc list next document even when traversal is restarted
|
in this test we ensure that the document list safely returns no documents
|
private void maybe refetch if last fetch date null refetch else long then last fetch date get time long now new date get time if now then 1000 0 ttl refetch
|
determines if refetch should be called by examining last fetch date and the
|
public object get int index maybe refetch return user list get index
|
gets an element from the cached user list
|
public int size maybe refetch return user list size
|
gets the size from the cached user list
|
private void load properties throws repository exception properties new properties try properties load new file input stream properties filename catch file not found exception fnfe this is ok even expected on first run logger info fnfe to string catch ioexception ioe logger severe ioe to string throw new repository exception ioe
|
populates overwriting the properties field of this class with data from
|
private void store properties throws repository exception try properties store new file output stream properties filename null catch ioexception ioe logger severe ioe to string throw new repository exception ioe
|
commits the contents of the properties field of this class to the file
|
public void run while true try if event null synchronized notify obj notify obj wait continue status busy system out println this get class get name process event event event route event null status idle catch interrupted exception e
|
start run the event handler once the event handler is triggered
|
public object clone event handler h new event handler h set event null h notify obj new object return h
|
clone a handler used to produce more handlers
|
public void route if finished return
|
this is the route function you have to implement it
|
private int space left return limit position
|
if writing to a flat array return the space left in the array
|
private void write raw byte byte value throws ioexception buffer position value
|
write a single byte
|
private void write raw byte int value throws ioexception write raw byte byte value
|
write a single byte represented by an integer value
|
private void write raw bytes byte value throws ioexception if value null return write raw bytes value 0 value length
|
write an array of bytes
|
private void write tag int field number int wire type throws ioexception write raw varint32 wire format make tag field number wire type
|
encode and write a tag
|
private int read raw varint32 throws ioexception byte tmp read raw byte if tmp 0 return tmp int result tmp 0x7f if tmp read raw byte 0 result tmp 7 else result tmp 0x7f 7 if tmp read raw byte 0 result tmp 14 else result tmp 0x7f 14 if tmp read raw byte 0 result tmp 21 else result tmp 0x7f 21 result tmp read raw byte 28 if tmp 0 discard upper 32 bits for int i 0 i 5 i if read raw byte 0 return result throw invalid protocol buffer exception malformed varint return result
|
read a raw varint from the stream
|
private void write raw varint64 long value throws ioexception while true if value 0x7 fl 0 write raw byte int value return else write raw byte int value 0x7 f 0x80 value 7
|
encode and write a varint
|
public string to string utf8 try return new string this bytes utf 8 catch unsupported encoding exception e throw new runtime exception utf 8 not supported
|
constructs a new
|
private void write raw little endian64 long value throws ioexception write raw byte int value 0x ff write raw byte int value 8 0x ff write raw byte int value 16 0x ff write raw byte int value 24 0x ff write raw byte int value 32 0x ff write raw byte int value 40 0x ff write raw byte int value 48 0x ff write raw byte int value 56 0x ff
|
write a little endian 64 bit integer
|
private byte read raw byte throws ioexception if buffer pos buffer size refill buffer true return buffer buffer pos
|
read one byte from the input
|
private void write raw bytes byte value throws ioexception write raw bytes value 0 value length
|
write an array of bytes
|
private void write raw little endian32 int value throws ioexception write raw byte value 0x ff write raw byte value 8 0x ff write raw byte value 16 0x ff write raw byte value 24 0x ff
|
write a little endian 32 bit integer
|
public int get total occurrence return total occurrence
|
method bean get total occurrence
|
public void set total occurrence int total occurrence this total occurrence total occurrence
|
method bean set total occurrence
|
public int get total observation return total observation
|
method bean get total observation
|
public void set total observation int total observation this total observation total observation
|
method bean set total observation
|
public boolean has sub category return sub category size 0 boolean false boolean true
|
method to check if has sub category
|
public int total observation return this observation null 0 this observation size
|
gets size observation
|
public double get square some double total 0d for string a this attribute key set map string predictable elements this attribute get a for string e elements key set predictable predictable elements get e if predictable get total occurrence 0 double aux double predictable get total occurrence predictable get total observation total math pow aux 2 return total
|
method that calc square some
|
public void remove sub category category category this sub category remove category
|
removes sub category
|
private void update category category category string column string observation map string map attributes category get attribute for string a attributes key set map string predictable elements attributes get a for string e elements key set predictable predictable elements get e predictable set total occurrence this count element observation this get column index column a e predictable set total observation observation length
|
updates the category
|
private void split category category root set category partition string id sub category for category c partition if c get id equals id sub category for category s c get sub category root set sub category s root remove sub category c break
|
splits the category
|
public void set attribute map string map attribute this attribute attribute
|
method bean set attribute
|
public void set attibute string key map string predictable value this get attribute put key value
|
method bean set attribute
|
public void set attibute string attribute string element int total occurrence int total observation for string a this attribute key set if a equals attribute map elements this attribute get a for object e elements key set if string e equals element predictable predictable predictable elements get e predictable set total occurrence total occurrence predictable set total observation total observation
|
method bean set attribute
|
private category create category string column string data category categority new category for each attribute for int column index 0 column index column length column index map string predictable elements new hash map string predictable for each element for string element this get elements data column index elements put element new predictable categority set attibute column column index elements return categority
|
create a empty category objecty from column and data values
|
public void set observation set integer observation this observation observation
|
method bean set observation
|
public void set observation integer observation this observation add observation
|
method bean set observation
|
public void set sub category set category sub category this sub category sub category
|
method bean set sub catery
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.