input
stringlengths
10
828
output
stringlengths
5
107
public void set root node node root node this root node simple node root node set root node node
set the root node of the tree
public void set title node node title node this title node simple node title node set title node node
set the title node of the tree
public void set contents node node contents node this contents node simple node contents node set contents node node
set the contents node of the tree
public void print tree simple node node throws gate exception print tree node false print tree simple node
traverse and translate a subtree
public void reset reset root node reset
reset the output strings on all nodes in the tree
public int get num nodes simple node node return get num nodes 0 node get num nodes simple node
count the number of nodes in a sub tree
public boolean at end return kind node kind null next kind node kind null at end
finished the document
public void merge yam parse tree other heading nodes add all other heading nodes root node add children other root node errors add all other errors warnings add all other warnings links add all other links includes add all other includes merge yam parse tree
merge another tree with this one
public boolean same place token other assert this instanceof token return same place token this other
does this token point to the same place as another token
protected void print node body simple node node throws gate exception pr node get body
print the body text of a node
public void add to footer string footer addition footer stuff append footer addition add to footer string
material to insert at the end of the translation
public yam parse tree parse throws gate exception return parse false false 0 do includes parse
protected jjtyam parser state jjtree new jjtyam parser state
public void make preamble throws gate exception simple node title node parse tree get title node if title node null pr make preamble else string node image get node image title node pr make preamble node image if is html pr make header null 1 node image true cow title heading make preamble
deal with the preamble material and title if it exists
public int get min spaces before return min spaces before
returns the minimum number of desired spaces before the annotation
public int get max spaces before return max spaces before
returns the maximum number of desired spaces before the annotation
public int get norm spaces before return norm spaces before
returns the normal number of desired spaces before the annotation
public int get min spaces after return min spaces after
returns the minimum number of desired spaces after the annotation
public int get max spaces after return max spaces after
returns the maximum number of desired spaces after the annotation
public int get norm spaces after return norm spaces after
returns the normal number of desired spaces after the annotation
private string link exists string page return page
returns link name if it exists otherwise it returns null
public boolean is empty synchronized this return linked by is empty included by is empty
does this dependencies contain any information about links or includes
static public void normalise document doc string builder content step 1 process document with the xgapp file the application will produce two types of annotations look at the static variables wrap at and edit at commenting this out because yam parser xgapp is not working yet try if document processor null setup default document processor document processor process document doc catch runtime exception e throw e catch exception e throw new runtime exception e todo uncomment the following line format document doc content normalise document
normalise the spacing in an annotated yam document
public boolean equals object obj if obj null return false if obj instanceof dependencies return false dependencies other dependencies obj synchronized this return this linked by equals other linked by this included by equals other included by
are two dependencies equal they are if they contain the same links and
public string get canonical path throws gate exception string path null try path location get file get canonical path catch ioexception ioe throw new gate exception ioe return path get canonical path
giveas the canonical path of this yam file
private void write object object output stream oos throws ioexception oos default write object oos write object location get file get path write object oos
allow serialization of the spring fsr field
public int hash code synchronized this return linked by hash code included by hash code
returns the hash code value for this dependencies
private boolean is image link string link if m inline images for iterator i m inline image patterns iterator i has next if m inline matcher matches link pattern i next return true return false
matches the given link to the list of image name patterns to determine
public string translate map m abstract translator t string target if target equals html html output string builder body new string builder for string key set string m key set todo for each yam under the current dir using the io handler append the title and all the links in the file to body return body to string else if target equals la te x latex output todo return m to string catchall for other output types return m to string string translate map abstract translator string
translate sitemap updates in yam pages
public reader get reader string path throws ioexception file f new file path if f is absolute source dir null f new file source dir path return new file reader f get reader string
get a reader from a path
public boolean exists string path file f new file path if f is absolute source dir null f new file source dir path return f exists exists string
check a path for existence
public void set context path string context path this io handler set context path context path set context path string
set the path in which to check for existence of relative links
public reader get reader in context string path throws ioexception file f new file path if f is absolute return new file reader f string context context path if context null if source dir null context source dir get path else context f new file context path return new file reader f get reader in context string
get a reader from a path relative to the context path
public boolean exists in context string path string context context path if context null if source dir null context source dir get path else context null file f new file context path return f exists exists in context string
check a path for existence relative to the context path
public void set context path string context path this context path context path set context path
set the path in which to check for existence of relative links
public string get create page url if create page url null create page url return create page url get create page url
get the url which non existent links will be pointed at which
public void set create page url string create page url this create page url create page url set create page url string
set the url which non existent links will be pointed at which
public void set create page url url resource create page url try this create page url create page url get url to string catch ioexception e todo set create page url url resource
set the url which non existent links will be pointed at which
private void write object object output stream oos throws ioexception oos default write object if bib page url null oos write object null else oos write object bib page url get url to string write object oos
allow serialization of the spring url resource field
public url resource get bib page url return bib page url
get the url within which citation keys will be resolved
public void set bib page url url resource bib page url this bib page url bib page url
set the url within which citation keys will be resolved
public string get bib anchor prefix return bib anchor prefix
get the prefix added to citation keys when forming a reference to a
public void set bib anchor prefix string bib anchor prefix this bib anchor prefix bib anchor prefix
set the prefix added to citation keys when forming a reference to a
public void set create page url string create page url this io handler set create page url create page url set create page url string
set the url which non existent links will be pointed at which presumably
public void set create page url url resource create page url this io handler set create page url create page url set create page url url resource
set the url which non existent links will be pointed at which presumably
public void set bib page url url resource bib page url this io handler set bib page url bib page url
set the url within which citation keys will be resolved
public void set bib anchor prefix string bib anchor prefix this io handler set bib anchor prefix bib anchor prefix
set the prefix added to citation keys when forming a reference to a
public file get output file file type type string path location get file get path if string utils get filename path contains path path substring 0 path last index of return new file path type suffix get output file file type
create a file of a particular output type
private string escape htmlentities string buffer buf string buffer tmp buf new string buffer buf length 20 for int i 0 i buf length i char ch buf char at i if ch tmp buf append lt else if ch tmp buf append gt else if ch for int j i buf length 1 i 1 i j buf length j int ch2 buf char at j if ch2 tmp buf append ch break if ch2 character is letter or digit char ch2 tmp buf append amp break else tmp buf append ch return tmp buf to string
escapes xml entities in a html compatible way i
public file get html file return get output file file type html get html file
get the file for html output
public string get html path return get html file get path get html path
get the path for an html output file
public void generate type file type type output types add type generate type file type
trigger generation of the various output types
private string read until string end chars throws ioexception string buffer sb new string buffer 80 int ch next token while ch 1 if ch ch next token if ch 1 break else if end chars index of char ch 1 push back ch break sb append char ch ch next token return sb to string
reads the stream until it meets one of the specified ending characters or
private void log event method exception string method string param string log warn dependencies method param string caught a gate exception log warn dependencies method param string could not update dependencies log warn dependencies method param string returned no files to regenerate possibly erroneously
log an exception caught by one of the event methods
private string read while string end chars throws ioexception string buffer sb new string buffer 80 int ch next token while ch 1 if end chars index of char ch 1 push back ch break sb append char ch ch next token return sb to string
reads the stream while the characters that have been specified are in the
private string map to string map string set string map string builder build new string builder list string keys new array list string map key set collections sort keys for string key keys build append key build append list string vals new array list string map get key collections sort vals for string val vals build append val build append remove the final comma build delete char at build length 1 build append remove the final semi colon build delete char at build length 1 return build to string
create a string representation of a links or includes map
public yam parse tree parse throws gate exception parse tree null reader reader null try a reader for the yam reader new file reader location get file parse yam parser parser new yam parser reader io handler set source dir location get file get parent file parser set iohandler io handler parser set do includes do includes parse tree parser parse catch ioexception e throw new gate exception e finally close the io stuff try if reader null reader close catch ioexception ee log debug problem closing io in generate exception was ee return parse tree parse
generate the parse tree for this yam file
public string links to as string return map to string links to
create a string representation of the links to relationships in this
private jspwiki markup parser get clean translator if m clean translator null m clean translator new jspwiki markup parser null m clean translator m allow html true return m clean translator
does a lazy init
public string includes as string return map to string includes
create a string representation of the includes relationships in this
public string linked by as string return map to string linked by
create a string representation of the linked by relationships in this
public string included by as string return map to string included by
create a string representation of the included by relationships in this
private void read object object input stream in throws ioexception class not found exception object input stream get field fields in read fields linked by to sorted map fields get linked by null links to to sorted map fields get links to null included by to sorted map fields get included by null includes to sorted map fields get includes null
implemented to handle old serialized dependencies that contain hash maps
private element outlink image element el null if m use outlink image if m outlink image url null m outlink image url outlink image el new element img set attribute class outlink el set attribute src m outlink image url el set attribute alt return el
returns an element for the external link image out
private element make direct urilink string url element result string last null if url ends with url ends with last url substring url length 1 url url substring 0 url length 1 call mutator chain m external link mutator chain url if is image link url result handle image link string utils replace url amp url false else result make link external string utils replace url amp url null add element outlink image if last null m plain text buf append last return result
takes an url and turns it into a regular wiki link
private void disable output escaping add element new processing instruction result pi disable output escaping
emits a processing instruction that will disable markup escaping
private void push back string s throws ioexception for int i s length 1 i 0 i push back s char at i
pushes back any string that has been read
private string buffer read until eol throws ioexception int ch string buffer buf new string buffer 256 while true ch next token if ch 1 break buf append char ch if ch n break return buf
reads the stream until the next eol or eof
private void start block level these may not continue over block level limits in xhtml pop element i pop element b pop element tt if m is open paragraph m is open paragraph false pop element p m plain text buf append n just small beautification m restartitalic m isitalic m restartbold m isbold m isitalic false m isbold false
starts a block level element therefore closing a potential open paragraph
public yamtarget get target return lexer get target
the plugins will want to know what the output target language is
public int get line return lexer get line
what line number in the file are we at
public int get column return lexer get column
what column number in the file are we at
public class get plugin string name system out println get variable plugins name vector plugins vector get variable plugins for int i 0 i plugins size i string pkg string plugins element at i string class name pkg name if user classes contains key name class name string user classes get name try class c class for name class name plugin cache put name c return c catch class not found exception cnf system err println unknown plugin name ignoring system err println unknown plugin name ignoring return null
get from cache or using predefined variable plugins
protected string extract last command string text return null
subclasses should implement this i
private element handle tilde throws ioexception int ch next token if ch return m current element if ch ch ch ch ch ch ch ch ch ch ch ch ch ch m plain text buf append char ch m plain text buf append read while char ch return m current element no escape push back ch return null
generic escape of next character or entity
public void wikilink string url string title if title null title url title angle brackets escape title write a href url title wiki link a
wikilinks should be implemented here
protected void reset contents file contents null file contents new string buffer heading count null heading count new int heading depth table of contents null table of contents new string buffer h2 contents h2 n end of reset contents
this function needs to be here
private string trim string t if t null return t substring 1 t length 1 return null
remove the x and x etc
private string trim2 string t if t null return t substring 2 t length 2 return null
remove the x from front back
public void set root string root this root root set root
the root url of the repository
public string get root return root get root
the root url of the repository
public void set working dir file working dir this working dir working dir set working dir
the working directory for repository actions
public boolean checkout string file name if debug out prln root root out prln working dir working dir string com build command array file name co null return run command com checkout
check out a file directory or module
public boolean delete string file name remove the file if it exists file file to delete new file working dir file name if file to delete exists file to delete delete string com build command array file name delete null return run command com delete
delete from the repository
public boolean add string file name string com build command array file name add null return run command com add
add to the repository
public string diff string file name string com build command array file name diff null if run command com true return null return get command stdout diff
get the difference with the repository version
public string get command stdout return stdout output get command stdout
get a string containing the stdout from the command execution
public string get command stderr return stderr output get command stderr
get a string containing the stderr from the command execution
protected boolean run command string command return run command command false run command
run a command wait for termination and report status
protected list get pre command list pre command new array list pre command add d pre command add root return pre command get pre command
get the pre subcommand elements of the command e
protected list get pre command list pre command new array list return pre command get pre command
get the pre subcommand elements of the command e
protected list get post command string file name boolean no root list post command new array list if file name null post command add file name return post command get post command
get the post subcommand elements of the command e
protected list get post command string file name boolean no root list post command new array list if no root if file name null post command add file name else if file name null post command add root file name else post command add root return post command get post command
get the post subcommand elements of the command e
public void set root string root this root root replace all set root
the root url of the repository
public boolean is modified string file name string status string status file name if status string index of status locally modified 0 if status string contains status locally modified return true else return false is modified
use the repositorys status command to figure out if the file has been
public boolean is out of date string file name string status string status file name if status string index of status needs patch 0 status string index of status needs merge 0 if status string contains status needs patch status string contains status needs merge return true else return false is out of date
use the repositorys status command to figure out if the file is
public boolean is unknown string file name string status string status file name if status string index of status unknown 0 if status string contains status unknown return true else return false is unknown
use the repositorys status command to figure out if the file is
public boolean delete string file name string com build command array file name delete null true return run command com delete
delete from the repository
public void test import2 throws exception test import
check that test import can run twice on the same test fixture
public boolean add string file name string com build command array file name add null true return run command com add
add to the repository
public string diff string file name string com build command array file name diff null true if run command com true return null return get command stdout diff
get the difference with the repository version