|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.problets.domain.template.TemplateParser
public class TemplateParser
Provides static methods to parse a template
Field Summary | |
---|---|
static java.lang.String |
CODE_DELIMITER
|
Constructor Summary | |
---|---|
TemplateParser()
|
Method Summary | |
---|---|
static java.lang.String |
extractCondition(java.lang.String template)
public string extractCondition(String template); Generate the condition of the switch statement |
static java.lang.String |
extractScopeTemplate(java.lang.String template)
public string extractScopeTemplate(String template); Generate the scope template of this control object |
static int |
getIndexOfBalancingChar(java.lang.String template,
int index)
Get the index of the balancing closingChar corresponding to the openingChar |
static int |
getIndexOfBalancingChar(java.lang.String template,
int index,
boolean handleHash)
|
static java.lang.String |
getNextActualToken(java.lang.String template,
int index)
The old version of getNextToken() worked as follows: Case 1: If the template started with <, it returned up to the matching > Case 2: If the template did not start with <, it returned up to the next < The problem was that in case 1, it returned '< |
static java.lang.String |
getNextStatement(java.lang.String masterTemplate,
int start)
Method to extract the next statement - returns the String corresponding to all characters up to and including the next semi-colon that is not part of a constraint. |
static java.lang.String |
getNextToken(java.lang.String template)
|
static java.lang.String |
getNextToken(java.lang.String template,
int index)
|
static int |
getOrdinality(java.lang.String token)
|
static int |
getScopeExtent(java.lang.String masterTemplate,
char[] scopeTemplate,
int index)
// Method to extract a complete scope template OR a call to a scope object // from the masterTemplate // Returns the index past the scopeTemplate in the masterTemplate // Start from |
static void |
main(java.lang.String[] args)
|
static java.util.Vector |
parseTemplate(java.lang.String templateString)
Converts the string template into a vector of statement strings, the statements being {, }, declaration, print, delete, while, iwhile, dowhile, idowhile, for, ifor, if, if-else, assignment and introduces filler statements <...> |
static java.lang.String[] |
split(java.lang.String template)
Returns an array of tokens in the template. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String CODE_DELIMITER
Constructor Detail |
---|
public TemplateParser()
Method Detail |
---|
public static int getOrdinality(java.lang.String token)
public static java.lang.String getNextToken(java.lang.String template)
public static java.lang.String getNextToken(java.lang.String template, int index)
public static java.lang.String getNextActualToken(java.lang.String template, int index)
public static java.lang.String[] split(java.lang.String template)
public static java.lang.String getNextStatement(java.lang.String masterTemplate, int start)
public static int getIndexOfBalancingChar(java.lang.String template, int index)
public static int getIndexOfBalancingChar(java.lang.String template, int index, boolean handleHash)
public static java.util.Vector parseTemplate(java.lang.String templateString)
public static int getScopeExtent(java.lang.String masterTemplate, char[] scopeTemplate, int index)
public static java.lang.String extractCondition(java.lang.String template)
template
- - the template currently in use
public static java.lang.String extractScopeTemplate(java.lang.String template)
template
- - the template currently in use
public static void main(java.lang.String[] args)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |