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

The following examples show how to use com.google.common.primitives.Longs#hashCode() . 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 File: HashQParserPlugin.java    From lucene-solr with 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
Source File: RefContext.java    From hmftools with GNU General Public License v3.0 5 votes vote down vote up
@Override
public int hashCode() {
    int h = 5381;
    h += (h << 5) + chromosome().hashCode();
    h += (h << 5) + Longs.hashCode(position());
    return h;
}
 
Example 3
Source File: AltContext.java    From hmftools with GNU General Public License v3.0 5 votes vote down vote up
@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
Source File: IntervalIndex.java    From nd4j with 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 5
Source File: CtfTmfLostEvent.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
@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 6
Source File: DigestUtils.java    From bazel with 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 File: LongPair.java    From elasticsearch-taste with 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 8
Source File: IntervalDatum.java    From tajo with Apache License 2.0 4 votes vote down vote up
@Override
public int hashCode(){
  return Longs.hashCode(asInt8());
}
 
Example 9
Source File: SimpleRecommendedItem.java    From myrrix-recommender with Apache License 2.0 4 votes vote down vote up
@Override
public int hashCode() {
  return Longs.hashCode(itemID) ^ Floats.hashCode(value);
}
 
Example 10
Source File: TimeInstant.java    From immutables with Apache License 2.0 4 votes vote down vote up
@Override
public int hashCode() {
  return Longs.hashCode(value);
}
 
Example 11
Source File: PointIndex.java    From nd4j with 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 12
Source File: LongToken.java    From stratio-cassandra with Apache License 2.0 4 votes vote down vote up
public int hashCode()
{
    return Longs.hashCode(token);
}
 
Example 13
Source File: AbstractBsonInt64.java    From mongowp with Apache License 2.0 4 votes vote down vote up
@Override
public final int hashCode() {
  return Longs.hashCode(longValue());
}
 
Example 14
Source File: TimestampDatum.java    From tajo with Apache License 2.0 4 votes vote down vote up
@Override
public int hashCode(){
  return Longs.hashCode(timestamp);
}
 
Example 15
Source File: Gas.java    From besu with Apache License 2.0 4 votes vote down vote up
@Override
public int hashCode() {
  return Longs.hashCode(value);
}
 
Example 16
Source File: TimeDatum.java    From tajo with Apache License 2.0 4 votes vote down vote up
@Override
public int hashCode() {
  return Longs.hashCode(time);
}
 
Example 17
Source File: SuffixRangeSpecification.java    From emodb with Apache License 2.0 4 votes vote down vote up
@Override
public int hashCode() {
    return Longs.hashCode(_length);
}
 
Example 18
Source File: RandomScoreFunctionParser.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
@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 19
Source File: ScheduledSplit.java    From presto with Apache License 2.0 4 votes vote down vote up
@Override
public int hashCode()
{
    return Longs.hashCode(sequenceId);
}