Ejemplo n.º 1
0
  static ValueExpression restore(Object value, Class type, FacesContext context) {
    if (value == null) return null;

    String expr = (String) value;

    Application app = context.getApplication();
    ExpressionFactory factory = app.getExpressionFactory();

    return factory.createValueExpression(context.getELContext(), expr, type);
  }
Ejemplo n.º 2
0
  static ValueExpression restoreWithType(Object value, FacesContext context) {
    if (value == null) return null;

    Object[] state = (Object[]) value;

    String expr = (String) state[0];
    Class type = (Class) state[1];

    Application app = context.getApplication();
    ExpressionFactory factory = app.getExpressionFactory();

    return factory.createValueExpression(context.getELContext(), expr, type);
  }
Ejemplo n.º 3
0
 private RTLExpression addClause(RTLExpression formula, RTLExpression clause) {
   if (formula != null) {
     return ExpressionFactory.createAnd(formula, clause);
   } else {
     return clause;
   }
 }
Ejemplo n.º 4
0
  protected void parseParamStrings(String paramString, ExpressionFactory expressionFactory) {
    List paramStrings = Util.tokenizeIgnoringEnclosers(paramString, ',');
    for (Iterator itr = paramStrings.iterator(); itr.hasNext(); ) {
      String nextParam = ((String) itr.next()).trim();
      if (!(nextParam.equals(""))) {
        Debug.logn("Find match for param " + nextParam, this);
        if (CallExpression.isVariable(this.context, nextParam)) {
          DNVariable v = CallExpression.getVariable(this.context, nextParam);
          parameters.add(v);
        } else if (expressionFactory.getExpression(nextParam, this.context) != null) {

          parameters.add(expressionFactory.getExpression(nextParam, this.context));
        }
      }
    }
  }
Ejemplo n.º 5
0
  public RTLExpression getStateFormula(ValuationState state) {
    RTLExpression result = null;

    for (Iterator<Map.Entry<RTLVariable, AbstractDomainElement>> entryIt = state.variableIterator();
        entryIt.hasNext(); ) {
      Map.Entry<RTLVariable, AbstractDomainElement> entry = entryIt.next();
      RTLVariable var = entry.getKey();
      IntervalElement interval = (IntervalElement) entry.getValue();

      if (interval.size() == 1) {
        result =
            addClause(
                result,
                ExpressionFactory.createEqual(
                    var, ExpressionFactory.createNumber(interval.getLeft(), var.getBitWidth())));
      } else {
        if (!interval.leftOpen()) {
          result =
              addClause(
                  result,
                  ExpressionFactory.createLessOrEqual(
                      ExpressionFactory.createNumber(interval.getLeft(), var.getBitWidth()), var));
        }

        if (!interval.rightOpen()) {
          result =
              addClause(
                  result,
                  ExpressionFactory.createLessOrEqual(
                      var, ExpressionFactory.createNumber(interval.getRight(), var.getBitWidth())));
        }
      }
    }

    if (result == null) {
      result = ExpressionFactory.TRUE;
    }

    return result;
  }