Package org.antlr.runtime.tree

Examples of org.antlr.runtime.tree.Tree.toStringTree()


    String ruleAccumulationMethodType = "SUM";

    // Explore each sibling in this level
    for( int childNum = 1; childNum < tree.getChildCount(); childNum++ ) {
      Tree child = tree.getChild(childNum);
      if( debug ) Gpr.debug("Parsing: " + child.toStringTree());
      String leaveName = child.getText();

      if( leaveName.equalsIgnoreCase("AND") ) {
        //---
        // Which 'AND' method to use? (Note: We also set 'OR' method accordingly to fulfill DeMorgan's law
View Full Code Here


    if( debug ) Gpr.debug("Tree: " + tree.toStringTree());
    Rule fuzzyRule = new Rule(tree.getChild(0).getText(), this);

    for( int childNum = 1; childNum < tree.getChildCount(); childNum++ ) {
      Tree child = tree.getChild(childNum);
      if( debug ) Gpr.debug("\t\tChild: " + child.toStringTree());
      String type = child.getText();

      if( type.equalsIgnoreCase("IF") ) fuzzyRule.setAntecedents(fclTreeRuleBlockRuleIf(child.getChild(0), and, or));
      else if( type.equalsIgnoreCase("THEN") ) fclTreeRuleBlockRuleThen(child, fuzzyRule);
      else if( type.equalsIgnoreCase("WITH") ) fclTreeRuleBlockRuleWith(child, fuzzyRule);
View Full Code Here

  private void fclTreeRuleBlockRuleThen(Tree tree, Rule fuzzyRule) {
    if( debug ) Gpr.debug("Tree: " + tree.toStringTree());

    for( int childNum = 0; childNum < tree.getChildCount(); childNum++ ) {
      Tree child = tree.getChild(childNum);
      if( debug ) Gpr.debug("\t\tChild: " + child.toStringTree());
      String thenVariable = child.getText();

      String thenValue = child.getChild(0).getText();
      Variable variable = getVariable(thenVariable);
      if( variable == null ) throw new RuntimeException("Variable " + thenVariable + " does not exist");
View Full Code Here

    int ruleBlockCount = 1;

    // Add every child
    for( int childNum = 0; childNum < tree.getChildCount(); childNum++ ) {
      Tree child = tree.getChild(childNum);
      if( debug ) Gpr.debug("\t\tChild: " + child.toStringTree());
      String leaveName = child.getText();

      if( firstChild ) name = leaveName;
      else if( leaveName.equalsIgnoreCase("VAR_INPUT") ) fclTreeVariables(child);
      else if( leaveName.equalsIgnoreCase("VAR_OUTPUT") ) fclTreeVariables(child);
View Full Code Here

        if( rbname.equals("") ) rbname = "RuleBlock_" + ruleBlockCount; // Create name if none is given
        ruleBlockCount++;

        // Add RuleBlock
        ruleBlocks.put(rbname, ruleBlock);
      } else throw new RuntimeException("Unknown item '" + leaveName + "':\t" + child.toStringTree());

      firstChild = false;
    }

    return name;
View Full Code Here

    // Explore each sibling in this level
    //---
    for( int childNum = 1; childNum < tree.getChildCount(); childNum++ ) {
      child = tree.getChild(childNum);
      String leaveName = child.getText();
      if( debug ) Gpr.debug("\t\tChild: " + child.toStringTree());

      if( leaveName.equalsIgnoreCase("TERM") ) {
        // Linguistic term
        LinguisticTerm linguisticTerm = fclTreeFuzzifyTerm(child, variable);
        variable.add(linguisticTerm);
View Full Code Here

        System.in ) ) );
    CommonTokenStream tokenStream = new CommonTokenStream( lexer );
    SparqlOwlParser parser = new SparqlOwlParser( tokenStream );
    SparqlOwlParser.query_return result = parser.query();
    Tree t = (Tree) result.getTree();
    System.out.println( t.toStringTree() );
  }
}
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.