Tabnine Logo
Object2DoubleMap$Entry.getDoubleValue
Code IndexAdd Tabnine to your IDE (free)

How to use
getDoubleValue
method
in
it.unimi.dsi.fastutil.objects.Object2DoubleMap$Entry

Best Java code snippets using it.unimi.dsi.fastutil.objects.Object2DoubleMap$Entry.getDoubleValue (Showing top 12 results out of 315)

origin: it.unimi.dsi/fastutil

/**
 * {@inheritDoc}
 * 
 * @deprecated Please use the corresponding type-specific method instead.
 */
@Deprecated
@Override
default Double getValue() {
  return Double.valueOf(getDoubleValue());
}
/**
origin: it.unimi.dsi/fastutil

@SuppressWarnings("unchecked")
@Override
public boolean equals(final Object o) {
  if (!(o instanceof Map.Entry))
    return false;
  if (o instanceof Object2DoubleMap.Entry) {
    final Object2DoubleMap.Entry<K> e = (Object2DoubleMap.Entry<K>) o;
    return java.util.Objects.equals(key, e.getKey())
        && (Double.doubleToLongBits(value) == Double.doubleToLongBits(e.getDoubleValue()));
  }
  final Map.Entry<?, ?> e = (Map.Entry<?, ?>) o;
  final Object key = e.getKey();
  final Object value = e.getValue();
  if (value == null || !(value instanceof Double))
    return false;
  return java.util.Objects.equals(this.key, (key)) && (Double.doubleToLongBits(this.value) == Double
      .doubleToLongBits(((Double) (value)).doubleValue()));
}
@Override
origin: it.unimi.dsi/fastutil

  @Override
  public String toString() {
    final StringBuilder s = new StringBuilder();
    final ObjectIterator<Object2DoubleMap.Entry<K>> i = Object2DoubleMaps.fastIterator(this);
    int n = size();
    Object2DoubleMap.Entry<K> e;
    boolean first = true;
    s.append("{");
    while (n-- != 0) {
      if (first)
        first = false;
      else
        s.append(", ");
      e = i.next();
      if (this == e.getKey())
        s.append("(this map)");
      else
        s.append(String.valueOf(e.getKey()));
      s.append("=>");
      s.append(String.valueOf(e.getDoubleValue()));
    }
    s.append("}");
    return s.toString();
  }
}
origin: com.github.monnetproject/bliss.betalm

  public static void main(String[] args) throws Exception {
    final CLIOpts opts = new CLIOpts(args);
    final SourceType sourceType = opts.enumOptional("t", SourceType.class, SourceType.FIRST, "The corpus type");
    final File refFile = opts.roFile("reference", "The reference ontology");
    final File corpusFile = opts.roFile("corpus", "The corpus file");
    final File wordMapFile = opts.roFile("wordMap", "The word map");
    final int N = opts.intValue("N", "The maximal n-gram to consider");
    final double thresh = opts.doubleValue("threshold", "The threshold of salience to filter at");
    final File outFile = opts.woFile("out", "The file to write the salient n-gram list to");
    if(!opts.verify(MostSalient.class)) {
      return;
    }
    final int W = WordMap.calcW(wordMapFile);
    final String[] wordMap = WordMap.inverseFromFile(wordMapFile, W, true);
    final Object2DoubleMap<NGram> salientNGrams = mostSalientNGrams(refFile, corpusFile, N, sourceType);
    final DataOutputStream out = new DataOutputStream(CLIOpts.openOutputAsMaybeZipped(outFile));
    for(Object2DoubleMap.Entry<NGram> e : salientNGrams.object2DoubleEntrySet()) {
      if(e.getDoubleValue() > thresh) {
        final NGram ng = e.getKey();
        out.writeInt(ng.ngram.length);
        for(int i = 0; i < ng.ngram.length; i++) {
          out.writeInt(ng.ngram[i]);
        }
        out.writeDouble(e.getDoubleValue());
      }
    }
    out.flush();
    out.close();
  }
}
origin: com.github.monnetproject/bliss.betalm

public static Object2DoubleMap<NGram> mostSalientNGrams(final File reference, final File corpus, int N, SourceType sourceType) throws IOException {
  final Object2DoubleMap<NGram> referenceCounts = countInReference(reference, N);
  final Object2DoubleMap<NGram> corpusCounts = countInCorpus(corpus, N, referenceCounts.keySet(), sourceType);
  final Object2DoubleMap<NGram> salience = new Object2DoubleRBTreeMap<NGram>();
  for (Object2DoubleMap.Entry<NGram> e : referenceCounts.object2DoubleEntrySet()) {
    if (corpusCounts.containsKey(e.getKey())) {
      salience.put(e.getKey(), e.getDoubleValue()/corpusCounts.getDouble(e.getKey()));
    }
  }
  referenceCounts.clear();
  corpusCounts.clear();
  final Object2DoubleMap<NGram> rankedSalience = new Object2DoubleRBTreeMap<NGram>(new Comparator<NGram>() {
    @Override
    public int compare(NGram o1, NGram o2) {
      final double salience1 = salience.getDouble(o1);
      final double salience2 = salience.getDouble(o2);
      if(salience1 < salience2) {
        return +1;
      } else if(salience1 > salience2) {
        return -1;
      } else {
        return o1.compareTo(o2);
      }
    }
  });
  rankedSalience.putAll(salience);
  return rankedSalience;
}
origin: Diorite/Diorite

@Nullable
public static <T> T getWeightedRandom(Random random, Object2DoubleMap<T> choices)
{
  double i = 0;
  DoubleCollection doubles = choices.values();
  for (DoubleIterator iterator = doubles.iterator(); iterator.hasNext(); )
  {
    double x = iterator.nextDouble();
    i += x;
  }
  i = getRandomDouble(random, 0, i);
  for (Object2DoubleMap.Entry<T> entry : choices.object2DoubleEntrySet())
  {
    i -= entry.getDoubleValue();
    if (i < 0)
    {
      return entry.getKey();
    }
  }
  return null;
}
origin: it.unimi.dsi/fastutil

/** {@inheritDoc} */
@SuppressWarnings({"unchecked", "deprecation"})
@Override
public void putAll(final Map<? extends K, ? extends Double> m) {
  if (m instanceof Object2DoubleMap) {
    ObjectIterator<Object2DoubleMap.Entry<K>> i = Object2DoubleMaps.fastIterator((Object2DoubleMap<K>) m);
    while (i.hasNext()) {
      final Object2DoubleMap.Entry<? extends K> e = i.next();
      put(e.getKey(), e.getDoubleValue());
    }
  } else {
    int n = m.size();
    final Iterator<? extends Map.Entry<? extends K, ? extends Double>> i = m.entrySet().iterator();
    Map.Entry<? extends K, ? extends Double> e;
    while (n-- != 0) {
      e = i.next();
      put(e.getKey(), e.getValue());
    }
  }
}
/**
origin: it.unimi.dsi/fastutil

@SuppressWarnings("unchecked")
@Override
public boolean contains(final Object o) {
  if (!(o instanceof Map.Entry))
    return false;
  if (o instanceof Object2DoubleMap.Entry) {
    final Object2DoubleMap.Entry<K> e = (Object2DoubleMap.Entry<K>) o;
    final K k = e.getKey();
    return map.containsKey(k)
        && (Double.doubleToLongBits(map.getDouble(k)) == Double.doubleToLongBits(e.getDoubleValue()));
  }
  final Map.Entry<?, ?> e = (Map.Entry<?, ?>) o;
  final Object k = e.getKey();
  final Object value = e.getValue();
  if (value == null || !(value instanceof Double))
    return false;
  return map.containsKey(k) && (Double.doubleToLongBits(map.getDouble(k)) == Double
      .doubleToLongBits(((Double) (value)).doubleValue()));
}
@SuppressWarnings("unchecked")
origin: RankSys/RankSys

/**
 * Calculates the norm (sum of relevance scores) of each item.
 *
 * @param <U> type of the users
 * @param <I> type of the items
 * @param recommendations set of recommendations used to calculate the norm
 * @return item-norm map
 */
public static <U, I> Object2DoubleMap<I> calculateNorm(Stream<Recommendation<U, I>> recommendations) {
  return recommendations.parallel()
      .flatMap(recommendation -> recommendation.getItems().stream())
      .collect(
          Object2DoubleOpenHashMap::new,
          (m, iv) -> m.addTo(iv.v1, iv.v2),
          (m1, m2) -> m2.object2DoubleEntrySet().forEach(e -> m1.addTo(e.getKey(), e.getDoubleValue()))
      );
}
origin: it.unimi.dsi/fastutil

@SuppressWarnings("unchecked")
@Override
public boolean remove(final Object o) {
  if (!(o instanceof Map.Entry))
    return false;
  if (o instanceof Object2DoubleMap.Entry) {
    final Object2DoubleMap.Entry<K> e = (Object2DoubleMap.Entry<K>) o;
    return map.remove(e.getKey(), e.getDoubleValue());
  }
  Map.Entry<?, ?> e = (Map.Entry<?, ?>) o;
  final Object k = e.getKey();
  final Object value = e.getValue();
  if (value == null || !(value instanceof Double))
    return false;
  final double v = ((Double) (value)).doubleValue();
  return map.remove(k, v);
}
@Override
origin: RankSys/RankSys

@Override
public void combine(SystemMetric<U, I> other) {
  AbstractSalesDiversityMetric<U, I> otherM = (AbstractSalesDiversityMetric<U, I>) other;
  otherM.itemCount.object2DoubleEntrySet()
      .forEach(e -> itemCount.addTo(e.getKey(), e.getDoubleValue()));
  otherM.itemWeight.object2DoubleEntrySet()
      .forEach(e -> itemWeight.addTo(e.getKey(), e.getDoubleValue()));
  freeNorm += otherM.freeNorm;
  numUsers += otherM.numUsers;
}
origin: it.unimi.dsi/fastutil

@Override
public double nextDouble() {
  return i.next().getDoubleValue();
};
@Override
it.unimi.dsi.fastutil.objectsObject2DoubleMap$EntrygetDoubleValue

Javadoc

Returns the value corresponding to this entry.

Popular methods of Object2DoubleMap$Entry

  • getKey
  • setValue

Popular in Java

  • Finding current android device location
  • setRequestProperty (URLConnection)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • findViewById (Activity)
  • ObjectMapper (com.fasterxml.jackson.databind)
    ObjectMapper provides functionality for reading and writing JSON, either to and from basic POJOs (Pl
  • FileWriter (java.io)
    A specialized Writer that writes to a file in the file system. All write requests made by calling me
  • InputStream (java.io)
    A readable source of bytes.Most clients will use input streams that read data from the file system (
  • OutputStream (java.io)
    A writable sink for bytes.Most clients will use output streams that write data to the file system (
  • Cipher (javax.crypto)
    This class provides access to implementations of cryptographic ciphers for encryption and decryption
  • BasicDataSource (org.apache.commons.dbcp)
    Basic implementation of javax.sql.DataSource that is configured via JavaBeans properties. This is no
  • Best IntelliJ plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now