コード例 #1
0
ファイル: JoinHashMap.java プロジェクト: rmetzger/flink
 @SuppressWarnings("unchecked")
 public BT lookupMatch(PT record) {
   int hashCode = hash(probeComparator.hash(record));
   int index = hashIndex(hashCode, data.length);
   pairComparator.setReference(record);
   HashEntry entry = data[index];
   while (entry != null) {
     if (entryHashCode(entry) == hashCode
         && pairComparator.equalToReference((BT) entry.getValue())) {
       return (BT) entry.getValue();
     }
     entry = entryNext(entry);
   }
   return null;
 }
コード例 #2
0
ファイル: JoinHashMap.java プロジェクト: rmetzger/flink
  @SuppressWarnings("unchecked")
  public void insertOrReplace(BT record) {
    int hashCode = hash(buildComparator.hash(record));
    int index = hashIndex(hashCode, data.length);
    buildComparator.setReference(record);
    HashEntry entry = data[index];
    while (entry != null) {
      if (entryHashCode(entry) == hashCode
          && buildComparator.equalToReference((BT) entry.getValue())) {
        entry.setValue(record);
        return;
      }
      entry = entryNext(entry);
    }

    addMapping(index, hashCode, null, record);
  }