/** * copies the key/value mappings in <tt>map</tt> into this map. * * @param map a <code>Map</code> value */ public void putAll(Map<? extends K, ? extends V> map) { ensureCapacity(map.size()); // could optimize this for cases when map instanceof THashMap for (Map.Entry<? extends K, ? extends V> e : map.entrySet()) { put(e.getKey(), e.getValue()); } }
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { // VERSION byte version = in.readByte(); // NOTE: super was not written in version 0 if (version != 0) { super.readExternal(in); } // NUMBER OF ENTRIES int size = in.readInt(); setUp(size); // ENTRIES while (size-- > 0) { //noinspection unchecked K key = (K) in.readObject(); //noinspection unchecked V val = (V) in.readObject(); put(key, val); } } } // THashMap
@Override public V put(K key, V value) { return delegate.put(key, value); }
@Override public V put(K key, V value) { return delegate.put(key, value); }
/** * copies the key/value mappings in <tt>map</tt> into this map. * * @param map a <code>Map</code> value */ public void putAll(Map<? extends K, ? extends V> map) { ensureCapacity(map.size()); // could optimize this for cases when map instanceof THashMap for (Map.Entry<? extends K, ? extends V> e : map.entrySet()) { put(e.getKey(), e.getValue()); } }
private ExpandingPolytopeEntry[] getOrCreateTwoTriangleArray(THashMap<Point3D, ExpandingPolytopeEntry[]> mapFromStitchVertexToTriangles, Point3D sentryVertexOne) { ExpandingPolytopeEntry[] twoTriangleArray = mapFromStitchVertexToTriangles.get(sentryVertexOne); if (twoTriangleArray == null) { twoTriangleArray = new ExpandingPolytopeEntry[2]; mapFromStitchVertexToTriangles.put(sentryVertexOne, twoTriangleArray); } return twoTriangleArray; }
/** * copies the key/value mappings in <tt>map</tt> into this map. * * @param map a <code>Map</code> value */ public void putAll( Map<? extends K, ? extends V> map ) { ensureCapacity( map.size() ); // could optimize this for cases when map instanceof THashMap for ( Map.Entry<? extends K, ? extends V> e : map.entrySet() ) { put( e.getKey(), e.getValue() ); } }
/** * copies the key/value mappings in <tt>map</tt> into this map. * * @param map a <code>Map</code> value */ public void putAll(Map<? extends K, ? extends V> map) { ensureCapacity(map.size()); // could optimize this for cases when map instanceof THashMap for (Map.Entry<? extends K, ? extends V> e : map.entrySet()) { put(e.getKey(), e.getValue()); } }
/** * copies the key/value mappings in <tt>map</tt> into this map. * * @param map a <code>Map</code> value */ @Override public void putAll(Map<? extends K, ? extends V> map) { ensureCapacity(map.size()); // could optimize this for cases when map instanceof THashMap for (Map.Entry<? extends K, ? extends V> e : map.entrySet()) { put(e.getKey(), e.getValue()); } }
private void addToMap(THashMap<Point3D, ArrayList<ExpandingPolytopeEntry>> entriesContainingThisVertexMap, ExpandingPolytopeEntry entry) { for (int vertexIndex = 0; vertexIndex < 3; vertexIndex++) { Point3D vertex = entry.getVertex(vertexIndex); ArrayList<ExpandingPolytopeEntry> arrayList = entriesContainingThisVertexMap.get(vertex); if (arrayList == null) { arrayList = new ArrayList<>(); entriesContainingThisVertexMap.put(vertex, arrayList); } arrayList.add(entry); } } }
private void retainPoints(Point3D pointToKeep) { Point3D point3dOnA = simplexPointToPolytopePointA.get(pointToKeep); Point3D point3dOnB = simplexPointToPolytopePointB.get(pointToKeep); pointOne = null; pointTwo = null; pointThree = null; pointFour = null; pointOne = pointToKeep; simplexPointToPolytopePointA.clear(); simplexPointToPolytopePointB.clear(); simplexPointToPolytopePointA.put(pointToKeep, point3dOnA); simplexPointToPolytopePointB.put(pointToKeep, point3dOnB); }
private void retainPoints(Point3D pointToKeep1, Point3D pointToKeep2) { Point3D point3dOnA1 = simplexPointToPolytopePointA.get(pointToKeep1); Point3D point3dOnA2 = simplexPointToPolytopePointA.get(pointToKeep2); Point3D point3dOnB1 = simplexPointToPolytopePointB.get(pointToKeep1); Point3D point3dOnB2 = simplexPointToPolytopePointB.get(pointToKeep2); pointOne = null; pointTwo = null; pointThree = null; pointFour = null; pointOne = pointToKeep1; pointTwo = pointToKeep2; simplexPointToPolytopePointA.clear(); simplexPointToPolytopePointB.clear(); simplexPointToPolytopePointA.put(pointToKeep1, point3dOnA1); simplexPointToPolytopePointA.put(pointToKeep2, point3dOnA2); simplexPointToPolytopePointB.put(pointToKeep1, point3dOnB1); simplexPointToPolytopePointB.put(pointToKeep2, point3dOnB2); }
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { // VERSION byte version = in.readByte(); // NOTE: super was not written in version 0 if (version != 0) { super.readExternal(in); } // NUMBER OF ENTRIES int size = in.readInt(); setUp(size); // ENTRIES while (size-- > 0) { //noinspection unchecked K key = (K) in.readObject(); //noinspection unchecked V val = (V) in.readObject(); put(key, val); } } } // THashMap
@Override public void configure(JobConf job) { super.configure(job); try { @SuppressWarnings("deprecation") SequenceFile.Reader reader = new SequenceFile.Reader(FileSystem.getLocal(job), new Path("redirs.dat"), job); Text source = new Text(); Text target = new Text(); while (reader.next(source, target)) { redirects.put(source.toString(), target.toString()); } reader.close(); } catch (IOException e) { e.printStackTrace(); redirects.clear(); return; } }
protected void addToCache(WEntry<K,V> entry) { if (cachePriority == CachePriority.speed) { fastCache.put(entry.getKey(), entry.getValue()) ; } else { DatabaseEntry cacheValue = new DatabaseEntry() ; valueBinding.objectToEntry(entry.getValue(), cacheValue) ; compactCache.put(entry.getKey(), cacheValue.getData()) ; } }
/** * Term from a phrase, beyond the first term. If this is the last term, it indicates a * match, otherwise it does not, and the children must be constructed. * @param entries the entries * @param i the location in the list. * @param n dict names. */ GazEntry(String[] entries, int i, DictionaryNames n) { if (entries.length == i) { addMatch(n); requiredChildren = null; } else { // this is a new phrase, not just a term, so not a match names = null; // add the children requiredChildren = new THashMap<>(); requiredChildren.put(entries[i], new GazEntry(entries, i + 1, n)); } }
/** * Term from a phrase, beyond the first term. If this is the last term, it indicates a * match, otherwise it does not, and the children must be constructed. */ GazEntry(String[] entries, int i, DictionaryNames n) { if (entries.length == i) { addMatch(n); requiredChildren = null; } else { // this is a new phrase, not just a term, so not a match names = null; // add the children requiredChildren = new THashMap<>(); requiredChildren.put(entries[i], new GazEntry(entries, i + 1, n)); } }
/** * Term from a phrase, beyond the first term. If this is the last term, it indicates a * match, otherwise it does not, and the children must be constructed. * * @param entries the */ GazEntry(String[] entries, int i, String n) { if (entries.length == i) { addMatch(n); requiredChildren = null; } else { // this is a new phrase, not just a term, so not a match names = null; // add the children requiredChildren = new THashMap<>(); requiredChildren.put(entries[i], new GazEntry(entries, i + 1, n)); } }
/** * Term from a phrase, beyond the first term. If this is the last term, it indicates a * match, otherwise it does not, and the children must be constructed. * * @param entries the */ GazEntry(String[] entries, int i, String n) { if (entries.length == i) { addMatch(n); requiredChildren = null; } else { // this is a new phrase, not just a term, so not a match names = null; // add the children requiredChildren = new THashMap<>(); requiredChildren.put(entries[i], new GazEntry(entries, i + 1, n)); } }
/** * provided with the split phrase, either make the new terminal leaf entry with match true, * or make the entry with match not true, and children. The first term passed in is the key, * so we won't store it here, but if there are subsequent terms, we need to construct a tree * path. */ GazEntry(String[] entries, DictionaryNames n) { if (entries.length == 1) { // This is a single term, so there is a match at this node addMatch(n); requiredChildren = null; } else { // this is a new phrase, not just a term, since this is the // first word, it is not a match. names = null; // add the children requiredChildren = new THashMap<>(); requiredChildren.put(entries[1], new GazEntry(entries, 2, n)); } }