private static void assertEqualsInternal(
     String msg, StringBuilder expected, CharBlockArray actual) {
   assertEquals(msg, expected.length(), actual.length());
   for (int i = 0; i < expected.length(); i++) {
     assertEquals(msg, expected.charAt(i), actual.charAt(i));
   }
 }
Exemple #2
0
  public int addLabel(CategoryPath label, int hash, int cid) {
    int bucketIndex = indexFor(hash, this.capacity);
    for (Entry e = this.entries[bucketIndex]; e != null; e = e.next) {
      if (e.hash == hash
          && CategoryPathUtils.equalsToSerialized(label, labelRepository, e.offset)) {
        return e.cid;
      }
    }

    // new string; add to label repository
    int offset = labelRepository.length();
    CategoryPathUtils.serialize(label, labelRepository);
    addEntry(offset, cid, hash, bucketIndex);
    return cid;
  }