@Override protected Int2ObjectMap<OutEdges<IntWritable, E>> getPartitionEdges( int partitionId) { Int2ObjectMap<OutEdges<IntWritable, E>> partitionEdges = (Int2ObjectMap<OutEdges<IntWritable, E>>) transientEdges.get(partitionId); if (partitionEdges == null) { Int2ObjectMap<OutEdges<IntWritable, E>> newPartitionEdges = Int2ObjectMaps.synchronize( new Int2ObjectOpenHashMap<OutEdges<IntWritable, E>>()); partitionEdges = (Int2ObjectMap<OutEdges<IntWritable, E>>) transientEdges.putIfAbsent(partitionId, newPartitionEdges); if (partitionEdges == null) { partitionEdges = newPartitionEdges; } } return partitionEdges; }
/** * Returns a hash code for this map. * * The hash code of a map is computed by summing the hash codes of its entries. * * @return a hash code for this map. */ @Override public int hashCode() { int h = 0, n = size(); final ObjectIterator<Int2ObjectMap.Entry<V>> i = Int2ObjectMaps.fastIterator(this); while (n-- != 0) h += i.next().hashCode(); return h; } @Override
public DncGeosymTextStyle(Font font, int colorCode, String prefix, String suffix, Int2ObjectMap<String> abbrevs) { this.font = font; this.colorCode = colorCode; this.prefix = prefix; this.suffix = suffix; this.abbrevs = (abbrevs == null ? null : unmodifiable(new Int2ObjectOpenHashMap<String>(abbrevs))); }
public FidelDecoderWrapper(IntegerLanguageModel languageModel, DecoderWeights weights) { this.languageModel = languageModel; this.srcWordMap = Object2IntMaps.synchronize(new Object2IntOpenHashMap<String>()); this.srcInvMap = Int2ObjectMaps.synchronize(new Int2ObjectOpenHashMap<String>()); this.trgWordMap = languageModel.wordMap(); this.invWordMap = languageModel.invWordMap(); this.weights = weights; }
this.geosymAssignments = Int2ObjectMaps.unmodifiable( readDncSymbolAssignments( config.geosymAssignmentsFilename ) );
@Override public String toString() { final StringBuilder s = new StringBuilder(); final ObjectIterator<Int2ObjectMap.Entry<V>> i = Int2ObjectMaps.fastIterator(this); int n = size(); Int2ObjectMap.Entry<V> e; boolean first = true; s.append("{"); while (n-- != 0) { if (first) first = false; else s.append(", "); e = i.next(); s.append(String.valueOf(e.getIntKey())); s.append("=>"); if (this == e.getValue()) s.append("(this map)"); else s.append(String.valueOf(e.getValue())); } s.append("}"); return s.toString(); } }
public QueryDatabase( File flatDir, DncProjection proj, ExecutorService exec ) throws IOException { this.flatDir = flatDir; this.proj = proj; this.exec = exec; this.charset = readFlatCharset( flatDir ); this.fcodeNames = Int2ObjectMaps.unmodifiable( readFlatFcodeNames( flatDir, charset ) ); this.attrNames = Int2ObjectMaps.unmodifiable( readFlatAttrNames( flatDir, charset ) ); this.flatLibraryNums = Object2IntMaps.unmodifiable( invertIdsMap( readFlatLibraryNames( flatDir, charset ) ) ); this.flatCoverageNums = Object2IntMaps.unmodifiable( invertIdsMap( readFlatCoverageNames( flatDir, charset ) ) ); this.bufMutex = new Object( ); this.featuresBufMasters = unmodifiableMap( readFlatChunks( flatDir ) ); this.ringsBufMaster = memmapFlatRingsBuf( flatDir ); this.verticesBufMaster = memmapFlatVerticesBuf( flatDir ); this.attrsBufMaster = memmapFlatAttrsBuf( flatDir ); this.stringsBufMaster = memmapFlatStringsBuf( flatDir ); }
/** {@inheritDoc} */ @SuppressWarnings({"unchecked", "deprecation"}) @Override public void putAll(final Map<? extends Integer, ? extends V> m) { if (m instanceof Int2ObjectMap) { ObjectIterator<Int2ObjectMap.Entry<V>> i = Int2ObjectMaps.fastIterator((Int2ObjectMap<V>) m); while (i.hasNext()) { final Int2ObjectMap.Entry<? extends V> e = i.next(); put(e.getIntKey(), e.getValue()); } } else { int n = m.size(); final Iterator<? extends Map.Entry<? extends Integer, ? extends V>> i = m.entrySet().iterator(); Map.Entry<? extends Integer, ? extends V> e; while (n-- != 0) { e = i.next(); put(e.getKey(), e.getValue()); } } } /**
public TransitionalDatabase( File flatDir, DncProjection proj, ListMultimap<String,DncGeosymAssignment> geosymAssignments, Function<String,Object> externalAttrs ) throws IOException { this.flatDir = flatDir; this.proj = proj; this.geosymAssignments = geosymAssignments; this.externalAttrs = externalAttrs; this.charset = readFlatCharset( flatDir ); this.fcodeNames = Int2ObjectMaps.unmodifiable( readFlatFcodeNames( flatDir, charset ) ); this.attrNames = Int2ObjectMaps.unmodifiable( readFlatAttrNames( flatDir, charset ) ); this.flatLibraryNums = Object2IntMaps.unmodifiable( invertIdsMap( readFlatLibraryNames( flatDir, charset ) ) ); this.flatCoverageNums = Object2IntMaps.unmodifiable( invertIdsMap( readFlatCoverageNames( flatDir, charset ) ) ); this.bufMutex = new Object( ); this.featuresBufMasters = unmodifiableMap( readFlatChunks( flatDir ) ); this.ringsBufMaster = memmapFlatRingsBuf( flatDir ); this.verticesBufMaster = memmapFlatVerticesBuf( flatDir ); this.attrsBufMaster = memmapFlatAttrsBuf( flatDir ); this.stringsBufMaster = memmapFlatStringsBuf( flatDir ); }