private TIntLongHashMap readPoiNameIndex(Collator instance, String query, SearchRequest<Amenity> req) throws IOException { TIntLongHashMap offsets = new TIntLongHashMap(); TIntArrayList dataOffsets = null; int offset = 0;
protected void searchPoiByName(PoiRegion region, SearchRequest<Amenity> req) throws IOException { TIntLongHashMap offsets = new TIntLongHashMap(); String query = normalizeSearchPoiByNameQuery(req.nameQuery); CollatorStringMatcher matcher = new CollatorStringMatcher(query,
TIntLongHashMap offsetsMap = new TIntLongHashMap(); while (true) { if (req.isCancelled()) {
TIntLongHashMap mp = new TIntLongHashMap(); for (int j = 0; j < list.size(); j++) { mp.put(list.get(j), listContainer.get(j));
/** * Constructor * @param length the length for this array * @param defaultValue the default value for array */ SparseArrayOfLongs(int length, Long defaultValue) { super(Long.class, ArrayStyle.SPARSE, false); this.length = length; this.defaultValue = defaultValue != null ? defaultValue : 0L; this.values = new TIntLongHashMap((int)Math.max(length * 0.5, 10d), 0.8f, -1, this.defaultValue); }
/** * Construct the array with the given length and capacity for non-zero elements * @param length the length * @param capacity the capacity */ public SparseHashedLongArray(int length, int capacity) { if (length < 0) throw new IllegalArgumentException("length must be >= 0"); if (capacity <= 0) throw new IllegalArgumentException("capacity must be > 0"); this.length = length; this.data = new TIntLongHashMap(capacity); }
/** * Construct the array with the given length and expected density * @param length the length * @param density the density */ public SparseHashedLongArray(int length, float density) { if (length < 0) throw new IllegalArgumentException("length must be >= 0"); if (density <= 0 || density > 1) throw new IllegalArgumentException("density must be > 0 and < 1"); this.length = length; int capacity = (int) (density * length); this.data = new TIntLongHashMap(capacity); }
@Override public SparseLongArray copy() { SparseHashedLongArray copy = new SparseHashedLongArray(length); copy.data = new TIntLongHashMap(data); return copy; }
@Override() public final Array<Long> copy() { try { final SparseArrayOfLongs copy = (SparseArrayOfLongs)super.clone(); copy.values = new TIntLongHashMap(values); copy.defaultValue = this.defaultValue; return copy; } catch (Exception ex) { throw new ArrayException("Failed to copy Array: " + this, ex); } }
@Override public void add(long value, int f0, int f1, int f2, int f3) { if (values[f0][f1][f2] == null) values[f0][f1][f2] = new TIntLongHashMap(); values[f0][f1][f2].adjustOrPutValue(f3, value, value); }
TIntLongMap myMap = new TIntLongHashMap(); TIntLongMap myUnmodifiableMap = TCollections.unmodifiableMap(myMap); myUnmodifiableMap.put(1, 2L); // throws UnsupportedOperationException
public DBMolecularFormulaCache(ChemicalAlphabet alphabet, Databases database) { this(new TIntLongHashMap(), new MolecularFormulaSet(alphabet), database); }
@Override() @SuppressWarnings("unchecked") public final Array<T> copy() { try { final SparseArrayWithLongCoding<T> copy = (SparseArrayWithLongCoding<T>)super.clone(); copy.codes = new TIntLongHashMap(codes); copy.defaultValue = this.defaultValue; copy.defaultCode = this.defaultCode; copy.coding = this.coding; return copy; } catch (Exception ex) { throw new ArrayException("Failed to copy Array: " + this, ex); } }
/** * Constructor * @param length the length for this array */ SparseArrayOfZonedDateTimes(int length, ZonedDateTime defaultValue) { super(ZonedDateTime.class, ArrayStyle.SPARSE, false); this.length = length; this.defaultValue = defaultValue; this.defaultValueAsLong = defaultValue != null ? defaultValue.toInstant().toEpochMilli() : nullValue; this.defaultZoneId = defaultValue != null ? zoneIdMap1.get(defaultValue.getZone()) : NULL_ZONE; this.values = new TIntLongHashMap((int)Math.max(length * 0.5, 10d), 0.8f, -1, defaultValueAsLong); this.zoneIds = new TIntShortHashMap((int)Math.max(length * 0.5, 10d), 0.8f, -1, defaultZoneId); }
@Override() public final Array<ZonedDateTime> copy() { try { final SparseArrayOfZonedDateTimes copy = (SparseArrayOfZonedDateTimes)super.clone(); copy.values = new TIntLongHashMap(values); copy.zoneIds = new TIntShortHashMap(zoneIds); copy.defaultValue = this.defaultValue; copy.defaultValueAsLong = this.defaultValueAsLong; return copy; } catch (Exception ex) { throw new ArrayException("Failed to copy Array: " + this, ex); } }
/** * Constructor * @param length the length for this array * @param defaultValue the default value for array * @param coding the coding for this array */ SparseArrayWithLongCoding(int length, T defaultValue, LongCoding<T> coding) { super(coding.getType(), ArrayStyle.SPARSE, false); this.length = length; this.coding = coding; this.defaultValue = defaultValue; this.defaultCode = coding.getCode(defaultValue); this.codes = new TIntLongHashMap((int)Math.max(length * 0.5, 10d), 0.8f, -1, defaultCode); }
private TIntLongMap getEdgeIdToOsmWayIdMap() { if (edgeIdToOsmWayIdMap == null) edgeIdToOsmWayIdMap = new TIntLongHashMap(getOsmWayIdSet().size(), 0.5f, -1, -1); return edgeIdToOsmWayIdMap; }
public static DBMolecularFormulaCache load(final InputStream stream) throws IOException { final BufferedInputStream buffered = (stream instanceof BufferedInputStream) ? (BufferedInputStream)stream : new BufferedInputStream(stream); final DataInputStream instream = new DataInputStream(buffered); final Databases database = Databases.valueOf(instream.readUTF()); final int entries = instream.readInt(); final TIntLongHashMap bitset = new TIntLongHashMap(entries); for (int k=0; k < entries; ++k) { final int key = instream.readInt(); final long value = instream.readLong(); bitset.put(key, value); } final MolecularFormulaSet set = MolecularFormulaSet.load(instream); return new DBMolecularFormulaCache(bitset, set, database); }
@Override public SparseLongArray reverse() { //TODO: this could be more efficient and avoid the copy TIntLongHashMap tmp = new TIntLongHashMap(data.size()); for (Entry e : entries()) tmp.put(length - e.index, e.value); this.data = tmp; return this; } }
/** * Make a new builder. * * @param cacheSize the size of the cache */ public ScriptBuilder(final int cacheSize, Model mo) { this.model = mo; namingServiceNodes = NamingService.getNodeNames(mo); if (namingServiceNodes == null) { namingServiceNodes = NamingService.newNodeNS(); mo.attach(namingServiceNodes); } namingServiceVMs = NamingService.getVMNames(mo); if (namingServiceVMs == null) { namingServiceVMs = NamingService.newVMNS(); mo.attach(namingServiceVMs); } catalog = DefaultConstraintsCatalog.newBundle(); this.tpls = new MockTemplateFactory(mo); this.dates = new TIntLongHashMap(); this.includes = new PathBasedIncludes(this); this.cache = new LinkedHashMap<String, Script>() { @Override protected boolean removeEldestEntry(Map.Entry<String, Script> foo) { return size() == cacheSize; } }; }