input
stringlengths
10
828
output
stringlengths
5
107
protected shared list get new shared list return new folder
subclasses should override this to return an empty instance of
public void replace item shared list item item int idx replace item item idx false
replaces the item with the given index
public void replace item shared list item item int idx boolean force event item record rec item record items element at idx if rec obj equals item force event rec obj item if listeners null shared list event evt new shared list event this rec obj items index of rec rec id listeners fire element replaced evt
replaces the item with the given index
public boolean contains shared list item item for enumeration e items elements e has more elements if item record e next element obj equals item return true return false
returns true if the list contains the item
private void remove from list mutable tree node node if list null if list contains shared list item node list remove item shared list item node for enumeration e node children e has more elements remove from list mutable tree node e next element
recursively removes a node and its descendants from the shared list
public static void add converter string mime type shared file converter conv vector v vector converters get mime type if v null v new vector 1 converters put mime type v v add element conv
adds a converter for the given mime type
public boolean remove item shared list item item item record rec null int idx 1 synchronized items for int i 0 i items size idx 1 i rec item record items element at i if rec obj equals item idx i if idx 1 items remove element at idx if idx 1 if listeners null shared list event evt new shared list event this rec obj idx rec id listeners fire element removed evt return true return false
removes an item
public boolean is dispatch thread return thread current thread change queue
returns true if the calling thread is the thread that dispatches
public object id get object id return value
returns the value wrapped by the item
public string to external form string str null if value null str value to string return str
returns a string that can be parsed by code from external form code
public void from external form string external form this value object id from string external form
parses the string to initialize the item
public boolean equals object obj return obj instanceof folder item folder item obj value equals value
checks for equality of two folder items
public boolean remove item int idx item record rec null if idx items size synchronized items rec item record items element at idx items remove element at idx if listeners null shared list event evt new shared list event this rec obj idx rec id listeners fire element removed evt return true return false
removes an item
public void clear items clear if listeners null shared list event evt new shared list event this null 1 1 l listeners fire list cleared evt
clears the list
public date get creation date date d null string map item item string map item get creation date if item null try d df parse item to string catch parse exception pe pe print stack trace return d
returns the creation date of the file
public void set creation date date d put creation date new string map item df format d
sets the creation date of the file
public date get modification date date d null string map item item string map item get modification date if item null try d df parse item to string catch parse exception pe pe print stack trace return d
returns the date of the last modification to the file
public void set modification date date d put modification date new string map item df format d
sets the date of the last modification to the file
public string get creating user string u null string map item item string map item get creating user if item null u item to string return u
returns the id of the user who created the file
public void set creating user string user only let this happen once put creating user new string map item user
sets the id of the user who created the file
public string get modifying user string u null string map item item string map item get modifying user if item null u item to string return u
returns the id of the last modifying user
public void set modifying user string user put modifying user new string map item user
sets the id of the last modifying user
public void element added map event evt shared map map shared map evt get source shared map item key shared map item evt get key shared map item value shared map item evt get value if listen for item props system err println listener create sharedmapsupport property support add property change listener this value cl broadcast change new put change key value id
invoked when an element is added to the end of the map
public string get content type string u null string map item item string map item get content type if item null u item to string return u
returns the content e
public void element removed map event evt shared map map shared map evt get source shared map item key shared map item evt get key shared map item value shared map item evt get value if listen for item props property support remove property change listener this value cl broadcast change new remove change key id
invoked when an element is removed from the map
public void set content type string content type put content type new string map item content type
sets the content e
public void fire list cleared list event evt vector tmp vector listeners clone for enumeration e tmp elements e has more elements list listener l list listener e next element if l instanceof shared list listener shared list listener l list cleared evt
fires an event indicating that the list has been cleared
public long get file size long sz 1 string map item item string map item get size if item null sz long value of item to string long value return sz
returns the size of the file or 1 if not set
public void set file size long sz put size new string map item long to string sz
sets the size of the file
public string to external form return s
returns a string that can be parsed by code from external form code
public void set deletable boolean deletable if deletable remove deletable else put deletable new string map item true
sets the deletable state of the file
public void from external form string external form s external form
parses the string to initialize the item
public enumeration keys return items keys
returns an enumeration of keys
public boolean is deletable boolean result false string map item item string map item get deletable result item null item to string equals true return result
returns the deletable state of the file
public enumeration elements return items elements
returns an enumeration of elements
public void start sharing object shared object replicated object client client object id id client get object id shared object listener new shared map support client id true shared map shared object add map listener listener shared map shared object add property change listener listener
attach listeners necessary to replicate the object
public shared map item get shared map item key return shared map item items get key
returns the value with the specified key
public void stop sharing object shared object replicated object client client if listener null shared map shared object remove map listener listener shared map shared object remove property change listener listener
detach any listeners attached in code start sharing code
public object read object input stream in throws ioexception shared map map new shared map return read object in map
reads the object from the given stream
public shared map item get item key shared map item item enumeration e elements enumeration keys keys while e has more elements shared map item sitem shared map item e next element shared map item key shared map item keys next element if sitem item return key return null
returns the key with the shared map item
public shared map item remove shared map item key shared map item item shared map item items remove key if item null listeners null listeners fire element removed key item return item
removes and returns the value with the specified key
public void send login java net http urlconnection con if password null base64 encoder encoder new base64 encoder string auth login user password con set request property authorization basic encoder encode buffer auth get bytes
utility method for web authentication
public shared map item put shared map item key shared map item value shared map item result shared map item items get key items put key value only fire an event if we actually made a change if result value result null value null value equals result listeners null listeners fire element added key value return result
adds an item
public chat session get chat session int idx replicated object client cl chat session cs null try object id id object id session ids element at idx cs chat session cl get object id catch exception e return cs
convenience method to lookup and retrieve a chat session using
public chat session get chat session string name replicated object client cl chat session cs null for int i 0 i get chat session count cs null i chat session tmp get chat session i cl if tmp null tmp get name equals name cs tmp return cs
convenience method to lookup and retrieve a chat session using
public chat session create chat session string name replicated object client cl return create chat session name cl null
convenience method that creates a chat session and an associated
public int get footer mode return footer mode
returns an integer describing the items to be excluded from the
public void start sharing object shared object replicated object client client object id id client get object id shared object listener new chat message list change support client id prop listener new property support client id chat message list shared object add list listener listener chat message list shared object add property change listener prop listener
attach listeners necessary to replicate the object
public void stop sharing object shared object replicated object client client chat message list shared object remove list listener listener chat message list shared object remove property change listener prop listener
detach any listeners attached in code start sharing code
protected chat message list get new chat message list return new chat message list
can be overriden by subclasses
public void activate if cv null cv get outgoing text pane set enabled is writable cv get send button set enabled is writable cv to end
disable input if not writable
private properties load properties from url string url string try url url new url url string properties prop new properties prop load url open stream return prop catch exception e system out println error in loading properties from url system out println e get message return null
loads all of the chat settings off a specified file from a url
public void add message chat message msg could speed this up by just checking the end disabling this check for now we need to re think how messages identify themselves when if we re write the chat stuff if messages contains msg messages add element msg while messages size max messages messages remove element at 0 chat listeners fire element added msg
called by client ui object to add a message to the session
public void start sharing object obj replicated object client client object id id client get object id obj listener new resource queue listener client id resource queue resq resource queue obj resq add list data listener listener resq add property change listener listener
attach listeners necessary to replicate the object
public void stop sharing object obj replicated object client client if listener null resource queue resq resource queue obj resq remove list data listener listener resq remove property change listener listener
detach any listeners attached in code start sharing code
public void add list data listener list data listener l if listener list null listener list new event listener list listener list add list data listener class l
add a listener to the list thats notified each time a change
public void remove list data listener list data listener l if listener list null listener list remove list data listener class l
remove a listener from the list thats notified each time a
protected void output header html print writer out string style sheet string type string title out println html out println head out println link rel stylesheet type text css href style sheet define the reload msgs function only for transcript in out modes if type equals out type equals in out println script out println function reload msgs out print parent frames chat transcript out println location reload out println out println script out print title out print title out println title out println head
outputs the header for the page
public string get home button label return home button label
the label we put on the home button
public string get title prefix return title prefix
string to be prepended to the title of the current page if the
public boolean is at front resource queue resq resource queue object return elem null resq get size 0 resq get element at 0 elem
returns true if we are at the front of the queue
public int add client long cid int init count return set count cid init count
adds a counter with the given value for the the given client adding
public void element added list event evt
invoked when an element is added to the end of the list
public void element removed list event evt
invoked when an element is removed from the list
public int set count long cid int count int idx get index of cid if idx 1 idx counts length ensure size for index idx cids idx cid counts idx count return idx
sets the counter for the given client
public void element inserted list event evt
invoked when an element is inserted into the list
public void element replaced list event evt
invoked when an element in the list is replaced
public int get count long cid int default val int result default val int idx get index of cid if idx 1 result counts idx return result
returns the count for the given cid or the default value if not
public int get object idcount return ids size
returns the size of the list
public void remove client long cid int idx get index of cid if idx 1 long ncids new long cids length 1 int ncounts new int counts length 1 int j 0 for int i 0 i counts length i if i idx ncids j cids i ncounts j counts i j cids ncids counts ncounts
removes the counter for the given client shrinking the arrays
public object id get object idat int idx return object id ids element at idx
returns the specified object id
public enumeration get object ids return ids elements
returns an enumeration of all object ids in the list
protected void copy arrays from client counter set set cids new long set cids length system arraycopy set cids 0 cids 0 cids length counts new int set counts length system arraycopy set counts 0 counts 0 counts length
initializes our arrays from copies of the arrays in the given
public list model get list model if list model null list model new replicated object list model return list model
returns a list model adapter for this list
public int get size return cids length
returns the size of the set
public string get counter list string buffer buf new string buffer for int i 0 i cids length i buf append cids i buf append buf append counts i if i cids length 1 buf append return buf to string
returns a list of client counter pairs
public void add map listener map listener l listeners add element l
adds a map listener
public void remove map listener map listener l listeners remove element l
removes a map listener
public void clear listeners remove all elements listeners null source null
utility method to clear the object
public void object added replicated object client event e criteria set object source source try if criteria include object e get id listener object added e catch halt search exception hse
called when an object is added
private void send message string text out get text strip off a trailing cr if text ends with n text text substring 0 text length 1 send message text out set text out grab focus
when the user presses the send button put the contents of
public void object removed replicated object client event e criteria set object source source try if criteria include object e get id listener object removed e catch halt search exception hse
called when an object is removed
public void object changed replicated object client event e
called when a change is broadcast by the local client
protected change create change property change event pce return new property change change pce
may be overriden to return a different kind of change for the
public void seen by long cid int idx get index of cid system err println rcvr seen by bef cid num seen number seen counts get counter list idx idx if idx 1 counts idx 0 counts idx 1 number seen system err println rcvr seen by aft cid num seen number seen counts get counter list idx idx
should be called to indicate that the given client has seen the
public boolean get seen by all return number seen cids length
returns true if all clients from the original vector clock have
public vector clock copy return new vector clock this
returns a copy of the current state of the clock
protected void process before add replicated object client client object copy throws ioexception
may be overridden to modify the object before it is added to
public long get interval return msec
returns the longerval in millisecs at which the timer will fire
protected boolean values are different object old val object new val return old val new val old val null new val null old val equals new val
checks to see if the objects are different
public void set interval long msec if this msec msec this msec msec synchronized runner runner notify
sets the longerval in millisecs at which the timer will fire
public boolean is running return life null
returns true if the timer is currently running
public void send message string text chat message msg new chat message text user name session add message msg
sends a message
public void fire element added object element fire element added element 1
fires an element added event with an unknown index
public void fire element removed object element int idx list event evt new list event source element idx fire element removed evt
fires an element removed event
public void fire element removed object element fire element removed element 1
fires an element removed event with an unknown index
public void send local message string text chat message msg new chat message text user name add message msg in get document
adds a message locally but does not send it to everyone
public void fire element replaced list event evt vector tmp vector listeners clone for enumeration e tmp elements e has more elements list listener e next element element replaced evt
fires an element replaced event
public int get listener count return listeners size
returns the number of registered listeners
public void add users vector v for enumeration e v elements e has more elements object obj e next element it s worth doing this check here to save time later when we re actually looking at objects if users contains obj users add element obj
adds a vector of users principals to the criterias user list