Package ai.domain

Examples of ai.domain.Variable


    Map<Variable, DI> result = new HashMap<Variable, DI>();
    // Map<Variable, DI> result = new HashMap<Variable, DI>();
    while (itemDescription.length() > 0) {
      Pair<Pair<String, DI>, String> res = getNextValue(itemDescription);
      String variableName = res.left.left;
      Variable var = match.getVariable(variableName);
      if (var == null)
        throw new RuntimeException("Unknown variable '" + variableName + "'");
      if (result.containsKey(var))
        throw new CommentParserException("Duplicate variable '%s'", variableName);
      DI value = res.left.right;
View Full Code Here


 
  public void compare(Map<Variable, DI> expected, NonRelationalDomain<DI> actual,
      String commentVertice) {
    // verify variable set
    for (Map.Entry<Variable, DI> entry : expected.entrySet()) {
      Variable var = entry.getKey();
      DI value = entry.getValue();
      org.junit.Assert.assertTrue(getMissingVariableMessage(commentVertice, var), actual.containsValue(var));
      DI analysisValue = actual.getValueFor(var);
      String message = String.format("Node: '%s', var: '%s'", commentVertice, var);
      org.junit.Assert.assertEquals(message, value, analysisValue);
View Full Code Here

      ai.cfg.edges.EmptyEdge e = (EmptyEdge) cfgEdge.edge;
      org.junit.Assert.assertEquals("EDGE: "+this+":Different variables to remove: expected: " + variablesToRemove + ", was:"+e.variablesToRemove,
          variablesToRemove.length, e.variablesToRemove.size());
      int i=0;
      for(SimpleName var: e.variablesToRemove){
        Variable result = EvaluationUtils.tryGetVariable(var);
        if (result == null)
          throw new RuntimeException("Variable??");
        String varId = variables.inverse().get(result);
        org.junit.Assert.assertEquals(variablesToRemove[i].trim(), varId);
        i++;
View Full Code Here

      Expression initialiserExpr = var.initializerOrNull;
      org.junit.Assert.assertEquals(message, initialiser, initialiserExpr != null ? initialiserExpr.toString()
          : "");
      if (!variable.equals(var.name.toString()))
        throw new RuntimeException("Not a proper variable!!: '" + var + "'" + " should be "+variable);
      Variable result = EvaluationUtils.tryGetVariable(var.name);
      if (result == null)
        throw new RuntimeException("Not a proper variable!!: '" + var + "'");
     
      variables.put(id, result);
    }
View Full Code Here

        org.junit.Assert.assertEquals(message, excEdge.exceptionOrNull.getType().toString(), excType);
        if  (variable==null) {
          org.junit.Assert.assertTrue(message, excEdge.exceptionOrNull.getName() == null);
        } else {
          org.junit.Assert.assertEquals(message, excEdge.exceptionOrNull.getName().toString(), variable);
          Variable result = EvaluationUtils.tryGetVariable(excEdge.exceptionOrNull.getName());
          if (result == null)
            throw new RuntimeException("Not a proper variable!!: '" + excEdge.exceptionOrNull + "'");
          variables.put(id == null ? variable : id, result);
        }
      }
View Full Code Here

    public MatchResult compare() {
      //map argument variables
      for(Object param: cfg.getCodeFragment().parameters()){
        SingleVariableDeclaration var = (SingleVariableDeclaration) param;
        SimpleName name = var.getName();
        Variable result = EvaluationUtils.tryGetVariable(name);
        if (result == null)
          throw new RuntimeException("Not a proper variable!!: '" + var + "'");
        variablesMap.put(name.toString(), result);
      }
      MatchResult result = compare(commentCfg.graph.getInput(), cfg.getInput().singleEdges[0]);
      org.junit.Assert.assertTrue("Invalid number of vertices", result.getVerticesCount() <= cfg.size());
      return result;
    }
View Full Code Here

  public DI evaluate(SimpleName name, Expression initializerOrNull, DI input,
      boolean asAssignment) {
    if (!isInterestingType(name))
      return null;
    Pair<Bool, DI> initializer = computeInitialValue(initializerOrNull, input);
    Variable variable = EvaluationUtils.tryGetVariable(name);
    if (variable == null)
      throw new DomainException("Error: '%s'", variable);
    if (asAssignment && initializerOrNull != null)
      return expressionSemantics.processBooleanAssignment(initializer.right, name, initializer.left);
    else
View Full Code Here

  @Override
  public DI evaluateNewArgument(SimpleName argument, DI input) {
    if (!isInterestingType(argument))
      return null;
    Variable variable = EvaluationUtils.tryGetVariable(argument);
    if (variable == null)
      throw new DomainException("Error: '%s'", variable);
    return processNewVariable(input, variable, null, true);
  }
View Full Code Here

    public Variables getBottom() {
      throw new VerifierException("Not handled");
    }
   
    private Variable getVar(SimpleName name){
      Variable var = EvaluationUtils.tryGetVariable(name);     
      if (var == null)
        throw new VerifierException("null variable");
      return var;
    }
View Full Code Here

        throw new VerifierException("null variable");
      return var;
    }
   
    private Variables addVariable(SimpleName name, boolean asAssignment) {
      Variable var = getVar(name);
      if (asAssignment) {
        if (!vars.contains(var))
          throw new VerifierException("missing variable");
        return this;
      }
View Full Code Here

TOP

Related Classes of ai.domain.Variable

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.