@Override public Set<String> getTagValues(String tag) { return tags.get(tag); }
@Override public Iterable<TitanVertexProperty> get(final Object value, final PropertyKey key) { return Iterables.filter(map.get(value),new Predicate<TitanVertexProperty>() { @Override public boolean apply(@Nullable TitanVertexProperty titanProperty) { return titanProperty.propertyKey().equals(key); } }); } }
@Override public synchronized Iterable<TitanVertexProperty> get(final Object value, final PropertyKey key) { List<TitanVertexProperty> result = new ArrayList<TitanVertexProperty>(4); for (TitanVertexProperty p : map.get(value)) { if (p.propertyKey().equals(key)) result.add(p); } return result; } }
void putIfWorkExists(Operator<?> opToAdd, Operator<?> existingOp) { List<Operator<?>> c = ImmutableList.copyOf(operatorToWorkOperators.get(existingOp)); if (!c.isEmpty()) { for (Operator<?> op : c) { operatorToWorkOperators.get(op).add(opToAdd); } operatorToWorkOperators.putAll(opToAdd, c); operatorToWorkOperators.put(opToAdd, opToAdd); } }
@Override public Iterable<JanusGraphVertexProperty> get(final Object value, final PropertyKey key) { return Iterables.filter(map.get(value), janusgraphProperty -> janusgraphProperty.propertyKey().equals(key)); } }
@Override public synchronized Iterable<JanusGraphVertexProperty> get(final Object value, final PropertyKey key) { final List<JanusGraphVertexProperty> result = new ArrayList<>(4); for (JanusGraphVertexProperty p : map.get(value)) { if (p.propertyKey().equals(key)) result.add(p); } return result; } }
void removeOp(Operator<?> opToRemove) { Set<Operator<?>> s = operatorToWorkOperators.get(opToRemove); s.remove(opToRemove); List<Operator<?>> c1 = ImmutableList.copyOf(s); if (!c1.isEmpty()) { for (Operator<?> op1 : c1) { operatorToWorkOperators.remove(op1, opToRemove); // Remove operator } operatorToWorkOperators.removeAll(opToRemove); // Remove entry for operator } }
private static Set<Operator<?>> findWorkOperators( SharedWorkOptimizerCache optimizerCache, Operator<?> start) { Set<Operator<?>> c = optimizerCache.operatorToWorkOperators.get(start); if (!c.isEmpty()) { return c; } c = findWorkOperators(start, new HashSet<Operator<?>>()); for (Operator<?> op : c) { optimizerCache.operatorToWorkOperators.putAll(op, c); } return c; }
@Override protected boolean hasPermissionImpl(OrganizationPermission permission, String organizationUuid) { return permissionsByOrganizationUuid.get(organizationUuid).contains(permission); }
void removeOpAndCombineWork(Operator<?> opToRemove, Operator<?> replacementOp) { Set<Operator<?>> s = operatorToWorkOperators.get(opToRemove); s.remove(opToRemove); List<Operator<?>> c1 = ImmutableList.copyOf(s); List<Operator<?>> c2 = ImmutableList.copyOf(operatorToWorkOperators.get(replacementOp)); if (!c1.isEmpty() && !c2.isEmpty()) { for (Operator<?> op1 : c1) { operatorToWorkOperators.remove(op1, opToRemove); // Remove operator operatorToWorkOperators.putAll(op1, c2); // Add ops of new collection } operatorToWorkOperators.removeAll(opToRemove); // Remove entry for operator for (Operator<?> op2 : c2) { operatorToWorkOperators.putAll(op2, c1); // Add ops to existing collection } } }
@Override protected boolean hasProjectUuidPermission(String permission, String projectUuid) { return projectPermissions.contains(permission) && projectUuidByPermission.get(permission).contains(projectUuid); }
public static Map<TblColRef, Dictionary<String>> buildDictionary(final CubeInstance cubeInstance, Iterable<List<String>> recordList) throws IOException { final List<TblColRef> columnsNeedToBuildDictionary = cubeInstance.getDescriptor() .listDimensionColumnsExcludingDerived(true); final HashMap<Integer, TblColRef> tblColRefMap = Maps.newHashMap(); int index = 0; for (TblColRef column : columnsNeedToBuildDictionary) { tblColRefMap.put(index++, column); } HashMap<TblColRef, Dictionary<String>> result = Maps.newHashMap(); HashMultimap<TblColRef, String> valueMap = HashMultimap.create(); for (List<String> row : recordList) { for (int i = 0; i < row.size(); i++) { String cell = row.get(i); if (tblColRefMap.containsKey(i)) { valueMap.put(tblColRefMap.get(i), cell); } } } for (TblColRef tblColRef : valueMap.keySet()) { Set<String> values = valueMap.get(tblColRef); Dictionary<String> dict = DictionaryGenerator.buildDictionary(tblColRef.getType(), new IterableDictionaryValueEnumerator(values)); result.put(tblColRef, dict); } return result; }
public void testCreateFromSizes() { HashMultimap<String, Integer> multimap = HashMultimap.create(20, 15); multimap.put("foo", 1); multimap.put("bar", 2); multimap.put("foo", 3); assertEquals(ImmutableSet.of(1, 3), multimap.get("foo")); assertEquals(15, multimap.expectedValuesPerKey); }
public void testCreate() { HashMultimap<String, Integer> multimap = HashMultimap.create(); multimap.put("foo", 1); multimap.put("bar", 2); multimap.put("foo", 3); assertEquals(ImmutableSet.of(1, 3), multimap.get("foo")); assertEquals(2, multimap.expectedValuesPerKey); }
sb.append("' and ("); Set<String> values = filterTags.get(tag); boolean firstValue = true; for (String value : values)
public Set<V> get(K key) { return innerCache.get(key); }
/** * Process a block mlock event from the FsDatasetCache. * * @param blockId The block that was mlocked. */ public synchronized void processBlockMlockEvent(ExtendedBlockId blockId) { if (!enabled) return; Set<Slot> affectedSlots = slots.get(blockId); for (Slot slot : affectedSlots) { slot.makeAnchorable(); } }
public synchronized String getClientNames(ExtendedBlockId blockId) { if (!enabled) return ""; final HashSet<String> clientNames = new HashSet<String>(); final Set<Slot> affectedSlots = slots.get(blockId); for (Slot slot : affectedSlots) { clientNames.add(((RegisteredShm)slot.getShm()).getClientName()); } return Joiner.on(",").join(clientNames); }
/** * Invalidate any slot associated with a blockId that we are invalidating * (deleting) from this DataNode. When a slot is invalid, the DFSClient will * not use the corresponding replica for new read or mmap operations (although * existing, ongoing read or mmap operations will complete.) * * @param blockId The block ID. */ public synchronized void processBlockInvalidation(ExtendedBlockId blockId) { if (!enabled) return; final Set<Slot> affectedSlots = slots.get(blockId); if (!affectedSlots.isEmpty()) { final StringBuilder bld = new StringBuilder(); String prefix = ""; bld.append("Block ").append(blockId).append(" has been invalidated. "). append("Marking short-circuit slots as invalid: "); for (Slot slot : affectedSlots) { slot.makeInvalid(); bld.append(prefix).append(slot.toString()); prefix = ", "; } LOG.info(bld.toString()); } }
/** * Mark any slots associated with this blockId as unanchorable. * * @param blockId The block ID. * @return True if we should allow the munlock request. */ public synchronized boolean processBlockMunlockRequest( ExtendedBlockId blockId) { if (!enabled) return true; boolean allowMunlock = true; Set<Slot> affectedSlots = slots.get(blockId); for (Slot slot : affectedSlots) { slot.makeUnanchorable(); if (slot.isAnchored()) { allowMunlock = false; } } return allowMunlock; }