Tabnine Logo
Reference2DoubleMap$Entry
Code IndexAdd Tabnine to your IDE (free)

How to use
Reference2DoubleMap$Entry
in
it.unimi.dsi.fastutil.objects

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

origin: it.unimi.dsi/fastutil

  @Override
  public String toString() {
    final StringBuilder s = new StringBuilder();
    final ObjectIterator<Reference2DoubleMap.Entry<K>> i = Reference2DoubleMaps.fastIterator(this);
    int n = size();
    Reference2DoubleMap.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: it.unimi.dsi/fastutil

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

/** {@inheritDoc} */
@SuppressWarnings({"unchecked", "deprecation"})
@Override
public void putAll(final Map<? extends K, ? extends Double> m) {
  if (m instanceof Reference2DoubleMap) {
    ObjectIterator<Reference2DoubleMap.Entry<K>> i = Reference2DoubleMaps
        .fastIterator((Reference2DoubleMap<K>) m);
    while (i.hasNext()) {
      final Reference2DoubleMap.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.di/mg4j-big

/** Copies the argument internally, rescaling weights so they sum up to one.
 * 
 * @param index2Weight the new map from indices to weights.
 * @return true.
 */
public synchronized boolean setWeights( final Reference2DoubleMap<Index> index2Weight ) {
  this.index2Weight.clear();
  this.index2Weight.defaultReturnValue( 0 ); // Since we're setting up values, we must assume missing indices have weight 0.
  
  double weightSum = 0;
  for( DoubleIterator i = index2Weight.values().iterator(); i.hasNext(); ) weightSum += i.nextDouble();
  if ( weightSum == 0 ) weightSum = 1; // No positive weights.
  for( ObjectIterator<Entry<Index, Double>> i = index2Weight.entrySet().iterator(); i.hasNext(); ) {
    Reference2DoubleMap.Entry<Index> e = (Reference2DoubleMap.Entry<Index>)i.next();
    this.index2Weight.put( e.getKey(), e.getDoubleValue() / weightSum );
  }
  this.index2Weight.trim();
  LOGGER.debug( "New weight map for " + this + ": " + this.index2Weight );
  return true;
}

origin: it.unimi.dsi/mg4j

/** Copies the argument internally, rescaling weights so they sum up to one.
 * 
 * @param index2Weight the new map from indices to weights.
 * @return true.
 */
public synchronized boolean setWeights( final Reference2DoubleMap<Index> index2Weight ) {
  this.index2Weight.clear();
  this.index2Weight.defaultReturnValue( 0 ); // Since we're setting up values, we must assume missing indices have weight 0.
  
  double weightSum = 0;
  for( DoubleIterator i = index2Weight.values().iterator(); i.hasNext(); ) weightSum += i.nextDouble();
  if ( weightSum == 0 ) weightSum = 1; // No positive weights.
  for( ObjectIterator<Entry<Index, Double>> i = index2Weight.entrySet().iterator(); i.hasNext(); ) {
    Reference2DoubleMap.Entry<Index> e = (Reference2DoubleMap.Entry<Index>)i.next();
    this.index2Weight.put( e.getKey(), e.getDoubleValue() / weightSum );
  }
  this.index2Weight.trim();
  LOGGER.debug( "New weight map for " + this + ": " + this.index2Weight );
  return true;
}

origin: it.unimi.dsi/mg4j-big

/** Copies the argument internally, rescaling weights so they sum up to one.
 * 
 * @param index2Weight the new map from indices to weights.
 * @return true.
 */
public synchronized boolean setWeights( final Reference2DoubleMap<Index> index2Weight ) {
  this.index2Weight.clear();
  this.index2Weight.defaultReturnValue( 0 ); // Since we're setting up values, we must assume missing indices have weight 0.
  
  double weightSum = 0;
  for( DoubleIterator i = index2Weight.values().iterator(); i.hasNext(); ) weightSum += i.nextDouble();
  if ( weightSum == 0 ) weightSum = 1; // No positive weights.
  for( ObjectIterator<Entry<Index, Double>> i = index2Weight.entrySet().iterator(); i.hasNext(); ) {
    Reference2DoubleMap.Entry<Index> e = (Reference2DoubleMap.Entry<Index>)i.next();
    this.index2Weight.put( e.getKey(), e.getDoubleValue() / weightSum );
  }
  this.index2Weight.trim();
  LOGGER.debug( "New weight map for " + this + ": " + this.index2Weight );
  return true;
}

origin: it.unimi.dsi/fastutil

@SuppressWarnings("unchecked")
@Override
public boolean contains(final Object o) {
  if (!(o instanceof Map.Entry))
    return false;
  if (o instanceof Reference2DoubleMap.Entry) {
    final Reference2DoubleMap.Entry<K> e = (Reference2DoubleMap.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: it.unimi.dsi/fastutil

@SuppressWarnings("unchecked")
@Override
public boolean equals(final Object o) {
  if (!(o instanceof Map.Entry))
    return false;
  if (o instanceof Reference2DoubleMap.Entry) {
    final Reference2DoubleMap.Entry<K> e = (Reference2DoubleMap.Entry<K>) o;
    return ((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 ((this.key) == ((key))) && (Double.doubleToLongBits(this.value) == Double
      .doubleToLongBits(((Double) (value)).doubleValue()));
}
@Override
origin: it.unimi.di/mg4j

/** Copies the argument internally, rescaling weights so they sum up to one.
 * 
 * @param index2Weight the new map from indices to weights.
 * @return true.
 */
public synchronized boolean setWeights( final Reference2DoubleMap<Index> index2Weight ) {
  this.index2Weight.clear();
  this.index2Weight.defaultReturnValue( 0 ); // Since we're setting up values, we must assume missing indices have weight 0.
  
  double weightSum = 0;
  for( DoubleIterator i = index2Weight.values().iterator(); i.hasNext(); ) weightSum += i.nextDouble();
  if ( weightSum == 0 ) weightSum = 1; // No positive weights.
  for( ObjectIterator<Entry<Index, Double>> i = index2Weight.entrySet().iterator(); i.hasNext(); ) {
    Reference2DoubleMap.Entry<Index> e = (Reference2DoubleMap.Entry<Index>)i.next();
    this.index2Weight.put( e.getKey(), e.getDoubleValue() / weightSum );
  }
  this.index2Weight.trim();
  LOGGER.debug( "New weight map for " + this + ": " + this.index2Weight );
  return true;
}

origin: it.unimi.dsi/fastutil

@SuppressWarnings("unchecked")
@Override
public boolean remove(final Object o) {
  if (!(o instanceof Map.Entry))
    return false;
  if (o instanceof Reference2DoubleMap.Entry) {
    final Reference2DoubleMap.Entry<K> e = (Reference2DoubleMap.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: it.unimi.dsi/fastutil

@Override
public double nextDouble() {
  return i.next().getDoubleValue();
};
@Override
origin: it.unimi.dsi/fastutil

@Override
public boolean containsKey(final Object k) {
  final ObjectIterator<Reference2DoubleMap.Entry<K>> i = reference2DoubleEntrySet().iterator();
  while (i.hasNext())
    if (i.next().getKey() == k)
      return true;
  return false;
}
@Override
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

@Override
public K previous() {
  return i.previous().getKey();
};
@Override
origin: it.unimi.dsi/fastutil

@Override
public K next() {
  return i.next().getKey();
};
@Override
it.unimi.dsi.fastutil.objectsReference2DoubleMap$Entry

Javadoc

A type-specific java.util.Map.Entry; provides some additional methods that use polymorphism to avoid (un)boxing.

Most used methods

  • getDoubleValue
    Returns the value corresponding to this entry.
  • getKey
  • setValue

Popular in Java

  • Parsing JSON documents to java classes using gson
  • scheduleAtFixedRate (Timer)
  • addToBackStack (FragmentTransaction)
  • getContentResolver (Context)
  • Component (java.awt)
    A component is an object having a graphical representation that can be displayed on the screen and t
  • RandomAccessFile (java.io)
    Allows reading from and writing to a file in a random-access manner. This is different from the uni-
  • URI (java.net)
    A Uniform Resource Identifier that identifies an abstract or physical resource, as specified by RFC
  • BitSet (java.util)
    The BitSet class implements abit array [http://en.wikipedia.org/wiki/Bit_array]. Each element is eit
  • Stack (java.util)
    Stack is a Last-In/First-Out(LIFO) data structure which represents a stack of objects. It enables u
  • JFrame (javax.swing)
  • Github Copilot alternatives
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