Пример #1
0
  /**
   * End
   *
   * @param descr
   */
  private void visitBindingDescr(BindingDescr descr) {

    Variable variable = new Variable(rule);
    variable.setName(descr.getVariable());
    variable.setOrderNumber(orderNumber.next());
    variable.setParentPath(rule.getPath());
    variable.setParentType(rule.getVerifierComponentType());

    variable.setObjectTypeType(VerifierComponentType.FIELD.getType());

    data.add(variable);
  }
Пример #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;
  }