input
stringlengths 10
828
| output
stringlengths 5
107
|
|---|---|
public long skip long number of bytes throws ioexception if eof throw new ioexception skip after end of file if position size return do end of file position number of bytes long return length number of bytes if position size return length number of bytes position size position size return return length
|
skip a specified number of bytes
|
public int compare object obj1 object obj2 file file1 file obj1 file file2 file obj2 long size1 0 if file1 is directory size1 sum directory contents file1 exists file utils size of directory file1 0 else size1 file1 length long size2 0 if file2 is directory size2 sum directory contents file2 exists file utils size of directory file2 0 else size2 file2 length long result size1 size2 if result 0 return 1 else if result 0 return 1 else return 0
|
compare the length of two files
|
public int compare object obj1 object obj2 file file1 file obj1 file file2 file obj2 long result file1 last modified file2 last modified if result 0 return 1 else if result 0 return 1 else return 0
|
compare the last the last modified date time of two files
|
public int compare object obj1 object obj2 file file1 file obj1 file file2 file obj2 return case sensitivity check compare to file1 get name file2 get name
|
compare the names of two files with the specified case sensitivity
|
public int compare object obj1 object obj2 file file1 file obj1 file file2 file obj2 return case sensitivity check compare to file1 get path file2 get path
|
compare the paths of two files the specified case sensitivity
|
public int compare object obj1 object obj2 file file1 file obj1 file file2 file obj2 string suffix1 filename utils get extension file1 get name string suffix2 filename utils get extension file2 get name return case sensitivity check compare to suffix1 suffix2
|
compare the extensions of two files the specified case sensitivity
|
public void write int i throws ioexception single byte 0 byte i write single byte 0 1
|
writes the specified code byte code to this output stream
|
public void write byte b int offset int len throws ioexception if b null throw new null pointer exception else if offset 0 len 0 offset len 0 throw new index out of bounds exception else if offset b length offset len b length throw new index out of bounds exception else if len 0 if do encode base64 encode b offset len else base64 decode b offset len flush false
|
writes code len code bytes from the specified
|
private void flush boolean propogate throws ioexception int avail base64 avail if avail 0 byte buf new byte avail int c base64 read results buf 0 avail if c 0 out write buf 0 c if propogate out flush
|
flushes this output stream and forces any buffered output bytes
|
public void flush throws ioexception flush true
|
flushes this output stream and forces any buffered output bytes
|
public void close throws ioexception notify encoder of eof 1 if do encode base64 encode single byte 0 1 else base64 decode single byte 0 1 flush
|
closes this output stream flushing any remaining bytes that must be encoded
|
public account get default account string default account uuid m shared preferences get string default account uuid null account default account null account accounts get accounts if default account uuid null for account account accounts if account get uuid equals default account uuid default account account break if default account null if accounts length 0 default account accounts 0 set default account default account return default account
|
returns the account marked as default
|
private file create unique file file directory string filename file file new file directory filename if file exists return file get the extension of the file if any int index filename last index of string format if index 1 string name filename substring 0 index string extension filename substring index format name d extension else format filename d for int i 2 i integer max value i file new file directory string format format i if file exists return file return null
|
creates a unique file in the given directory by appending a hyphen
|
public void controller command completed boolean more commands to run
|
general notification messages subclasses can override to be notified that the controller
|
public string get text return m body
|
get the text of the body in its unencoded format
|
public void write to output stream out throws ioexception messaging exception buffered writer writer new buffered writer new output stream writer out 1024 m header write to out writer write r n writer flush if m body null m body write to out
|
write the mime message out in mime format
|
public input stream get input stream throws messaging exception try byte b m body get bytes utf 8 return new byte array input stream b catch unsupported encoding exception usee return null
|
returns an input stream that reads this bodys text in utf 8 format
|
public void set flags flag flags boolean set throws messaging exception for flag flag flags set flag flag set
|
this method calls set flag flag boolean
|
public string get subject throws messaging exception return mime utility unfold and decode get first header subject
|
returns the unfolded decoded value of the subject header
|
public void delete try m db close catch exception e try file attachments m attachments dir list files for file attachment attachments if attachment exists attachment delete if m attachments dir exists m attachments dir delete catch exception e try new file m path delete catch exception e
|
delete the entire store and its backing database
|
public imap response read response throws ioexception imap response response new imap response if m active literal null while m active literal read 1 m active literal null int ch m in peek if ch parse untagged response read tokens response else if ch response m command continuation requested parse command continuation request read tokens response else response m tag parse tagged response read tokens response if config logd if k9 debug log d k9 log tag response to string return response
|
reads the next response available on the stream and returns an
|
public object read token throws ioexception while true object token parse token if token null token equals return token
|
reads the next token of the response
|
private void handle untagged responses list imap response responses for imap response response responses handle untagged response response
|
handle any untagged responses that the caller doesnt care to handle themselves
|
private void handle untagged response imap response response if response m tag null response get 1 equals exists m message count response get number 0
|
handle an untagged response that the caller doesnt care to handle themselves
|
public enumeration get all header lines throws messaging exception check expunged load headers return super get all header lines
|
get all header lines
|
public card produce card return settle card prototype clone
|
todo this method does not simulate resource limits from the board game
|
public boolean can place settlement final board b final collection city cities final collection settlement settlements for final city city cities if equals city return false for final settlement settlement settlements if equals settlement return false for final point neighbor b get neighbors this for final city city cities if neighbor equals city return false for final settlement settlement settlements if neighbor equals settlement return false return true
|
note this logic explicitly assumes single player
|
public int hash code return start hash code end hash code
|
this looks wrong but its intentional
|
private int longest road length final map point set point transitions build transition map int max 0 for final point start transitions key set max math max max longest road from start new hash set point transitions return max
|
of course the longest path problem for undirected graphs is np complete
|
public void set position color string status boolean world status if status me this p color position color blue else if status others if world status true owner is in world this p color position color green else if world status false owner is not in world this p color position color red else no status this p color position color white
|
parse the position color
|
public position color get position color return this p color
|
get map color for this position map
|
public string get world name in map return world name in map
|
get world name in map at a specific position in map
|
public void set world name in map string world name in map this world name in map world name in map
|
set world name in map
|
public boolean is online return online
|
is client connect to net work service
|
public void start try go online catch exception e log error e e print stack trace throw new runtime exception unable to go online while true run
|
todo move to service provider interface
|
public void stop go offline
|
todo move to service provider interface
|
private peer id initialize my peer id string my peer name return idfactory new peer id peer group id default net peer group id my peer name get bytes
|
call this once
|
private peer group id initialize peer group id string my peer group name return idfactory new peer group id my peer group name get bytes
|
call this once
|
private void manage peer collection discovery event ev todo append self to peer collection create new peer from discovery event s source discovery response msg res ev get response peer advertisement peer adv res get peer advertisement string source id peer adv get name todo send client name as a part of advertisement peer info new peer new peer info source id new peer set id source id boolean add success this peer collection add new peer if add success system out println add new peer to the collection else system out println peer is already in the collection
|
manage peer collection by add new discovered peer on the list
|
public exception get target exception return target exception
|
returns the target exception
|
public void set target exception exception target exception this target exception target exception
|
sets the target exception
|
public peer info get requestor return requestor
|
who make the request
|
public peer info get host return host
|
who is host of the world
|
private void update current map to services map status service set my map this current map
|
update changes to services
|
public peer id get my peer id return this my peer id
|
get my peer identification which is unique across the system
|
public peer group id get my peer group id return this my peer group id
|
get fytas realm group id
|
public discovery service get discovery service return this discovery service
|
get jxta discovery service
|
public pipe service get pipe service return this pipe service
|
get jxta pipe service
|
public jxta connection get connection return connection
|
get instance of jxta connection
|
public pipe advertisement get map pipe advertisement return map pipe advertisement
|
get connection point to all message passing related to map info events
|
private void go online throws communication exception this online false get the net peer group net peer group manager get net peer group create game group application group and also init discovery service peer group create game group net peer group join the game group join group peer group set services this pipe service peer group get pipe service this online true
|
online to jxta network
|
public peer status service get peer status service return peer status service
|
get instance of peer status service for
|
public void go offline if online peer group null online false manager stop network
|
offline from jxta network
|
public map status service get map status service return map status service
|
get instance of map status service for
|
public void add discovery service listener discovery listener listener this discovery service add discovery listener listener
|
add listener to jxta connection discovery service
|
public world status service get world status service return world status service
|
get instance of world status service for
|
public void start jxta connection started already in constructor try connection go online catch communication exception e todo log error e e print stack trace todo start more services here if this is start bg peer status service start system out println peer status service started map status service start system out println map status service started world status service start system out println world status service started
|
start the network
|
private peer advertisement create peer ping message peer advertisement adv peer advertisement advertisement factory new advertisement peer advertisement get advertisement type adv set peer group id connection get my peer group id adv set peer id connection get my peer id adv set name ping token return adv
|
create a message for ping all peer in fytas realm group
|
public void stop connection go offline todo stop more services here if this is start bg peer status service stop system out println peer status service stoped map status service stop system out println map status service stoped world status service stop system out println world status service stoped
|
stop the network
|
public void run todo make it configurable long waittime 20 1000 l run as bg thread while true try system out println sleeping for waittime thread sleep waittime catch exception e ignored discovery service ds this connection get discovery service listen group adv discovery service get remote advertisements null discovery service group name fytas realm group 1 null receive peer advertisement which name ping token ds get remote advertisements null discovery service peer name ping token 1 null
|
listening broadcast message name ping token every specified wait time
|
override protected void startup this view new main window this initialize show this view
|
at startup create and show the main frame of the application
|
public void change world int row int col
|
request change world
|
private jxtree table build peers tree return null
|
create peers tree
|
private void initialize this set size 600 300 this set content pane get jcontent pane this set title resources get string title prototype
|
this method initializes this
|
private jsplit pane get splitter if splitter null splitter new jsplit pane splitter set resize weight 0 15 d splitter set divider size 10 splitter set left component get peers panel splitter set right component get content panel splitter set one touch expandable true return splitter
|
this method initializes splitter
|
public peer list panel get peers panel if peers panel null peers panel new peer list panel return peers panel
|
this method initializes peers panel
|
public void update observable o object arg if o instanceof network service set peer info all peers set peer info arg update peer list model all peers else if o instanceof discovery service provider set peer info all peers set peer info arg update peer list model all peers else if o instanceof discovery service mock array list string all msg mock array list string arg update peer list model all msg mock
|
peer list panel observe the following observable
|
private void initialize grid bag constraints grid bag constraints new grid bag constraints grid bag constraints fill grid bag constraints both grid bag constraints gridy 0 grid bag constraints weightx 1 0 grid bag constraints weighty 1 0 grid bag constraints gridx 0 this set size 400 300 this set layout new grid bag layout this set preferred size new dimension 300 88 this add get command tabbed pane grid bag constraints
|
this method initializes this
|
private jpanel get battle cmd panel if battle cmd panel null battle cmd panel new jpanel battle cmd panel set layout new grid bag layout battle cmd panel set tool tip text battle commands return battle cmd panel
|
this method initializes battle cmd panel
|
private jpanel get state cmd panel if state cmd panel null state cmd panel new jpanel state cmd panel set layout new grid bag layout state cmd panel set tool tip text state related commands return state cmd panel
|
this method initializes state cmd panel
|
public image icon get icon resource string resource return image icon get resource
|
get a resource as an icon
|
public object get string jndi name throws business layer exception try object result null result initial context lookup jndi name if result null throw new naming exception return result catch naming exception e e print stack trace return null
|
m todo que faz o lookup
|
public void do login string user string password throws business layer exception session user session user new session user user password get request get session get id session control security login session user
|
m todo do login
|
public void do logout throws business layer exception business layer user session user session control security identify user get request null session control security logout session user
|
m todo do logout
|
private void set action class class action class this action class action class
|
define o valor de action class
|
protected method get action method return this action method
|
o m todo get action method obtem o valor de action method
|
private void set action method method action method this action method action method
|
define o valor de action method
|
protected string get forward page return this forward page
|
o m todo get forward page obtem o valor de forward page
|
protected string get forward error return this forward error
|
o m todo get forward error obtem o valor de forward error
|
public business layer security get security return this security
|
o m todo get security obtem o valor de security
|
private void set security business layer security security this security security
|
define o valor de security
|
public void adjust size int window width int window height int scroll width window width scroller get absolute left 9 if scroll width 1 scroll width 1 int scroll height window height scroller get absolute top 9 if scroll height 1 scroll height 1 scroller set size scroll width scroll height
|
adjusts the widgets size such that it fits within the windows client
|
private void select row int row when a row other than the first one which is used as a header is selected display its associated mail item mail item item get mail item start index row if item null return style row selected row false style row row true item read true selected row row message panel get default message panel display item item this get absolute left this get absolute top
|
selects the given row relative to the current page
|
public void set expanded boolean expanded m link set visibility expanded visible gone m message set visibility expanded visible gone also change layout so that m text can be aligned vertically m linear layout set orientation expanded vertical horizontal
|
convenience method to expand or hide the message data
|
public boolean persist boolean was successful try version get persistence manager make persistent this was successful true catch exception e was successful false finally get persistence manager close return was successful
|
makes the schedule object persistent
|
public void test custom pattern handler message context msg context new message context null msg context set property filter pattern 1 ows msg context set property filter pattern 2 x20 string msg payload ows author x20 name self invalid xml character handler handler new invalid xml character handler handler init patterns msg context msg payload handler filter custom patterns msg payload assert false msg payload contains ows assert false msg payload contains x20
|
test for handling of custom patterns
|
public void test authenticate with empty or null password throws throwable system out println testing authenticate with empty or null password test authenticate collection string groups this authentication response get groups assert not null groups
|
run this with empty or null password by specifying in test config
|
public void test batch update query query query uds insert try sql parameter source named params new sql parameter source memberships size int count 0 for user group membership membership memberships named params count query create parameter membership get user id membership get user name membership get group id membership get group name membership get namespace int status simple spdao batch update query named params assert not null status assert equals status length named params length catch exception e fail e get message
|
test method for
|
public boolean equals final object obj if obj instanceof attribute return false final attribute attribute attribute obj if value null if attribute get value null return name equals attribute get name else return false else return name equals attribute get name value equals attribute get value
|
for attributes equality check
|
public value next value throws repository exception if repeating return null else repeating true return value
|
returns the next value of the property
|
public void set batch hint final int hint new throws repository exception hint hint new logger info batch hint set to hint new
|
sets the batch hint which declares a threashold on the number of documents
|
public document list start traversal throws repository exception logger info start traversal delete the global state to simulate full crawl global state null final string work dir sharepoint client context get google connector work dir global state forget state work dir sharepoint client context clear excluded urllogs sharepoint client context set initial traversal true global state new global state sharepoint client context get google connector work dir sharepoint client context get feed type return do traversal
|
to start a full crawl
|
public void set traversal context traversal context traversal context this traversal context traversal context
|
sets the traversal context
|
public int get no of visited list states return no of visited list states
|
returns the no of visited list states to check for pending docs from
|
public void set config keys final list string in keys if keys null throw new illegal state exception if in keys null keys in keys
|
sets the keys that are required for configuration
|
public void set fqdnconversion final boolean conversion fqdnconversion conversion if sharepoint client context null sharepoint client context set fqdnconversion conversion logger config fqdn value set to conversion
|
sets the fqdnconversion parameter
|
public session login throws repository exception logger info connector login if sharepoint client context is push acls try new gss acl ws sharepoint client context null check connectivity catch exception e throw new repository exception crawling cannot proceed becasue acl web service cannot be contacted and hecne acls canot be retreived while crawling you may still make the connector crawl by setting the acl flag as false in connector instance xml e return new sharepoint session this sharepoint client context
|
returns a session object for the current connector instance
|
private void set config strings if rb null checking the parameters of the resource bundle passed for int i key 0 i key keys size i key final object key keys get i key config strings put key rb get string string key config strings put spconstants mandatory fields rb get string spconstants mandatory fields logger config config strings loaded from the resource bundle config strings to string else logger warning unable to get resource bundle
|
sets the display strings for the configuration form depending on the
|
public void set excluded metadata final array list string in excluded metadata excluded metadata in excluded metadata if sharepoint client context null sharepoint client context set excluded metadata in excluded metadata logger config excluded metadata set to in excluded metadata to string
|
sets the metadata to be included
|
public void set included metadata final array list string in included metadata included metadata in included metadata if sharepoint client context null sharepoint client context set included metadata in included metadata logger config included metadata set to in included metadata to string
|
sets the excluded metadata
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.