input
stringlengths
10
828
output
stringlengths
5
107
public void sooner long delta expire at expiration get time delta
subtract code delta code from the deadline
public void error string msg throwable e log level error msg e
log an error message with an exception backtrace
protected void changed make copy so can iterate unsynchronized list subs get subscriber snapshot if subs null for iterator iter subs iterator iter has next tk run these in a separate thread try callback cb callback iter next cb changed this catch exception e log error callback threw e
call deadline changed method of all subscribers
public void site error string msg throwable e log level site error msg e
log a site error message with an exception backtrace
public int hash code long t expiration get time return int t int t 32
return a suitable hash code
public throwable get error return e
return the nested throwable
public void warning string msg log level warning msg null
log a warning message
public void warning string msg throwable e log level warning msg e
log a warning message with an exception backtrace
public void compile string pattern compile pattern to char array
compiles the text pattern for searching
public void sleep throws interrupted exception if expired return interrupt callback cb new interrupt callback long nap try register callback cb while expired thread sleep get sleep time finally cb disable unregister callback cb
sleep returning when the deadline is reached or possibly earlier
public vector search all char text int start int end vector results new vector int pos start while pos search text pos end 0 if pos 0 results add element new integer pos pos pat len return results
search for all occurrences of the compiled pattern in the given text
public int search char text return search text 0 text length
search for the compiled pattern in the given text
public void site warning string msg log level site warning msg null
log a site warning message
protected string get comparison string t obj return obj to string
get the string value of a parameterized object
public int partial match return partial
returns the number of partially matching characters at the end
protected string xlate string s s s trim s pad numbers s padlen s delete all s punctuation s delete space between initials s if normalisation options get remove initial determiners s remove initial determiners s if normalisation options get translate accents s replace accented char s return s
the translate method may be overriden by subclasses to
public inet address get inet addr return ina
extract the wrapped inet address to pass to a socket datagram
public void site warning string msg throwable e log level site warning msg e
log a site warning message with an exception backtrace
public string get error string return error string
p retrieves the last message resulting from a failure to load
public long next bits int bits if bits 32 return next bits long 0xffffffff l return long next bits 32 32 next 32 long 0xffffffff l
return the next pseudorandom number with code bits code random
public long next long long n if n 0 throw new illegal argument exception n must be 0 long bits val do bits next long 1 val bits n while bits val n 1 0 return val
returns a pseudorandom uniformly distributed int value between 0
public void load map file file load map make hash map serializer file
p loads the contents of a serialized map into this object
public void info string msg throwable e log level info msg e
log an information message with an exception backtrace
public void handle message logger log int msg level string message if next timestamp expired emit timestamp log next timestamp expire in constants day write message log logger name of msg level message
write the message to the stream prefaced by a timestamp if more than
protected print stream get print stream return stream
return the stored stream override this if need to fetch the stream
public element create root document document string name element element create the root element element document create element ns ns uri make tag name namespace declaration version of this xml document element set attribute ns http www w3 org 2000 xmlns xmlns ns prefix ns uri set attribute element xml versionname xml version set the document root document append child element return element
establish the root element in our namespace
public void debug string msg throwable e log level debug msg e
log a level 1 debug message with an exception backtrace
public element create element element parent string name document document element element document parent get owner document element document create element ns ns uri make tag name parent append child element return element
add a new element in our namespace to the given parent
public string get attribute element element string name return element get attribute ns ns uri name
get an attribute in our namespace from an element
public void set attribute element element string name string value element set attribute ns ns uri make tag name value
set an attribute in our namespace in an element
public node list get element list element element string name return element get elements by tag name ns ns uri name
return a list of named elements in our namespace
public element get element element element string name node list node list get element list element name return node list get length 0 null element node list item 0
return the first named element found in our namespace
public node remove node node node return node get parent node remove child node
remove this node from its parent
public void convert another object parent if parent instanceof serializable parent instanceof lockss serializable lockss not serializable exception exc new lockss not serializable exception root class name parent get class get name logger debug2 exc get message throw exc super convert another parent
p a specialized version of
public void debug1 string msg throwable e log level debug1 msg e
log a level 1 debug message with an exception backtrace
public void reset crc 0 length 0
reset the crc to initial values
public void update byte data crc crc8 table crc data 0xff length
update the crc from a byte
public void update byte data for int i 0 i data length i update data i
update the crc from an array of bytes
public byte get value return crc
return the current value of the crc
public void debug2 string msg throwable e log level debug2 msg e
log a level 2 debug message with an exception backtrace
public object convert another object parent class type object ret super convert another parent type if ret instanceof lockss serializable object parameters new object lockss context invoke method ret post unmarshal method post unmarshal parameters post unmarshal cache parameters object surrogate invoke method ret post unmarshal resolve method post unmarshal resolve parameters post unmarshal resolve cache parameters if surrogate null ret surrogate return ret
p converts an object using the superclass mechanism then
public void debug3 string msg throwable e log level debug3 msg e
log a level 3 debug message with an exception backtrace
private void start else tag if current stack m if stack peek if current stack used then throw new illegal argument exception you may not have an else except after a then m if stack peek in else true the easiest way to enter an else is to reverse test eval boolean bo top value bo top value m test eval peek pop boolean value bo top value bo top value m test eval peek push boolean value of bo top value
handle encountering the start of an else tag
public boolean once boolean ret state state false return ret
return true the first time called thereafter false
private conversion exception fail deserialize exception exc string buffer buffer new string buffer buffer append an exception of type buffer append exc get class get name buffer append was thrown by an object while it was being deserialized return new conversion exception buffer to string exc
p an exception message formatter used when an exception is
public comparable get order return order
returns the explicit order
public string to string return value null null value to string
returns get value
public boolean equals object o if o instanceof ordered object object ov ordered object o get value return value null ov null value equals ov else return false
returns true if both objects are ordered objects and have equal values
private void start list tag attributes attrs string append string name string value if do eval m in list true m prop list new array list string append attrs get value append if append null m append list false else m append list append equals true we may not append to a non existing list name get propname value get property name if m append list value null throw new illegal argument exception you may not append to the non existing list name
handle encountering the start of a list tag
public collection get values collection map values new array list elements size set keyset elements key set for iterator it keyset iterator it has next string key string it next map values add new ext map element key elements get key return map values
returns an array list collection to be used by the marshaller to store
public void serialize throws serialization exception interrupted ioexception can use this instance only once synchronized this if used throw new serialization exception serialization worker instance cannot be re used else used true perform serialization steps do create temporary file do create output stream do serialize do close output stream if get serialization read back mode do read back do rename
p serializes the object into the target file
private void start if tag attributes attrs if cur if new if m if stack push cur if reset m test eval m test eval add new stack boolean if attrs get length 0 m test eval peek push boolean value of evaluate attributes attrs
handle encountering the start of an if tag by parsing
private void start then tag if cur if m if stack peek cur if in then true cur if used then true all of the conditions have been posted time to and them together and eval stack true
handle encountering a starting then tag
public interface callback public void found link string url
callback for a link extractor to call each time it finds a url
private void start value tag if do eval inside a value element m in value true prepare a buffer to hold character data which may be chunked across several characters calls m char buffer new string buffer
handle encountering a starting value tag
private void start and tag m cond stack push tag and m test eval push new stack boolean
handle encountering a starting and tag
private void start or tag m cond stack push tag or m test eval push new stack boolean
handle encountering a starting or tag
private void start not tag m cond stack push tag not m test eval push new stack boolean
handle encountering a starting not tag
public string get value node node return node null null node get text content
override this method to handle a node valued
public string get value string s return s
override this method to handle a text valued
public string get value boolean b return b null null b to string
override this method to handle a boolean valued
public string get value number n return n null null n to string
override this method to handle a number valued
private void start test tag attributes attrs if attrs get length 0 find the curent conditional m test eval peek push evaluate attributes attrs
set the state of the test evaluation boolean
private void end else tag m if stack peek in else false
handle encoutering the end of an else tag
public void set locale locale locale if cookedmap is empty this locale locale else throw new illegal state exception cannot set locale after storing any cooked metadata
set the locale in which locale dependent values e
public locale get locale return locale null locale metadata util get default locale
return the locale in which values e
private void end list tag if do eval if m append list there is currently no method to append to a list value since i don t see other methods needing this ability i put it here string str value str value get property get propname if str value null str value length 0 str value str value str value str value string util separated string m prop list set property str value else set list property m prop list clean up m prop list null m in list false m append list false
handle encountering the end of a list tag
public boolean contains raw key string key return raw map contains key key to lower case
return true if the key has an associated value in the raw map
private void end property tag if do eval add au to tdb at end of processing current title if get propname equals title prop name try m tdb add tdb au from properties title props catch throwable ex log error title prop name ex get message title props null title prop name null m prop stack pop
handle encountering the end of a property tag
public int raw size return raw map size
return the size of the raw map
public boolean put metadata field field string value metadata exception ex put0 field value return ex null
set or add to the value associated with the key
private void end if tag if m if stack peek used then m test eval peek pop we no longer need the result from this if test else m test eval pop only pop if we didn t have an actual then m if stack pop
handle encountering the end of a propgroup tag
private void end then tag m if stack peek in then false
handle encountering the end of a then tag
public boolean has valid value metadata field field list curval get collection get key field return curval is empty is invalid curval get 0
return true iff the field has a valid value
public boolean has invalid value metadata field field list curval get collection get key field return curval is empty is invalid curval get 0
return true iff the field has a value which is invalid
public string extract article metadata am string value if extractor null return extractor extract am this value return value
if a extractor is present apply it to the argument return a string
public invalid value get invalid metadata field field return get invalid field get key
if the field has an invalid value return the
private void end test tag
handle encountering the end of a test tag
private invalid value get invalid string key list lst get collection key if lst is empty return null object res lst get 0 if res instanceof invalid value return invalid value res return null
if the key has an invalid value return the
public int get failed deserialization mode return failed deserialization mode
p returns this instances failed deserialization mode
public string get metadata field field return get field get key
return the value associated with a key else null if no valid value
private string get propname return string util separated string m prop stack
return the current property name
public interface splitter split a value into a list of values param am the article meta being stored into source of locale if necessary param field the field being stored param value the value being stored return list of values public list string split article metadata am metadata field field string value
splitter can be associated with a metadata field to split value strings into
private string get string key return get key null
return the value associated with a key else null if no valid value
public boolean get failed serialization mode return failed serialization mode
p returns this instances failed serialization mode
private string get string key string dfault list lst get collection key if lst is empty return dfault object res lst get 0 if res instanceof string return string res if res instanceof invalid value return null return null
return the value associated with a key else dfault if no valid value
private void set property string value string prop name get propname if title props null add property to title properties map string pname prop name substring title prop name length 1 title props put pname value else add property to property tree m props put prop name value
log a warning if overwriting an existing property
public int size return cookedmap size
return the size of the cooked map
public boolean get serialization read back mode return serialization read back mode
p returns this instances serialization read back mode
private string get property string name return m props get property name
return the property associated with a prop name
public boolean is empty return cookedmap is empty
return true if the cooked map is empty
protected content handler get content handler return new sax event handler
override to use a custom content handler
protected boolean is interesting tag name string tag name for string tag tags if tag name equals ignore case tag return true return false
return true if this is a tag whose value we should record
private void set list property list list string str value str value string util separated string list set property str value
set a list of property values
public interface emitter public void emit metadata cached url cu article metadata metadata
functor to emit article metadata object s created by extractor
public string pp string int indent string builder sb new string builder string tab string util tab indent sb append tab if cookedmap is empty sb append metadata empty n else sb append metadata n dump map sb cookedmap indent 2 sb append tab if raw map is empty sb append raw metadata empty n else sb append raw metadata n dump map sb raw map indent 2 return sb to string
return a pretty printed string
public interface emitter public void emit metadata article files af article metadata metadata
functor to emit article metadata object s created by extractor
public string get raw value return raw value
return the raw value that was attempted to be stored
public void init service lockss app app throws lockss app exception if log is debug2 log debug2 get class name init service if the app null the app app register default config callback else throw new lockss app exception multiple instantiation
called to initialize each service in turn
private void skip white space char ring ring int min kars throws ioexception do if refill min kars return while ring skip leading white space
keep calling skip leading white space and refilling the char ring until there