コード例 #1
0
 public EqualsPredicateEvaluator(EqPredicate predicate, Dictionary dictionary) {
   this.predicate = predicate;
   equalsMatchDictId = dictionary.indexOf(predicate.getEqualsValue());
   if (equalsMatchDictId >= 0) {
     matchingIds = new int[1];
     matchingIds[0] = equalsMatchDictId;
   } else {
     matchingIds = new int[0];
   }
 }
コード例 #2
0
  public RangePredicateFilter(Dictionary dictionaryReader, List<String> predicateValue) {
    _dictionary = dictionaryReader;
    String[] values = predicateValue.get(0).split(SEPARATOR);
    final String rangeString = predicateValue.get(0).trim();

    // Trim the enclosing '[' and ']' as well.
    String start = values[0].substring(1, values[0].length());
    String end = values[1].substring(0, values[1].length() - 1);

    _includeStart = !rangeString.trim().startsWith("(") || start.equals("*");
    _includeEnd = !rangeString.trim().endsWith(")") || end.equals("*");

    if (start.equals("*")) {
      _startIndex = 0;
    } else {
      _startIndex = _dictionary.indexOf(start);
    }
    if (_startIndex < 0) {
      _startIndex = -(_startIndex + 1);
    }
    if (!_includeStart) {
      _startIndex++;
    }

    if (end.equals("*")) {
      _endIndex = _dictionary.length() - 1;
    } else {
      _endIndex = _dictionary.indexOf(end);
    }
    if (_endIndex < 0) {
      _endIndex = -(_endIndex + 1);
    }
    if (!_includeEnd) {
      --_endIndex;
    }
  }