Refine search
@Override Cell<R, C, V> getCell(int index) { int rowIndex = cellRowIndices[index]; Entry<R, ImmutableMap<C, V>> rowEntry = rowMap.entrySet().asList().get(rowIndex); ImmutableMap<C, V> row = rowEntry.getValue(); int columnIndex = cellColumnInRowIndices[index]; Entry<C, V> colEntry = row.entrySet().asList().get(columnIndex); return cellOf(rowEntry.getKey(), colEntry.getKey(), colEntry.getValue()); }
@Override Cell<R, C, V> getCell(int index) { int rowIndex = cellRowIndices[index]; Entry<R, ImmutableMap<C, V>> rowEntry = rowMap.entrySet().asList().get(rowIndex); ImmutableMap<C, V> row = rowEntry.getValue(); int columnIndex = cellColumnInRowIndices[index]; Entry<C, V> colEntry = row.entrySet().asList().get(columnIndex); return cellOf(rowEntry.getKey(), colEntry.getKey(), colEntry.getValue()); }
/** * @param value a nullness value * @return all access paths in this store that have the given nullness value */ public Set<AccessPath> getAccessPathsWithValue(Nullness value) { Set<AccessPath> result = new LinkedHashSet<>(); for (Map.Entry<AccessPath, Nullness> entry : contents.entrySet()) { if (value.equals(entry.getValue())) { result.add(entry.getKey()); } } return result; }
private HashMap<String, String> createRemapping( ImmutableMap<Class<?>, Class<?>> classRemapping, String specializedClassName ) { HashMap<String, String> remapping = new HashMap<>(); remapping.put(prototypeClassBytecodeName, classBytecodeName(specializedClassName)); for (Map.Entry<Class<?>, Class<?>> classRemappingEntry : classRemapping.entrySet()) { Class<?> sourceClass = classRemappingEntry.getKey(); Class<?> remappingClass = classRemappingEntry.getValue(); remapping.put(classBytecodeName(sourceClass.getName()), classBytecodeName(remappingClass.getName())); } return remapping; }
private String vectorToString(double[] vector) { List<String> tokens = Lists.newArrayListWithCapacity(this.dimensionIndex.size()); for (Map.Entry<String, Integer> dimension : dimensionIndex.entrySet()) { tokens.add(dimension.getKey() + ": " + vector[dimension.getValue()]); } return Arrays.toString(tokens.toArray()); }
private Options buildExpectedOptions() { final Options options = new Options(); for (final Map.Entry<String, String> entry : OPTIONS_MAP.entrySet()) { final Option option = Option.builder(null).required(true).longOpt(entry.getKey()).desc(entry.getValue()).hasArg().build(); options.addOption(option); } return options; }
/** * Returns true if any of the options in {@code options} matches both of the regular expressions * provided: its name matches the option's name and its value matches the option's value. */ public boolean optionMatches(String namePattern, String valuePattern) { Matcher nameMatcher = Pattern.compile(namePattern).matcher(""); Matcher valueMatcher = Pattern.compile(valuePattern).matcher(""); for (Map.Entry<ProtoMember, Object> entry : map.entrySet()) { if (nameMatcher.reset(entry.getKey().member()).matches() && valueMatcher.reset(String.valueOf(entry.getValue())).matches()) { return true; } } return false; }
@Override Cell<R, C, V> getCell(int index) { int rowIndex = cellRowIndices[index]; Entry<R, ImmutableMap<C, V>> rowEntry = rowMap.entrySet().asList().get(rowIndex); ImmutableMap<C, V> row = rowEntry.getValue(); int columnIndex = cellColumnInRowIndices[index]; Entry<C, V> colEntry = row.entrySet().asList().get(columnIndex); return cellOf(rowEntry.getKey(), colEntry.getKey(), colEntry.getValue()); }
@Override protected void doInitialize(InjectorImpl injector, Errors errors) { ImmutableMap.Builder<K, Provider<V>> mapOfProvidersBuilder = ImmutableMap.builder(); ImmutableSet.Builder<Dependency<?>> dependenciesBuilder = ImmutableSet.builder(); for (Map.Entry<K, Binding<V>> entry : bindingSelection.getMapBindings().entrySet()) { mapOfProvidersBuilder.put(entry.getKey(), entry.getValue().getProvider()); dependenciesBuilder.add(Dependency.get(getKeyOfProvider(entry.getValue().getKey()))); } mapOfProviders = mapOfProvidersBuilder.build(); dependencies = dependenciesBuilder.build(); }
@SuppressWarnings("ReferenceEquality") public Set<String> getInvalidatedClasses(ShadowMap previous) { if (this == previous && shadowPickers.isEmpty()) return Collections.emptySet(); Map<String, ShadowInfo> invalidated = new HashMap<>(overriddenShadows); for (Map.Entry<String, ShadowInfo> entry : previous.overriddenShadows.entrySet()) { String className = entry.getKey(); ShadowInfo previousConfig = entry.getValue(); ShadowInfo currentConfig = invalidated.get(className); if (currentConfig == null) { invalidated.put(className, previousConfig); } else if (previousConfig.equals(currentConfig)) { invalidated.remove(className); } } HashSet<String> classNames = new HashSet<>(invalidated.keySet()); classNames.addAll(shadowPickers.keySet()); return classNames; }
/** * @param pred predicate over {@link AccessPath}s * @return NullnessStore containing only AccessPaths that pass the predicate */ public NullnessStore filterAccessPaths(Predicate<AccessPath> pred) { return new NullnessStore( contents .entrySet() .stream() .filter(e -> pred.test(e.getKey())) .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue))); }
/** * @return A manager with basic adapters for wrapped primitives and {@link String} */ @SuppressWarnings("unchecked") public static ParameterAdapterManager createBasic() { ParameterAdapterManager manager = new ParameterAdapterManager(); for (Map.Entry<Class, ParameterAdapter> entry : PrimitiveAdapters.MAP.entrySet()) { manager.registerAdapter(entry.getKey(), entry.getValue()); } return manager; }