public void testIntValue() { for (long a : TEST_LONGS) { UnsignedLong aUnsigned = UnsignedLong.fromLongBits(a); int intValue = aUnsigned.bigIntegerValue().intValue(); assertEquals(intValue, aUnsigned.intValue()); } }
@Override public int intValue() { return getValue().intValue(); }
@Override public Value<?> parse(final Session.Resolver resolver, final ByteBuffer buffer) { return new FloatValue(name, semantics, Float.intBitsToFloat(uint(buffer, buffer.remaining()).intValue())); }
@Override public Value<?> parse(final Session.Resolver resolver, final ByteBuffer buffer) { return new FloatValue(name, semantics, Float.intBitsToFloat(uint(buffer, buffer.remaining()).intValue())); }
protected void computeSubwords(String word, List<Integer> ngrams, List<String> substrings) { for(int i = 0; i < word.length(); i++) { StringBuilder ngram = new StringBuilder(); if (!charMatches(word.charAt(i))) { for (int j = i, n = 1; j < word.length() && n <= args.getMaxn(); n++) { ngram.append(word.charAt(j++)); while (j < word.length() && charMatches(word.charAt(j))) { ngram.append(word.charAt(j++)); } if (n >= args.getMinn() && !(n == 1 && (i == 0 || j == word.length()))) { UnsignedLong h = UnsignedLong.valueOf(hash(ngram.toString())); h = h.mod(UnsignedLong.valueOf(args.getBucketNumber())); ngrams.add(nWords + h.intValue()); substrings.add(ngram.toString()); } } } } }
protected void computeSubwords(String word, List<Integer> ngrams) { for(int i = 0; i < word.length(); i++) { StringBuilder ngram = new StringBuilder(); if (!charMatches(word.charAt(i))) { for (int j = i, n = 1; j < word.length() && n <= args.getMaxn(); n++) { ngram.append(word.charAt(j++)); while (j < word.length() && charMatches(word.charAt(j))) { ngram.append(word.charAt(j++)); } if (n >= args.getMinn() && !(n == 1 && (i == 0 || j == word.length()))) { UnsignedLong h = UnsignedLong.valueOf(hash(ngram.toString())); h = h.mod(UnsignedLong.valueOf(args.getBucketNumber())); pushHash(ngrams, h.intValue()); } } } } }
public void testIntValue() { for (long a : TEST_LONGS) { UnsignedLong aUnsigned = UnsignedLong.fromLongBits(a); int intValue = aUnsigned.bigIntegerValue().intValue(); assertEquals(intValue, aUnsigned.intValue()); } }
protected void addWordNGrams(List<Integer> line, List<Long> hashes, int n) { if (pruneIdxSize == 0) { return; } for (int i = 0; i < hashes.size(); i++) { UnsignedLong h = toUnsignedLong64(hashes.get(i)); for (int j = i + 1; j < hashes.size() && j < i + n; j++) { long h2 = (long) hashes.get(j).intValue(); long coeff = 116049371L; if (h2 >= 0) { h = h.times(UnsignedLong.valueOf(coeff)).plus(UnsignedLong.valueOf(h2)); } else { h = h.times(UnsignedLong.valueOf(coeff)).minus(UnsignedLong.valueOf(-h2)); } int id = h.mod(UnsignedLong.valueOf(args.getBucketNumber())).intValue(); if (pruneIdxSize > 0) { int pruneId = getPruning(id); if (pruneId >= 0) { id = pruneId; } else { continue; } } line.add(nWords + id); } } }