public double get( int key ) { synchronized( mutex ) { return m.get( key ); } }
/** * Retrieves the value for <tt>key</tt> * * @param key an <code>Object</code> value * @return the value of <tt>key</tt> or null if no such mapping exists. */ public Double get( Object key ) { int k; if ( key != null ) { if ( key instanceof Integer ) { k = unwrapKey( key ); } else { return null; } } else { k = _map.getNoEntryKey(); } double v = _map.get( k ); // There may be a false positive since primitive maps // cannot return null, so we have to do an extra // check here. if ( v == _map.getNoEntryValue() ) { return null; } else { return wrapValue( v ); } }
/** {@inheritDoc} */ @Override public boolean equals( Object other ) { if ( ! ( other instanceof TIntDoubleMap ) ) { return false; } TIntDoubleMap that = ( TIntDoubleMap ) other; if ( that.size() != this.size() ) { return false; } double[] values = _values; byte[] states = _states; double this_no_entry_value = getNoEntryValue(); double that_no_entry_value = that.getNoEntryValue(); for ( int i = values.length; i-- > 0; ) { if ( states[i] == FULL ) { int key = _set[i]; double that_value = that.get( key ); double this_value = values[i]; if ( ( this_value != that_value ) && ( this_value != this_no_entry_value ) && ( that_value != that_no_entry_value ) ) { return false; } } } return true; }
public double get( int key) { return m.get( key ); }
double diff = distances.get(o1.getId()) - distances.get(o2.getId()); if (candidateEdges.isEmpty() || distances.get(candidateEdges.get(0).getId()) > radiusDeg) { double diff = stopDistances.get(o1.getIndex()) - stopDistances.get(o2.getIndex()); if (diff < 0) { return -1; if (candidateStops.isEmpty() || stopDistances.get(candidateStops.get(0).getIndex()) > radiusDeg) { LOG.debug("Stops aren't close either!"); return false; bestStops.add(candidateStops.get(i++)); } while (i < candidateStops.size() && stopDistances.get(candidateStops.get(i).getIndex()) - stopDistances .get(candidateStops.get(i - 1).getIndex()) < DUPLICATE_WAY_EPSILON_DEGREES); bestEdges.add(candidateEdges.get(i++)); } while (i < candidateEdges.size() && distances.get(candidateEdges.get(i).getId()) - distances .get(candidateEdges.get(i - 1).getId()) < DUPLICATE_WAY_EPSILON_DEGREES); double distanceDegreesLatitude = distances.get(candidateEdges.get(0).getId()); int distanceMeters = (int)SphericalDistanceLibrary.degreesLatitudeToMeters(distanceDegreesLatitude); if (distanceMeters > WARNING_DISTANCE_METERS) {
@Override public final double getDouble(int index) { this.checkBounds(index, length); return values.get(index); }
@Override @Deprecated public Double get(DBIDRef id) { return Double.valueOf(map.get(DBIDUtil.asInteger(id))); }
/** * {@inheritDoc} */ public Set<WeightedEdge> getEdges(int vertex) { return (edges.containsKey(vertex)) ? Collections.<WeightedEdge>singleton( new SimpleWeightedEdge(rootVertex, vertex, edges.get(vertex))) : Collections.<WeightedEdge>emptySet(); }
private double getGenerality(int wpId) throws DaoException { if (generality.containsKey(wpId)) { return generality.get(wpId); } int numInLinks = lld.getCount(new DaoFilter().setLanguages(language).setDestIds(wpId)); double g = 0.5 + Math.log(1 + Math.min(MAX_INLINKS, numInLinks)) / Math.log(1 + MAX_INLINKS); generality.put(numInLinks, numInLinks); return numInLinks; }
private void handleSliderInput(int sliderIndex, int data) { double value = SliderboardTools.toSliderPercent(data); List<SliderboardListener> listeners = sliderListeners.get(sliderIndex); double previousValue = sliderValues.containsKey(sliderIndex) ? sliderValues.get(sliderIndex) : -1.0; if (listeners != null && previousValue != value) { listeners.forEach(listener -> listener.sliderMoved(value)); } sliderValues.put(sliderIndex, value); }
public synchronized double probability(final int x) { if (!cacheProbability.containsKey(x) && x >= getSupportLowerBound() && x <= getSupportUpperBound()) { cacheProbability.put(x, super.probability(x)); } return cacheProbability.get(x); } private TIntDoubleMap cacheCumulativeProbability = new TIntDoubleHashMap();
public synchronized double cumulativeProbability(final int x) { if (!cacheCumulativeProbability.containsKey(x) && x >= getSupportLowerBound() && x <= getSupportUpperBound()) { cacheCumulativeProbability.put(x, super.cumulativeProbability(x)); } return cacheCumulativeProbability.get(x); } private Double cacheNumericalMean;
@Override protected void prepareProcessInstance(V featureVector) { for(int it = featureVector.iter(); featureVector.iterValid(it); it = featureVector.iterAdvance(it)) { if(featureVector.iterDoubleValue(it) >= 0.) { final int dim = featureVector.iterDim(it); idf.put(dim, idf.get(dim) + 1); } } objcnt += 1; }
@Override protected V filterSingleObject(V featureVector) { TIntDoubleHashMap vals = new TIntDoubleHashMap(); for(int it = featureVector.iter(); featureVector.iterValid(it); it = featureVector.iterAdvance(it)) { final int dim = featureVector.iterDim(it); vals.put(dim, featureVector.iterDoubleValue(it) * idf.get(dim)); } return ((SparseNumberVector.Factory<V>) factory).newNumberVector(vals, featureVector.getDimensionality()); }