input
stringlengths
10
828
output
stringlengths
5
107
private void clear cached values number formats null number format null date formats null collator null cached urlescaping charset null url escaping charset cached false
deletes cached values that meant to be valid only during a single
public void clear shared variables variables clear load built in shared variables
removes all shared variables except the predefined ones compress html escape etc
public void process throws template exception ioexception object saved env thread env get thread env set this try cached values from a previous execution are possibly outdated clear cached values try visit get template get root tree node do not flush if there was an exception out flush finally it s just to allow the gc to free memory clear cached values finally thread env set saved env
processes the template to which this environment belongs
static public void set xpath support class class cl if cl null cl is assignable from xpath support class throw new runtime exception class cl get name does not implement freemarker ext dom xpath support xpath support class cl
set an alternative implementation of freemarker
public void clear template cache cache clear
removes all entries from the template cache thus forcing reloading of templates
static public class get xpath support class return xpath support class
get the currently used freemarker
public boolean get localized lookup return cache get localized lookup
returns if localized template lookup is enabled or not
public void set localized lookup boolean localized lookup this localized lookup localized lookup cache set localized lookup localized lookup
enables disables localized template lookup
public template hash model get enum models if enum models null throw new unsupported operation exception enums not supported on pre 1 5 jre return enum models
returns a hash model that represents the so called class enum models
public void set classic compatible boolean classic compatibility this classic compatible classic compatibility boolean true boolean false properties set property classic compatible key classic compatible to string
toggles the classic compatibile mode
public boolean is classic compatible return classic compatible null classic compatible boolean value parent is classic compatible
returns whether the engine runs in the classic compatibile mode
public void set locale locale locale if locale null throw new illegal argument exception setting locale can t be null this locale locale properties set property locale key locale to string
sets the locale to assume when searching for template files with no
public void set min scale int min scale if min scale 0 throw new illegal argument exception min scale 0 this min scale min scale
sets the minimal scale to use when dividing big decimal numbers
public time zone get time zone return time zone null time zone parent get time zone
returns the time zone to use when formatting time values
public void set max scale int max scale if max scale min scale throw new illegal argument exception max scale min scale this max scale max scale
sets the maximal scale to use when multiplying big decimal numbers
public void set time zone time zone time zone if time zone null throw new illegal argument exception setting time zone can t be null this time zone time zone properties set property time zone key time zone get id
sets the time zone to use when formatting time values
public locale get locale return locale null locale parent get locale
returns the assumed locale when searching for template files with no
public void set number format string number format if number format null throw new illegal argument exception setting number format can t be null this number format number format properties set property number format key number format
sets the number format used to convert numbers to strings
public string get number format return number format null number format parent get number format
returns the default number format used to convert numbers to strings
public template model get local variable string name throws template model exception if local context stack null for int i local context stack size 1 i 0 i local context lc local context local context stack get i template model tm lc get local variable name if tm null return tm return current macro context null null current macro context get local variable name
returns the loop or macro local variable corresponding to this
public template model get variable string name throws template model exception template model result get local variable name if result null result current namespace get name if result null result get global variable name return result
returns the variable that is visible in this context
public void set time format string time format if time format null throw new illegal argument exception setting time format can t be null this time format time format properties set property time format key time format
sets the date format used to convert date models representing time only
public string get time format return time format null time format parent get time format
returns the date format used to convert date models representing
public template model get global variable string name throws template model exception template model result global namespace get name if result null result root data model get name if result null result get configuration get shared variable name return result
returns the globally visible variable of the given name or null
public void set date format string date format if date format null throw new illegal argument exception setting date format can t be null this date format date format properties set property date format key date format
sets the date format used to convert date models representing date only
protected object create return null
this method is invoked when
public void set global variable string name template model model global namespace put name model
sets a variable that is visible globally
public string get date format return date format null date format parent get date format
returns the date format used to convert date models representing
public void set date time format string date time format if date time format null throw new illegal argument exception setting datetime format can t be null this date time format date time format properties set property datetime format key date time format
sets the date format used to convert date models representing datetime
public void set variable string name template model model current namespace put name model
sets a variable in the current namespace
public string get date time format return date time format null date time format parent get date time format
returns the date format used to convert date models representing datetime
public void set local variable string name template model model if current macro context null throw new illegal state exception not executing macro body current macro context set local var name model
sets a local variable one effective only during a macro invocation
public void set template exception handler template exception handler template exception handler if template exception handler null throw new illegal argument exception setting template exception handler can t be null this template exception handler template exception handler properties set property template exception handler key template exception handler get class get name
sets the exception handler used to handle template exceptions
public string get start location string template name template null template get name input return on line begin line column begin column in template name
returns a string that indicates
public template exception handler get template exception handler return template exception handler null template exception handler parent get template exception handler
retrieves the exception handler used to handle template exceptions
public void write record wiki record rec r rec string filename constants output folder r get page name constants page suffix log debug writing filename make sure all directories have been created int index 0 while index filename index of index 1 index string dir name filename substring 0 index file dir new file dir name if dir exists log debug creating directory dir name dir mkdirs try f new print writer new file output stream filename render page catch ioexception e throw new runtime exception e f close
writes a record
public void set arithmetic engine arithmetic engine arithmetic engine if arithmetic engine null throw new illegal argument exception setting arithmetic engine can t be null this arithmetic engine arithmetic engine properties set property arithmetic engine key arithmetic engine get class get name
sets the arithmetic engine used to perform arithmetic operations
private boolean last line was monospaced int i if i 0 return r get content i 1 index of 0 return false
tells us if the last line before i was monospaced
public boolean has more records if line index of insert into 1 return true return false
tells whether the dump has one more record
public void output instruction stack print writer pw pw println list iterator iter element stack list iterator element stack size if iter has previous pw print template element prev template element iter previous pw print prev get description pw print pw print prev get start location pw println while iter has previous template element prev template element iter previous if prev instanceof unified call prev instanceof include string location prev get description prev get start location if location null location length 0 pw print in pw println location pw println pw flush
outputs the instruction stack
public wiki record get next record throws ioexception wiki record record new wiki record line line get next line return record
gets the next wiki record
private boolean next line is monospaced int i if i r size 1 return r get content i 1 index of 0 return false
tells us if the next line after i is monospaced
private boolean last line was definition int i if i 0 return r get content i 1 index of 0 return false
tells us if the last line before i was a definition line
public arithmetic engine get arithmetic engine return arithmetic engine null arithmetic engine parent get arithmetic engine
retrieves the arithmetic engine used to perform arithmetic operations
private boolean next line is definition int i if i r size 1 return r get content i 1 index of 0 return false
tells us if the next line after i is a definition line
private boolean last line was list int i if i 0 return r get content i 1 index of 0 r get content i 1 index of 0 return false
tells us if the last line before i was also a list element
private boolean next line is list int i if i r size 1 return r get content i 1 index of 0 r get content i 1 index of 0 return false
tells us if the next line after i is also a list element
private boolean last line was top int i string s if i 0 s r get content i 1 return s index of 0 s index of 1 return false
tells us if the last line before i was a digram top
public void set object wrapper object wrapper object wrapper if object wrapper null throw new illegal argument exception setting object wrapper can t be null this object wrapper object wrapper properties set property object wrapper key object wrapper get class get name
sets the object wrapper used to wrap objects to template models
private boolean next line is bottom int i string s if i r size 1 s r get content i 1 return s index of 0 s index of 1 return false
tells us if the next line after i is also a list element
private void write htmltext string source new htmltext writer r source write htmltext f
parses a paragraph for format and anchor tags
public object wrapper get object wrapper return object wrapper null object wrapper parent get object wrapper
retrieves the object wrapper used to wrap objects to template models
private void write header map string object model new hash map string object model put record r write template config header model
writes the header of each html page
private void write footer map string object model new hash map string object write template config footer model
writes the footer with nav unit of each html page
private void write template string template name map string object model try configuration c new configuration c set class for template loading get class constants template loading path template template c get template template name add constants to model model put image url constants image url template process model f catch ioexception e throw new runtime exception e catch template exception e throw new runtime exception e
common code for writing to a freemarker template
public void set output encoding string output encoding this output encoding output encoding java util properties doesn t allow null value if output encoding null properties set property output encoding key output encoding else properties remove output encoding key output encoding set true
sets the output encoding
public namespace get namespace string name if name starts with name name substring 1 if loaded libs null return namespace loaded libs get name else return null
returns the name space for the name if exists or null
public void set urlescaping charset string url escaping charset this url escaping charset url escaping charset java util properties doesn t allow null value if url escaping charset null properties set property url escaping charset key url escaping charset else properties remove url escaping charset key url escaping charset set true
sets the url escaping charset
public namespace get main namespace return main namespace
returns the main name space
public namespace get current namespace return current namespace
returns the main name space
public namespace get global namespace return global namespace
returns a fictitious name space that contains the globally visible variables
public map get settings return collections unmodifiable map properties
this meant to return the string to string code map code of the
public template hash model get data model return new template hash model public boolean is empty return false public template model get string key throws template model exception template model result root data model get key if result null result get configuration get shared variable key return result
returns the data model hash
public void set settings properties props throws template exception iterator it props key set iterator while it has next string key string it next set setting key props get property key trim
set the settings stored in a code properties code object
public template hash model get global variables return new template hash model public boolean is empty return false public template model get string key throws template model exception template model result global namespace get key if result null result root data model get key if result null result get configuration get shared variable key return result
returns the read only hash of globally visible variables
public void set settings input stream props in throws template exception ioexception properties p new properties p load props in set settings p
reads a setting list key and element pairs from the input stream
public void set custom attribute string name object value synchronized custom attributes custom attributes put name value
sets a named custom attribute for this configurable
public void remove custom attribute string name synchronized custom attributes custom attributes remove name
removes a named custom attribute for this configurable
public object get custom attribute string name object retval synchronized custom attributes retval custom attributes get name if retval null custom attributes contains key name return null if retval null parent null return parent get custom attribute name return retval
retrieves a named custom attribute for this configurable
public void set current visitor node template node model node current visitor node node
sets template node model as the current visitor node
public template get template for importing string name throws ioexception return get template for inclusion name null true
gets a template for importing used with
public object getitem string key throws template model exception return beans wrapper get default instance unwrap get variable key
a hook that jython uses
public void setitem string key object o throws template exception set global variable key get object wrapper wrap o
a hook that jython uses
protected void finalize throws throwable try close catch throwable e get log error e to string finally super finalize
wrapper for close to make sure all resources are clean up
public void close rwlock write lock lock try if bdb null if bdb close throw new runtime exception error closing a tokyo cabinet database code bdb ecode bdb errmsg bdb null finally rwlock write lock unlock
close the database
public long size long rwlock read lock lock try return bdb rnum finally rwlock read lock unlock
return the number of records in the database
public void clear rwlock write lock lock try bdb vanish finally rwlock write lock unlock
optimized clear operation
public int size long ret size long if ret integer max value throw new runtime exception database size exceeds max int use size long return int ret
return the number of records in the database
public void initialize if server socket null throw new runtime exception unable to start luci butler object thread t new thread this t set name luci butler socket accept thread t set daemon false force an explicit shutdown call t start
this method is called to begin accepting socket connections
public void close rwlock write lock lock try if hdb null if hdb close throw new runtime exception error closing a tokyo cabinet database code hdb ecode hdb errmsg hdb null finally rwlock write lock unlock
close the database
public void clear rwlock write lock lock try hdb vanish finally rwlock write lock unlock
optimized clear operation
public string get candidate name return this candidate name
gets the duplicate candidates name
public void clear this pairs clear
clear the memoization
public void set first t new first assert new first null this first new first
setter for first element
public void set second u new second assert new second null this second new second
setter for second element
public int compare to pair t u other int cmp this get first compare to other get first if cmp 0 comparison based on first element return cmp else comparison based on second element return this get second compare to other get second
lexicographic comparison first before second
protected void add above and below edges pair t t added edge assert added edge null add the above sorted set pair t t set this vertices above get added edge get second if set null create the set set new tree set pair t t this vertices above put added edge get second set set add added edge add the below set this vertices below get added edge get first if set null create the set set new tree set pair t t this vertices below put added edge get first set set add added edge
internally use to register above and below vertices
public void test exists valid registry key initialize registry key r new registry key root key hkey local machine hardware assert equals valid key hklm hardware must report true exists true r exists
tests that the code exists code method succeeds on existing key
public void test exists invalid registry key initialize registry key r new registry key root key hkey local machine good bad im the one with the gun assert equals bogus key hkcu ooga booga must report false does not exist false r exists
tests that the code exists code method fails on a non existant key
public void test create new registry key initialize try registry key r new registry key root key hkey current user testkey if r exists r delete r create catch registry exception re fail creation of a new key must succeed
tests creating a non existant key succeeds
public void test create duplicate registry key initialize try registry key r new registry key root key hkey current user testkey if r exists r create r create fail creation of a duplicate key must fail catch registry exception re success
tests creating a duplicate key fails
public void test delete valid registry key initialize try registry key r new registry key root key hkey current user testkey if r exists r create r delete catch registry exception re fail deletion of a non empty key must succeed
tests that deleting a valid key succeeds
public boolean has next return m index m count
returns code true code if the iteration contains more
public object next if has next throw new no such element exception return new registry key m key get root key m key make path get next
returns the next code registry key code element in the iteration
public void test delete invalid registry key initialize try registry key r new registry key root key hkey current user testkey if r exists r delete r delete fail deletion of an invalid key must fail catch registry exception re success
tests that deleting an invalid key fails
public void test has subkeys fail registry key initialize registry key r new registry key root key hkey current user testkey try if r exists r delete r create assert equals checking if a key without subkey has keys must fail false r has subkeys catch registry exception re fail subkey creation must succeed
tests that the code has subkeys code method fails on a key without
public void test has subkeys registry key initialize registry key r new registry key root key hkey current user testkey try if r exists r delete r create r create subkey testkey assert equals checking if a key with subkey has keys must not fail true r has subkeys catch registry exception re fail subkey creation must succeed
tests that the code has subkeys code method succeeds on a key that
public void test subkeys registry key initialize registry key r new registry key root key hkey current user testkey assert not null subkeys must not be null r subkeys
test that the code subkeys code method correctly returns an iterator
public void set type value type type if type null throw new null pointer exception value type cannot be a null m type type
sets this code registry value code s code value type code
public object next return m key get value get next
returns the next registry value element in the iteration