Beispiel #1
1
 public int hashCode() {
   // I just made this up. If two rules are equal they'll have the
   // same hashcode. Maybe someone else can do a better job though?
   int frHash = Arrays.hashCode(getFrench());
   int enHash = Arrays.hashCode(english);
   return frHash ^ enHash ^ getLHS();
 }
 @Override
 public int hashCode() {
   int hash = 5;
   hash = 47 * hash + Arrays.hashCode(this.alpha);
   hash = 47 * hash + Arrays.hashCode(this.beta);
   return hash;
 }
Beispiel #3
1
 @Override
 public int hashCode() {
   int result = super.hashCode();
   result = 31 * result + (context != null ? context.hashCode() : 0);
   result = 31 * result + (className != null ? className.hashCode() : 0);
   result = 31 * result + (superClass != null ? superClass.hashCode() : 0);
   result = 31 * result + (interfaces != null ? interfaces.hashCode() : 0);
   result = 31 * result + (scope != null ? scope.hashCode() : 0);
   result = 31 * result + (isArray ? 1 : 0);
   result = 31 * result + dimensions;
   result = 31 * result + (isInterface ? 1 : 0);
   result = 31 * result + (isAbstract ? 1 : 0);
   result = 31 * result + (isFinal ? 1 : 0);
   result = 31 * result + (isStatic ? 1 : 0);
   result = 31 * result + (isInner ? 1 : 0);
   result = 31 * result + (methods != null ? methods.hashCode() : 0);
   result = 31 * result + (fields != null ? fields.hashCode() : 0);
   result = 31 * result + (constructors != null ? constructors.hashCode() : 0);
   result = 31 * result + (typeVariables != null ? typeVariables.hashCode() : 0);
   result = 31 * result + (reifiedFormOf != null ? reifiedFormOf.hashCode() : 0);
   result = 31 * result + (_nameCache != null ? _nameCache.hashCode() : 0);
   result = 31 * result + (_methodsCache != null ? Arrays.hashCode(_methodsCache) : 0);
   result = 31 * result + (_fieldsCache != null ? Arrays.hashCode(_fieldsCache) : 0);
   result = 31 * result + (_constructorsCache != null ? Arrays.hashCode(_constructorsCache) : 0);
   result = 31 * result + (generatedCache != null ? generatedCache.hashCode() : 0);
   return result;
 }
Beispiel #4
1
  public static String printArray(byte[] array, boolean withHash) {
    if (array == null) return "null";

    int limit = 8;
    StringBuilder sb = new StringBuilder();
    sb.append("[B0x");
    if (array.length <= limit || IS_ARRAYS_DEBUG) {
      // Convert the entire byte array
      sb.append(toHexString(array));
      if (withHash) {
        sb.append(",h=");
        sb.append(Integer.toHexString(Arrays.hashCode(array)));
        sb.append(']');
      }
    } else {
      // Pick the first 8 characters and convert that part
      sb.append(toHexString(array, limit));
      sb.append("..[");
      sb.append(array.length);
      if (withHash) {
        sb.append("],h=");
        sb.append(Integer.toHexString(Arrays.hashCode(array)));
      }
      sb.append(']');
    }
    return sb.toString();
  }
  @Test
  public void test_2GB_over() throws IOException {
    Assume.assumeTrue(CC.FULL_TEST);

    byte[] data = new byte[51111];
    int dataHash = Arrays.hashCode(data);

    Set<Long> recids = new TreeSet<Long>();

    for (int i = 0; i < 1e5; i++) {
      long recid = engine.recordPut(data, Serializer.BYTE_ARRAY_SERIALIZER);
      recids.add(recid);

      //            if(i%10000==0){
      //            System.out.println(recid);
      //            for(Long l:recids){
      //                byte[] b = engine.recordGet(l, Serializer.BYTE_ARRAY_SERIALIZER);
      //                int hash = Arrays.hashCode(b);
      //                assertEquals(l,dataHash, hash);
      //            }
      //            }

    }

    engine.commit();

    for (Long l : recids) {
      byte[] b = engine.recordGet(l, Serializer.BYTE_ARRAY_SERIALIZER);
      int hash = Arrays.hashCode(b);
      assertEquals(dataHash, hash);
    }
  }
 public void ___testGetAllFontsNames() {
   NRC_HTMLDocumentByCobra doc = null;
   try {
     doc = new NRC_HTMLDocumentByCobra("http://localhost/tests/testfonts.html");
     String[] fontNames = doc.getAllFontsNames();
     doc.close();
     Arrays.sort(fontNames);
     String[] namesExpected =
         new String[] {
           "nunacom",
           "Verdana",
           "Arial",
           "Helvetica",
           "sans-serif",
           "Naamajut",
           "Times New Roman",
           "georgia",
           "PROSYL"
         };
     Arrays.sort(namesExpected);
     assertTrue(
         "Les noms des polices retournés pour testfonts.html ne sont pas corrects",
         Arrays.hashCode(fontNames) == Arrays.hashCode(namesExpected));
   } catch (Exception e) {
     e.printStackTrace();
     if (doc != null) doc.close();
     fail();
   }
 }
  public void testByteArrayHashCode() {
    // null arg has hashCode 0
    assertEquals(0, bigArrays.hashCode(null));

    // empty array should have equal hash
    final int emptyHash = Arrays.hashCode(BytesRef.EMPTY_BYTES);
    final ByteArray emptyByteArray = byteArrayWithBytes(BytesRef.EMPTY_BYTES);
    final int emptyByteArrayHash = bigArrays.hashCode(emptyByteArray);
    assertEquals(emptyHash, emptyByteArrayHash);
    emptyByteArray.close();

    // FUN FACT: Arrays.hashCode() and BytesReference.bytesHashCode() are inconsistent for empty
    // byte[]
    // final int emptyHash3 = new BytesArray(BytesRef.EMPTY_BYTES).hashCode();
    // assertEquals(emptyHash1, emptyHash3); -> fail (1 vs. 0)

    // large arrays should be different
    final byte[] array1 = new byte[randomIntBetween(1, 4000000)];
    getRandom().nextBytes(array1);
    final int array1Hash = Arrays.hashCode(array1);
    final ByteArray array2 = byteArrayWithBytes(array1);
    final int array2Hash = bigArrays.hashCode(array2);
    assertEquals(array1Hash, array2Hash);
    array2.close();
  }
 @Override
 public final int hashCode() {
   int result = super.hashCode();
   result = 31 * result + Arrays.hashCode(polyLons);
   result = 31 * result + Arrays.hashCode(polyLats);
   return result;
 }
 @Override
 public int hashCode() {
   int result = formatId;
   result = 31 * result + Arrays.hashCode(globalTransactionId);
   result = 31 * result + Arrays.hashCode(branchQualifier);
   return result;
 }
 @Override
 public int hashCode() {
   int hash = 7;
   hash = 67 * hash + (this.sortAscending != null ? Arrays.hashCode(this.sortAscending) : 0);
   hash = 67 * hash + (this.sortColumns != null ? Arrays.hashCode(this.sortColumns) : 0);
   return hash;
 }
  @Override
  public void setHashKey() {
    hashcode =
        Arrays.hashCode(longValues)
            ^ Arrays.hashCode(doubleValues)
            ^ Arrays.hashCode(decimalValues)
            ^ Arrays.hashCode(isNull);

    // This code, with branches and all, is not executed if there are no string keys
    for (int i = 0; i < byteValues.length; ++i) {
      /*
       *  Hashing the string is potentially expensive so is better to branch.
       *  Additionally not looking at values for nulls allows us not reset the values.
       */
      if (!isNull[longValues.length + doubleValues.length + i]) {
        byte[] bytes = byteValues[i];
        int start = byteStarts[i];
        int length = byteLengths[i];
        if (length == bytes.length && start == 0) {
          hashcode ^= Arrays.hashCode(bytes);
        } else {
          // Unfortunately there is no Arrays.hashCode(byte[], start, length)
          for (int j = start; j < start + length; ++j) {
            // use 461 as is a (sexy!) prime.
            hashcode ^= 461 * bytes[j];
          }
        }
      }
    }
  }
Beispiel #12
0
 @Override
 public int hashCode() {
   int result = id != null ? id.hashCode() : 0;
   result = 31 * result + (name != null ? name.hashCode() : 0);
   result = 31 * result + (url != null ? url.hashCode() : 0);
   result = 31 * result + (controllerUrl != null ? controllerUrl.hashCode() : 0);
   result = 31 * result + (controllerJson != null ? controllerJson.hashCode() : 0);
   result = 31 * result + (extractCmd != null ? extractCmd.hashCode() : 0);
   result = 31 * result + (offline ? 1 : 0);
   result =
       31 * result
           + (optionalDependencyPatterns != null
               ? Arrays.hashCode(optionalDependencyPatterns)
               : 0);
   result =
       31 * result
           + (excludeDependencyFilterPatterns != null
               ? Arrays.hashCode(excludeDependencyFilterPatterns)
               : 0);
   result = 31 * result + (mainClass != null ? mainClass.hashCode() : 0);
   result = 31 * result + (properties != null ? properties.hashCode() : 0);
   result = 31 * result + (environment != null ? environment.hashCode() : 0);
   result = 31 * result + (jvmOptions != null ? Arrays.hashCode(jvmOptions) : 0);
   result = 31 * result + (jarFiles != null ? jarFiles.hashCode() : 0);
   return result;
 }
Beispiel #13
0
 private static int computeHashCode(Key key) {
   return Arrays.hashCode(
       new Object[] {
         key.mX,
         key.mY,
         key.mWidth,
         key.mHeight,
         key.mCode,
         key.mLabel,
         key.mHintLabel,
         key.mIconId,
         key.mBackgroundType,
         Arrays.hashCode(key.mMoreKeys),
         key.mOutputText,
         key.mActionFlags,
         key.mLabelFlags,
         // Key can be distinguishable without the following members.
         // key.mAltCode,
         // key.mDisabledIconId,
         // key.mPreviewIconId,
         // key.mHorizontalGap,
         // key.mVerticalGap,
         // key.mVisualInsetLeft,
         // key.mVisualInsetRight,
         // key.mMaxMoreKeysColumn,
       });
 }
Beispiel #14
0
 @Override
 public int hashCode() {
   int result = keyStore != null ? keyStore.hashCode() : 0;
   result = 31 * result + (trustStore != null ? trustStore.hashCode() : 0);
   result = 31 * result + (trustStoreProvider != null ? trustStoreProvider.hashCode() : 0);
   result = 31 * result + (keyStoreProvider != null ? keyStoreProvider.hashCode() : 0);
   result = 31 * result + (trustStoreType != null ? trustStoreType.hashCode() : 0);
   result = 31 * result + (keyStoreType != null ? keyStoreType.hashCode() : 0);
   result = 31 * result + (trustStorePass != null ? Arrays.hashCode(trustStorePass) : 0);
   result = 31 * result + (keyStorePass != null ? Arrays.hashCode(keyStorePass) : 0);
   result = 31 * result + (keyPass != null ? Arrays.hashCode(keyPass) : 0);
   result = 31 * result + (trustStoreFile != null ? trustStoreFile.hashCode() : 0);
   result = 31 * result + (keyStoreFile != null ? keyStoreFile.hashCode() : 0);
   result = 31 * result + (trustStoreBytes != null ? Arrays.hashCode(trustStoreBytes) : 0);
   result = 31 * result + (keyStoreBytes != null ? Arrays.hashCode(keyStoreBytes) : 0);
   result =
       31 * result
           + (trustManagerFactoryAlgorithm != null ? trustManagerFactoryAlgorithm.hashCode() : 0);
   result =
       31 * result
           + (keyManagerFactoryAlgorithm != null ? keyManagerFactoryAlgorithm.hashCode() : 0);
   result =
       31 * result
           + (trustManagerFactoryProvider != null ? trustManagerFactoryProvider.hashCode() : 0);
   result =
       31 * result
           + (keyManagerFactoryProvider != null ? keyManagerFactoryProvider.hashCode() : 0);
   result = 31 * result + (securityProtocol != null ? securityProtocol.hashCode() : 0);
   return result;
 }
Beispiel #15
0
 @Override
 public int hashCode() {
   int result = Arrays.hashCode(whitePoint);
   result = 31 * result + (blackPoint != null ? Arrays.hashCode(blackPoint) : 0);
   result = 31 * result + (range != null ? Arrays.hashCode(range) : 0);
   return result;
 }
 /** Tests the <code>concat</code> method. */
 public void testConcat() {
   assertEquals(
       Arrays.hashCode(new ITerm[] {I_2, I_5, I_10, F_2}),
       Arrays.hashCode(
           BuiltinHelper.concat(
               new int[] {0, 3}, new ITerm[] {I_2, F_2}, new ITerm[] {I_5, I_10})));
   assertEquals(
       Arrays.hashCode(new ITerm[] {I_2, F_2, I_5, I_10}),
       Arrays.hashCode(
           BuiltinHelper.concat(
               new int[] {0, 1}, new ITerm[] {I_2, F_2}, new ITerm[] {I_5, I_10})));
   assertEquals(
       Arrays.hashCode(new ITerm[] {I_5, I_10, I_2, F_2}),
       Arrays.hashCode(
           BuiltinHelper.concat(
               new int[] {2, 3}, new ITerm[] {I_2, F_2}, new ITerm[] {I_5, I_10})));
   assertEquals(
       Arrays.hashCode(new ITerm[] {I_5, I_10}),
       Arrays.hashCode(
           BuiltinHelper.concat(new int[] {}, new ITerm[] {}, new ITerm[] {I_5, I_10})));
   assertEquals(
       Arrays.hashCode(new ITerm[] {I_2, F_2}),
       Arrays.hashCode(
           BuiltinHelper.concat(new int[] {0, 1}, new ITerm[] {I_2, F_2}, new ITerm[] {})));
 }
 @Override
 public int hashCode() {
   final int prime = 31;
   int result = 1;
   result = prime * result + Arrays.hashCode(columnNames);
   result = prime * result + Arrays.hashCode(columnValues);
   return result;
 }
 @Override
 public int hashCode() {
   final int prime = 31;
   int result = super.hashCode();
   result = prime * result + Arrays.hashCode(xEncrypted);
   result = prime * result + Arrays.hashCode(xEncryptedMAC);
   return result;
 }
Beispiel #19
0
 /**
  * Returns a suitable hash code given the definition of {@code #equals}.
  *
  * @return the hash code
  */
 @Override
 public int hashCode() {
   return Arrays.hashCode(standardTransitions)
       ^ Arrays.hashCode(standardOffsets)
       ^ Arrays.hashCode(savingsInstantTransitions)
       ^ Arrays.hashCode(wallOffsets)
       ^ Arrays.hashCode(lastRules);
 }
  @Override
  public int hashCode() {

    int hash = 7;
    hash = 59 * hash + Arrays.hashCode(this.aCoefficients);
    hash = 59 * hash + Arrays.hashCode(this.bCoefficients);
    return hash;
  }
 @Override
 public int hashCode() {
   final int prime = 31;
   int result = 1;
   result = prime * result + Arrays.hashCode(fLocations);
   result = prime * result + Arrays.hashCode(fRanks);
   return result;
 }
 private int calcHashCode() {
   final int prime = 31;
   int result = 1;
   result = prime * result + ((interpolation == null) ? 0 : interpolation.hashCode());
   result = prime * result + Arrays.hashCode(x);
   result = prime * result + Arrays.hashCode(y);
   return result;
 }
 @Override
 public int hashCode() {
   return ObjectUtils.hashCode(mUsername)
       + Arrays.hashCode(mPassword)
       + Arrays.hashCode(contextClasses)
       + ObjectUtils.hashCode(mHostname)
       + ObjectUtils.hashCode(mPort)
       + ObjectUtils.hashCode(mURL);
 }
 @Override
 public int hashCode() {
   int result = (int) (height ^ (height >>> 32));
   result = 31 * result + chainHead.hashCode();
   result = 31 * result + Arrays.hashCode(hits);
   result = 31 * result + outputs.hashCode();
   result = 31 * result + Arrays.hashCode(heights);
   return result;
 }
Beispiel #25
0
 @Override
 public int hashCode() {
   final int prime = 31;
   int result = 1;
   result = prime * result + Arrays.hashCode(cipherText);
   result = prime * result + Arrays.hashCode(iv);
   result = prime * result + Arrays.hashCode(mac);
   return result;
 }
Beispiel #26
0
 public int hashCode() {
   int result;
   long temp;
   result = (whitePoint != null ? Arrays.hashCode(whitePoint) : 0);
   result = 31 * result + (primaries != null ? Arrays.hashCode(primaries) : 0);
   temp = gamma != +0.0d ? Double.doubleToLongBits(gamma) : 0L;
   result = 31 * result + (int) (temp ^ (temp >>> 32));
   return result;
 }
 @Override
 public int hashCode() {
   final int prime = 31;
   int result = 1;
   result = prime * result + Arrays.hashCode(buildingTypesToIndex);
   result = prime * result + Arrays.hashCode(queues);
   result = prime * result + ((settings == null) ? 0 : settings.hashCode());
   return result;
 }
Beispiel #28
0
 @Override
 public int hashCode() {
   int result = (a ? 1 : 0);
   result = 31 * result + b;
   result = 31 * result + Arrays.hashCode(c);
   result = 31 * result + Arrays.hashCode(d);
   result = 31 * result + e.hashCode();
   result = 31 * result + f.hashCode();
   return result;
 }
 @Override
 public int hashCode() {
   final int prime = 31;
   int result = 1;
   result = prime * result + ((_nodeKey == null) ? 0 : Arrays.hashCode(_nodeKey.getEncoded()));
   result = prime * result + ((_nodeName == null) ? 0 : _nodeName.hashCode());
   result = prime * result + Arrays.hashCode(_storedNodeKeyID);
   result = prime * result + ((_storedNodeKeyName == null) ? 0 : _storedNodeKeyName.hashCode());
   return result;
 }
 @Override
 public int hashCode() {
   int result;
   long temp;
   temp = Double.doubleToLongBits(ownNumber);
   result = (int) (temp ^ (temp >>> 32));
   result = 31 * result + (files != null ? Arrays.hashCode(files) : 0);
   result = 31 * result + (used != null ? Arrays.hashCode(used) : 0);
   return result;
 }