Java Code Examples for com.google.common.primitives.Longs#hashCode()

The following examples show how to use com.google.common.primitives.Longs#hashCode() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: lucene-solr   File: HashQParserPlugin.java    License: Apache License 2.0 5 votes vote down vote up
public long hashCode(int doc) throws IOException {
  int valuesDocID = values.docID();
  if (valuesDocID < doc) {
    valuesDocID = values.advance(doc);
  }
  long l;
  if (valuesDocID == doc) {
    l = values.longValue();
  } else {
    l = 0; //worker=0 will always process empty values
  }
  return Longs.hashCode(l);
}
 
Example 2
@Override
public int hashCode() {
    int h = 5381;
    h += (h << 5) + chromosome().hashCode();
    h += (h << 5) + Longs.hashCode(position());
    return h;
}
 
Example 3
@Override
public int hashCode() {
    int h = 5381;
    h += (h << 5) + ref.hashCode();
    h += (h << 5) + alt.hashCode();
    h += (h << 5) + chromosome().hashCode();
    h += (h << 5) + Longs.hashCode(position());
    return h;
}
 
Example 4
@Override
public int hashCode() {
    final int prime = 31;
    int result = super.hashCode();
    result = prime * result + getTimeRange().hashCode();
    result = prime * result + Longs.hashCode(getNbLostEvents());
    return result;
}
 
Example 5
Source Project: elasticsearch-taste   File: LongPair.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public int hashCode() {
    final int firstHash = Longs.hashCode(first);
    // Flip top and bottom 16 bits; this makes the hash function probably different
    // for (a,b) versus (b,a)
    return (firstHash >>> 16 | firstHash << 16) ^ Longs.hashCode(second);
}
 
Example 6
Source Project: bazel   File: DigestUtils.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public int hashCode() {
  int result = 17;
  result = 31 * result + path.hashCode();
  result = 31 * result + Longs.hashCode(nodeId);
  result = 31 * result + Longs.hashCode(modifiedTime);
  result = 31 * result + Longs.hashCode(size);
  return result;
}
 
Example 7
Source Project: nd4j   File: IntervalIndex.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public int hashCode() {
    int result = Longs.hashCode(begin);
    result = 31 * result + Longs.hashCode(end);
    result = 31 * result + (inclusive ? 1 : 0);
    result = 31 * result + Longs.hashCode(stride);
    result = 31 * result + Longs.hashCode(index);
    return result;
}
 
Example 8
Source Project: besu   File: Gas.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public int hashCode() {
  return Longs.hashCode(value);
}
 
Example 9
Source Project: presto   File: ScheduledSplit.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public int hashCode()
{
    return Longs.hashCode(sequenceId);
}
 
Example 10
@Override
public ScoreFunction parse(QueryParseContext parseContext, XContentParser parser) throws IOException, QueryParsingException {

    int seed = -1;

    String currentFieldName = null;
    XContentParser.Token token;
    while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) {
        if (token == XContentParser.Token.FIELD_NAME) {
            currentFieldName = parser.currentName();
        } else if (token.isValue()) {
            if ("seed".equals(currentFieldName)) {
                if (token == XContentParser.Token.VALUE_NUMBER) {
                    if (parser.numberType() == XContentParser.NumberType.INT) {
                        seed = parser.intValue();
                    } else if (parser.numberType() == XContentParser.NumberType.LONG) {
                        seed = Longs.hashCode(parser.longValue());
                    } else {
                        throw new QueryParsingException(parseContext, "random_score seed must be an int, long or string, not '"
                                + token.toString() + "'");
                    }
                } else if (token == XContentParser.Token.VALUE_STRING) {
                    seed = parser.text().hashCode();
                } else {
                    throw new QueryParsingException(parseContext, "random_score seed must be an int/long or string, not '"
                            + token.toString() + "'");
                }
            } else {
                throw new QueryParsingException(parseContext, NAMES[0] + " query does not support [" + currentFieldName + "]");
            }
        }
    }

    final MappedFieldType fieldType = SearchContext.current().mapperService().smartNameFieldType("_uid");
    if (fieldType == null) {
        // mapper could be null if we are on a shard with no docs yet, so this won't actually be used
        return new RandomScoreFunction();
    }

    if (seed == -1) {
        seed = Longs.hashCode(parseContext.nowInMillis());
    }
    final ShardId shardId = SearchContext.current().indexShard().shardId();
    final int salt = (shardId.index().name().hashCode() << 10) | shardId.id();
    final IndexFieldData<?> uidFieldData = SearchContext.current().fieldData().getForField(fieldType);

    return new RandomScoreFunction(seed, salt, uidFieldData);
}
 
Example 11
Source Project: emodb   File: SuffixRangeSpecification.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public int hashCode() {
    return Longs.hashCode(_length);
}
 
Example 12
Source Project: tajo   File: TimeDatum.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public int hashCode() {
  return Longs.hashCode(time);
}
 
Example 13
Source Project: tajo   File: IntervalDatum.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public int hashCode(){
  return Longs.hashCode(asInt8());
}
 
Example 14
Source Project: tajo   File: TimestampDatum.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public int hashCode(){
  return Longs.hashCode(timestamp);
}
 
Example 15
Source Project: mongowp   File: AbstractBsonInt64.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public final int hashCode() {
  return Longs.hashCode(longValue());
}
 
Example 16
Source Project: stratio-cassandra   File: LongToken.java    License: Apache License 2.0 4 votes vote down vote up
public int hashCode()
{
    return Longs.hashCode(token);
}
 
Example 17
Source Project: nd4j   File: PointIndex.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public int hashCode() {
    int result = Longs.hashCode(point);
    result = 31 * result + (notUsed ? 1 : 0);
    return result;
}
 
Example 18
Source Project: immutables   File: TimeInstant.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public int hashCode() {
  return Longs.hashCode(value);
}
 
Example 19
@Override
public int hashCode() {
  return Longs.hashCode(itemID) ^ Floats.hashCode(value);
}