Example usage for com.google.common.primitives Longs hashCode

List of usage examples for com.google.common.primitives Longs hashCode

Introduction

In this page you can find the example usage for com.google.common.primitives Longs hashCode.

Prototype

public static int hashCode(long value) 

Source Link

Document

Returns a hash code for value ; equal to the result of invoking ((Long) value).hashCode() .

Usage

From source file:com.comphenix.protocol.async.PacketEventHolder.java

@Override
public int hashCode() {
    return Longs.hashCode(sendingIndex);
}

From source file:org.apache.mahout.cf.taste.hadoop.similarity.item.CountUsersKeyWritable.java

@Override
public int hashCode() {
    return Longs.hashCode(userID);
}

From source file:br.unb.cic.bionimbuz.plugin.PluginService.java

@Override
public int hashCode() {
    return Longs.hashCode(Integer.parseInt(id));
}

From source file:com.javachen.grab.common.math.DoubleWeightedMean.java

@Override
public int hashCode() {
    return Longs.hashCode(count) ^ Doubles.hashCode(totalWeight) ^ Doubles.hashCode(mean);
}

From source file:net.slashies.phpBridge.AbstractLongSet.java

@Override
public int hashCode() {
    LongIterator itr = longIterator();/*w  w w  . j  a v a2 s  .c o m*/
    int sum = 0;
    while (itr.hasNext())
        sum += Longs.hashCode(itr.next());
    return sum;
}

From source file:org.elasticsearch.index.query.functionscore.random.RandomScoreFunctionParser.java

@Override
public ScoreFunction parse(QueryParseContext parseContext, XContentParser parser)
        throws IOException, QueryParsingException {

    int seed = -1;

    String currentFieldName = null;
    XContentParser.Token token;/*from  ww  w .  j  ava  2 s.c o  m*/
    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.index(),
                                "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.index(),
                            "random_score seed must be an int/long or string, not '" + token.toString() + "'");
                }
            } else {
                throw new QueryParsingException(parseContext.index(),
                        NAMES[0] + " query does not support [" + currentFieldName + "]");
            }
        }
    }

    final FieldMapper<?> mapper = SearchContext.current().mapperService().smartNameFieldMapper("_uid");
    if (mapper == 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(mapper);

    return new RandomScoreFunction(seed, salt, uidFieldData);
}

From source file:com.cloudera.oryx.common.stats.DoubleWeightedMean.java

@Override
public int hashCode() {
    return Longs.hashCode(count) ^ LangUtils.hashDouble(totalWeight) ^ LangUtils.hashDouble(mean);
}

From source file:org.apache.mahout.math.RandomVector.java

@Override
public int hashCode() {
    return Longs.hashCode(baseSeed) ^ Longs.hashCode(size() ^ (gaussian ? 7 : 11));
}

From source file:org.apache.mahout.math.RandomMatrix.java

@Override
public int hashCode() {
    return Longs.hashCode(baseSeed)
            ^ Longs.hashCode((rowSize()) ^ Longs.hashCode(columnSize() ^ (gaussian ? 7 : 11)));
}

From source file:org.eclipse.tracecompass.ctf.tmf.core.event.CtfTmfLostEvent.java

@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;
}