public int put( long key, int value ) { synchronized( mutex ) { return m.put( key, value ); } } public int remove( long key ) {
/** * Inserts a key/value pair into the map. * * @param key an <code>Object</code> value * @param value an <code>Object</code> value * @return the previous value associated with <tt>key</tt>, * or Integer(0) if none was found. */ public Integer put( Long key, Integer value ) { long k; int v; if ( key == null ) { k = _map.getNoEntryKey(); } else { k = unwrapKey( key ); } if ( value == null ) { v = _map.getNoEntryValue(); } else { v = unwrapValue( value ); } int retval = _map.put( k, v ); if ( retval == _map.getNoEntryValue() ) { return null; } return wrapValue( retval ); }
@Override public int put( long key, int value ) { synchronized( mutex ) { return m.put( key, value ); } } @Override
public int put( long key, int value ) { synchronized( mutex ) { return m.put( key, value ); } } public int remove( long key ) {
public int put( long key, int value ) { synchronized( mutex ) { return m.put( key, value ); } } public int remove( long key ) {
public int put( long key, int value ) { synchronized( mutex ) { return m.put( key, value ); } } public int remove( long key ) {
@Override public void handle(Relation rel) { if("associatedStreet".equals(rel.tags.get("type"))) { if(indexFilled) { buildAssociatedStreet(rel); } else { for(RelationMember m : rel.members) { if(m.type == ReferenceType.WAY && ("street".equals(m.role) || !("house".equals(m.role)))) { w2n.put(m.ref, -1); } } } } }
/** * Counts the pair of objects, increasing its total count by 1. */ public int count(T x, T y) { long index = getIndex(x, y); int count = counts.get(index); count++; counts.put(index, count); sum++; return count; }
/** * Counts the pair of objects, increasing its total count by 1. */ public int count(Pair<T> obj) { long index = getIndex(obj); int count = counts.get(index); count++; counts.put(index, count); sum++; return count; }
/** * Counts the pair of objects, increasing its total count by 1. */ public int count(T x, T y) { long index = getIndex(x, y); int count = counts.get(index); count++; counts.put(index, count); sum++; return count; }
/** * Counts the pair of objects, increasing its total count by 1. */ public int count(Pair<T> obj) { long index = getIndex(obj); int count = counts.get(index); count++; counts.put(index, count); sum++; return count; }
/** * Counts the pair, increasing its total count by the specified positive amount. * * @param count a positive value for the number of times the object occurred * * @throws IllegalArgumentException if {@code count} is not a positive value. */ public int count(Pair<T> obj, int count) { if (count < 1) throw new IllegalArgumentException("Count must be positive: " + count); long index = getIndex(obj); int oldCount = counts.get(index); int newCount = count + oldCount; counts.put(index, newCount); sum += count; return newCount; }
/** * Counts the pair, increasing its total count by the specified positive amount. * * @param count a positive value for the number of times the object occurred * * @throws IllegalArgumentException if {@code count} is not a positive value. */ public int count(T x, T y, int count) { if (count < 1) throw new IllegalArgumentException("Count must be positive: " + count); long index = getIndex(x, y); int oldCount = counts.get(index); int newCount = count + oldCount; counts.put(index, newCount); sum += count; return newCount; }
/** * Counts the pair, increasing its total count by the specified positive amount. * * @param count a positive value for the number of times the object occurred * * @throws IllegalArgumentException if {@code count} is not a positive value. */ public int count(T x, T y, int count) { if (count < 1) throw new IllegalArgumentException("Count must be positive: " + count); long index = getIndex(x, y); int oldCount = counts.get(index); int newCount = count + oldCount; counts.put(index, newCount); sum += count; return newCount; }
/** * Counts the pair, increasing its total count by the specified positive amount. * * @param count a positive value for the number of times the object occurred * * @throws IllegalArgumentException if {@code count} is not a positive value. */ public int count(Pair<T> obj, int count) { if (count < 1) throw new IllegalArgumentException("Count must be positive: " + count); long index = getIndex(obj); int oldCount = counts.get(index); int newCount = count + oldCount; counts.put(index, newCount); sum += count; return newCount; }
@Override public void handleHighway(LineString geometry, Way way) { if(w2n.containsKey(way.id)) { Envelope env = geometry.getEnvelopeInternal(); short n = new Double((env.getMinX() + 180.0) * 10.0).shortValue(); int fromto = n << 16; n = new Double((env.getMaxX() + 180.0) * 10.0).shortValue(); fromto |= n; w2n.put(way.id, fromto); } highwaysHandler.handleHighway(geometry, way); }
@Override public final boolean add(Long key) { if (isFilter()) { throw new IndexException("Cannot add keys to an filter on another index"); } else { if (indexMap.containsKey(key)) { return false; } else { final int index = indexMap.size(); this.ensureCapacity(index + 1); this.keyArray().setValue(index, key); this.indexMap.put(key, index); return true; } } }
@Override public final int replace(Long existing, Long replacement) { final int index = indexMap.remove(existing); if (index == -1) { throw new IndexException("No match for key: " + existing); } else { if (indexMap.containsKey(replacement)) { throw new IndexException("The replacement key already exists: " + replacement); } else { final int ordinal = getOrdinalForIndex(index); this.indexMap.put(replacement, index); this.keyArray().setValue(ordinal, replacement); return index; } } }
@Override public final boolean add(T key) { if (isFilter()) { throw new IndexException("Cannot add keys to a filter on another index"); } else { final long code = coding.getCode(key); if (indexMap.containsKey(code)) { return false; } else { final int index = indexMap.size(); this.ensureCapacity(index + 1); this.keyArray().setValue(index, key); this.indexMap.put(code, index); return true; } } }
/** * Constructor * @param iterable the keys for index */ IndexOfLongs(Iterable<Long> iterable) { super(iterable); this.indexMap = new TLongIntHashMap(keyArray().length(), 0.75f, -1, -1); this.keyArray().sequential().forEachValue(v -> { final int index = v.index(); final long key = v.getLong(); final int existing = indexMap.put(key, index); if (existing >= 0) { throw new IndexException("Cannot have duplicate keys in index: " + v.getValue()); } }); }