Ejemplo n.º 1
0
  @Override
  public boolean eval(Row row) {
    for (HavingSpec havingSpec : havingSpecs) {
      if (!havingSpec.eval(row)) {
        return false;
      }
    }

    return true;
  }
Ejemplo n.º 2
0
  @Override
  public byte[] getCacheKey() {
    final byte[][] havingBytes = new byte[havingSpecs.size()][];
    int havingBytesSize = 0;
    int index = 0;
    for (HavingSpec havingSpec : havingSpecs) {
      havingBytes[index] = havingSpec.getCacheKey();
      havingBytesSize += havingBytes[index].length;
      ++index;
    }

    ByteBuffer buffer = ByteBuffer.allocate(1 + havingBytesSize).put(CACHE_KEY);
    for (byte[] havingByte : havingBytes) {
      buffer.put(havingByte);
    }
    return buffer.array();
  }