コード例 #1
0
ファイル: Predicate.java プロジェクト: srnsw/xena
  /**
   * Returns the step in an expression of the form 'step = value'. Null is returned if the
   * expression is not of the right form. Optimization if off if null is returned.
   */
  public Step getStep() {
    // Returned cached value if called more than once
    if (_step != null) {
      return _step;
    }

    // Nothing to do if _exp is null
    if (_exp == null) {
      return null;
    }

    // Ignore if not equality expression
    if (_exp instanceof EqualityExpr) {
      EqualityExpr exp = (EqualityExpr) _exp;
      Expression left = exp.getLeft();
      Expression right = exp.getRight();

      // Unwrap and set _step if appropriate
      if (left instanceof CastExpr) {
        left = ((CastExpr) left).getExpr();
      }
      if (left instanceof Step) {
        _step = (Step) left;
      }

      // Unwrap and set _step if appropriate
      if (right instanceof CastExpr) {
        right = ((CastExpr) right).getExpr();
      }
      if (right instanceof Step) {
        _step = (Step) right;
      }
    }
    return _step;
  }
コード例 #2
0
ファイル: Predicate.java プロジェクト: srnsw/xena
  /**
   * Returns the value in an expression of the form 'step = value'. A value may be either a literal
   * string or a variable whose type is string. Optimization if off if null is returned.
   */
  public Expression getCompareValue() {
    // Returned cached value if called more than once
    if (_value != null) {
      return _value;
    }

    // Nothing to to do if _exp is null
    if (_exp == null) {
      return null;
    }

    // Ignore if not an equality expression
    if (_exp instanceof EqualityExpr) {
      EqualityExpr exp = (EqualityExpr) _exp;
      Expression left = exp.getLeft();
      Expression right = exp.getRight();

      // Return if left is literal string
      if (left instanceof LiteralExpr) {
        _value = left;
        return _value;
      }
      // Return if left is a variable reference of type string
      if (left instanceof VariableRefBase && left.getType() == Type.String) {
        _value = left;
        return _value;
      }

      // Return if right is literal string
      if (right instanceof LiteralExpr) {
        _value = right;
        return _value;
      }
      // Return if left is a variable reference whose type is string
      if (right instanceof VariableRefBase && right.getType() == Type.String) {
        _value = right;
        return _value;
      }
    }
    return null;
  }
コード例 #3
0
ファイル: NEExpr.java プロジェクト: Bludge0n/AREsoft
 public void flushCache() {
   super.flushCache();
 }