Exemplo n.º 1
0
 @Override
 public int hashCode() {
   final int prime = 31;
   int result = super.hashCode();
   result = prime * result + (includeLower ? 1231 : 1237);
   result = prime * result + (includeUpper ? 1231 : 1237);
   result = prime * result + ((lowerTerm == null) ? 0 : lowerTerm.hashCode());
   result = prime * result + ((upperTerm == null) ? 0 : upperTerm.hashCode());
   return result;
 }
 public void testIntStream() throws Exception {
   final NumericTokenStream stream = new NumericTokenStream().setIntValue(ivalue);
   // use getAttribute to test if attributes really exist, if not an IAE will be throwed
   final TermToBytesRefAttribute bytesAtt = stream.getAttribute(TermToBytesRefAttribute.class);
   final TypeAttribute typeAtt = stream.getAttribute(TypeAttribute.class);
   final NumericTokenStream.NumericTermAttribute numericAtt =
       stream.getAttribute(NumericTokenStream.NumericTermAttribute.class);
   final BytesRef bytes = bytesAtt.getBytesRef();
   stream.reset();
   assertEquals(32, numericAtt.getValueSize());
   for (int shift = 0; shift < 32; shift += NumericUtils.PRECISION_STEP_DEFAULT) {
     assertTrue("New token is available", stream.incrementToken());
     assertEquals("Shift value wrong", shift, numericAtt.getShift());
     final int hash = bytesAtt.fillBytesRef();
     assertEquals("Hash incorrect", bytes.hashCode(), hash);
     assertEquals(
         "Term is incorrectly encoded",
         ivalue & ~((1 << shift) - 1),
         NumericUtils.prefixCodedToInt(bytes));
     assertEquals(
         "Term raw value is incorrectly encoded",
         ((long) ivalue) & ~((1L << shift) - 1L),
         numericAtt.getRawValue());
     assertEquals(
         "Type incorrect",
         (shift == 0)
             ? NumericTokenStream.TOKEN_TYPE_FULL_PREC
             : NumericTokenStream.TOKEN_TYPE_LOWER_PREC,
         typeAtt.type());
   }
   assertFalse("More tokens available", stream.incrementToken());
   stream.end();
   stream.close();
 }
Exemplo n.º 3
0
 @Override
 public int hashCode() {
   final int prime = 31;
   int result = 1;
   result = prime * result + ((field == null) ? 0 : field.hashCode());
   result = prime * result + ((bytes == null) ? 0 : bytes.hashCode());
   return result;
 }
 @Override
 public int hashCode() {
   int code = super.hashCode();
   code = code * 31 + flags;
   if (payload != null) {
     code = code * 31 + payload.hashCode();
   }
   return code;
 }
 @Override
 public int hashCode() {
   return value.hashCode();
 }
Exemplo n.º 6
0
 @Override
 public int hashCode() {
   return field.hashCode() * 31 + term.hashCode();
 }
 @Override
 public int hashCode() {
   return 31 * classHash() + type.hashCode();
 }