Package lupos.rif.model

Examples of lupos.rif.model.Rule


      }
    return ruleList;
  }

  public Object visit(final RIFRule n, final IRuleNode argu) {
    final Rule rule = new Rule();
    rule.setParent(argu);
    RIFClause clause = null;
    // Wenn Variablen vorhanden
    if (n.f0.which == 0) {
      final List<INode> seq = (List<INode>) n.f0.choice.accept(this, rule);
      for (final INode node : ((List<INode>) seq.get(1).accept(this, rule)))
        rule.addVariable((RuleVariable) node.accept(this, rule));
      clause = (RIFClause) seq.get(3);
    } else
      clause = (RIFClause) n.f0.choice;
    clause.accept(this, rule);
    return rule;
View Full Code Here


    clause.accept(this, rule);
    return rule;
  }

  public Object visit(final RIFClause n, final IRuleNode argu) {
    final Rule parent = (Rule) argu;
    // nur eine Aussage
    if (n.f0.which == 0)
      parent.setHead((IExpression) n.f0.choice.accept(this, argu));
    else {
      // And-verknuepfte Aussagen   
      final Conjunction conj = new Conjunction();
      conj.setParent(parent);
      for (final INode node : (List<INode>) ((List<INode>) n.f0.choice.accept(this, argu)).get(2).accept(this, argu))
        conj.addExpr((IExpression) node.accept(this, argu));
      if (!conj.isEmpty())
        parent.setHead(conj);
    }
    if (n.f1.present()){
      List<INode> bodyList = (List<INode>) n.f1.node.accept(this, argu);
      parent.setBody((IExpression) bodyList.get(1).accept(this, argu));
      for (final INode node : (List<INode>)(bodyList.get(2).accept(this, argu))){
        parent.addNot((IExpression)(((NodeSequence) node).nodes.get(1).accept(this, argu)));
      }
    }   
    return parent;
  }
View Full Code Here

TOP

Related Classes of lupos.rif.model.Rule

Copyright © 2018 www.massapicom. 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.