예제 #1
0
  /**
   * End leaf
   *
   * @param descr
   * @return
   * @throws UnknownDescriptionException
   */
  private VerifierFromDescr visitFromDescr(FromDescr descr) throws UnknownDescriptionException {
    VerifierFromDescr from = new VerifierFromDescr(pattern);

    VerifierComponent ds = visit(descr.getDataSource());

    from.setDataSourcePath(ds.getPath());
    from.setDataSourceType(ds.getVerifierComponentType());
    from.setParentPath(rule.getPath());
    from.setParentType(rule.getVerifierComponentType());

    data.add(from);

    return from;
  }
예제 #2
0
  private Pattern visitPatternDescr(PatternDescr descr, VerifierComponent parent, int orderNumber)
      throws UnknownDescriptionException {

    objectType = data.getObjectTypeByFullName(descr.getObjectType());

    if (objectType == null) {
      Import objectImport = data.getImportByName(descr.getObjectType());

      if (objectImport != null) {
        objectType = ObjectTypeFactory.createObjectType(objectImport);
      } else {
        objectType = ObjectTypeFactory.createObjectType(descr.getObjectType());
      }

      data.add(objectType);
    }

    pattern = new Pattern(rule);
    if (parent != null) {
      pattern.setParentPath(parent.getPath());
      pattern.setParentType(parent.getVerifierComponentType());
    }
    pattern.setObjectTypePath(objectType.getPath());
    pattern.setName(objectType.getName());
    pattern.setPatternNot(solvers.getRuleSolver().isChildNot());
    pattern.setPatternExists(solvers.getRuleSolver().isExists());
    pattern.setPatternForall(solvers.getRuleSolver().isForall());
    pattern.setOrderNumber(orderNumber);

    if (descr.getIdentifier() != null) {
      Variable variable = new Variable(rule);
      variable.setName(descr.getIdentifier());

      variable.setObjectTypeType(VerifierComponentType.OBJECT_TYPE.getType());
      variable.setObjectTypePath(objectType.getPath());
      variable.setObjectTypeType(descr.getObjectType());

      data.add(variable);
    }

    // visit source.
    if (descr.getSource() != null) {
      visit(descr.getSource());
    } else {
      if (workingMemory == null) {
        workingMemory = new WorkingMemory();
        data.add(workingMemory);
      }
      pattern.setSourcePath(workingMemory.getPath());
      pattern.setSourceType(workingMemory.getVerifierComponentType());
    }

    solvers.startPatternSolver(pattern);

    visit(descr.getConstraint());

    solvers.endPatternSolver();

    data.add(pattern);

    return pattern;
  }