Package org.drools.verifier.components

Examples of org.drools.verifier.components.Variable


        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.
View Full Code Here


     *
     * @param descr
     */
    private void visitFieldBindingDescr(FieldBindingDescr descr) {

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

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

        data.add( variable );
    }
View Full Code Here

            if ( rule.getMetadata().containsKey( "category" ) ) {
                rulesByCategory.put( rule.getMetadata().get( "category" ),
                                     rule );
            }
        } else if ( VerifierComponentType.VARIABLE.equals( object.getVerifierComponentType() ) ) {
            Variable variable = (Variable) object;
            variablesByRuleAndVariableName.put( variable.getRuleName() + "." + variable.getName(),
                                                variable );
        } else if ( VerifierComponentType.PATTERN.equals( object.getVerifierComponentType() ) ) {
            Pattern pattern = (Pattern) object;

            patternsByObjectTypeId.put( pattern.getObjectTypePath(),
View Full Code Here

    data.add(pattern);
    currentPattern = pattern;

    if (descr.getIdentifier() != null) {
      Variable variable = new Variable();
      variable.setRuleId(currentRule.getId());
      variable.setRuleName(currentRule.getRuleName());
      variable.setName(descr.getIdentifier());

      variable.setObjectType(VerifierComponentType.CLASS);
      variable.setObjectId(objectType.getId());
      variable.setObjectName(descr.getObjectType());

      data.add(variable);
    }

    // flatten source.
View Full Code Here

   * @param descr
   */
  private void flatten(FieldBindingDescr descr, VerifierComponent parent,
      int orderNumber) {

    Variable variable = new Variable();
    variable.setRuleId(currentRule.getId());
    variable.setRuleName(currentRule.getRuleName());
    variable.setName(descr.getIdentifier());
    variable.setOrderNumber(orderNumber);
    variable.setParent(parent);

    variable.setObjectType(VerifierComponentType.FIELD);

    data.add(variable);
  }
View Full Code Here

   * @param descr
   */
  private void flatten(VariableRestrictionDescr descr,
      VerifierComponent parent, int orderNumber) {

    Variable variable = data.getVariableByRuleAndVariableName(currentRule
        .getRuleName(), descr.getIdentifier());
    VariableRestriction restriction = new VariableRestriction();

    restriction.setRuleId(currentRule.getId());
    restriction.setRuleName(currentRule.getRuleName());
View Full Code Here

    String text = descr.getText();

    String base = text.substring(0, text.indexOf("."));
    String fieldName = text.substring(text.indexOf("."));

    Variable variable = data.getVariableByRuleAndVariableName(currentRule
        .getRuleName(), base);

    if (variable != null) {

      QualifiedIdentifierRestriction restriction = new QualifiedIdentifierRestriction();

      restriction.setRuleId(currentRule.getId());
      restriction.setPatternId(currentPattern.getId());
      restriction.setPatternIsNot(currentPattern.isPatternNot());
      restriction.setConstraintId(currentConstraint.getId());
      restriction.setFieldId(currentConstraint.getFieldId());
      restriction.setOperator(Operator.determineOperator(descr
          .getEvaluator(), descr.isNegated()));
      restriction.setVariableId(variable.getId());
      restriction.setVariableName(base);
      restriction.setVariablePath(fieldName);
      restriction.setOrderNumber(orderNumber);
      restriction.setParent(parent);

      // Set field value, if it is not set.
      currentField.setFieldType(Field.FieldType.VARIABLE);

      variable.setObjectType(VerifierComponentType.FIELD);

      data.add(restriction);
      solvers.addRestriction(restriction);
    } else {
View Full Code Here

        String base = text.substring(0,
                text.indexOf("."));
        String fieldName = text.substring(text.indexOf("."));

        Variable patternVariable = data.getVariableByRuleAndVariableName(pattern.getRuleName(),
                base);

        if (patternVariable != null) {

            QualifiedIdentifierRestriction restriction = new QualifiedIdentifierRestriction(pattern);

            restriction.setPatternIsNot(pattern.isPatternNot());
            restriction.setFieldPath(field.getPath());
            restriction.setOperator(Operator.determineOperator(descr.getEvaluator(),
                    descr.isNegated()));
            restriction.setVariablePath(patternVariable.getPath());
            restriction.setVariableName(base);
            restriction.setVariablePath(fieldName);
            restriction.setOrderNumber(orderNumber);
            restriction.setParentPath(pattern.getPath());
            restriction.setParentType(pattern.getVerifierComponentType());
View Full Code Here

    private boolean firstAndLastCharacterIs(String expression, char character) {
        return expression.charAt(0) == character && expression.charAt(expression.length() - 1) == character;
    }

    private void createVariableRestriction(int orderNumber, String value, Operator operator) {
        Variable variable = data.getVariableByRuleAndVariableName(pattern.getRuleName(), value);
        VariableRestriction restriction = new VariableRestriction(pattern);

        restriction.setPatternIsNot(pattern.isPatternNot());
        restriction.setFieldPath(field.getPath());
        restriction.setOperator(operator);
View Full Code Here

                                                     0 ) );
        saveVerifierComponentAndGet( new ReturnValueFieldDescr( pattern ) );
        saveVerifierComponentAndGet( new SubRule( rule,
                                                  0 ) );
        saveVerifierComponentAndGet( new TextConsequence( rule ) );
        saveVerifierComponentAndGet( new Variable( rule ) );
        saveVerifierComponentAndGet( new VerifierAccessorDescr( rule ) );
        saveVerifierComponentAndGet( new VerifierAccumulateDescr( pattern ) );
        saveVerifierComponentAndGet( new VerifierCollectDescr( pattern ) );
        saveVerifierComponentAndGet( new RuleEval( rule ) );
        saveVerifierComponentAndGet( new VerifierFieldAccessDescr( rule ) );
View Full Code Here

TOP

Related Classes of org.drools.verifier.components.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.