public static String toString(UnmodifiableEconomicMap<OptionKey<?>, Object> values) { Comparator<OptionKey<?>> comparator = new Comparator<OptionKey<?>>() { @Override public int compare(OptionKey<?> o1, OptionKey<?> o2) { return o1.getName().compareTo(o2.getName()); } }; SortedMap<OptionKey<?>, Object> sorted = new TreeMap<>(comparator); UnmodifiableMapCursor<OptionKey<?>, Object> cursor = values.getEntries(); while (cursor.advance()) { sorted.put(cursor.getKey(), decodeNull(cursor.getValue())); } return sorted.toString(); }
/** * Copies all of the mappings from {@code other} to this map. * * @since 1.0 */ default void putAll(UnmodifiableEconomicMap<? extends K, ? extends V> other) { UnmodifiableMapCursor<? extends K, ? extends V> entry = other.getEntries(); while (entry.advance()) { put(entry.getKey(), entry.getValue()); } }
/** * Copies all of the mappings from {@code other} to this map. * * @since 1.0 */ default void putAll(UnmodifiableEconomicMap<? extends K, ? extends V> other) { UnmodifiableMapCursor<? extends K, ? extends V> entry = other.getEntries(); while (entry.advance()) { put(entry.getKey(), entry.getValue()); } }
@Override protected Map<String, Object> createInitialOptions() { Map<String, Object> res = new HashMap<>(); UnmodifiableMapCursor<OptionKey<?>, Object> optionValues = RuntimeOptionValues.singleton().getMap().getEntries(); while (optionValues.advance()) { final OptionKey<?> key = optionValues.getKey(); Object value = optionValues.getValue(); if (value == null) { value = key.getDefaultValue(); } res.put(key.getName(), value); } return res; }
@Override public Map<String, Object> createInitialOptions() { final UnmodifiableMapCursor<OptionKey<?>, Object> optionValues = getOptions(OptionValues.class).getMap().getEntries(); Map<String, Object> res = new HashMap<>(); while (optionValues.advance()) { final OptionKey<?> key = optionValues.getKey(); Object value = optionValues.getValue(); if (value == null) { value = key.getDefaultValue(); } res.put(key.getName(), value); } return res; }
protected static void initMap(EconomicMap<OptionKey<?>, Object> map, UnmodifiableEconomicMap<OptionKey<?>, Object> values) { UnmodifiableMapCursor<OptionKey<?>, Object> cursor = values.getEntries(); while (cursor.advance()) { map.put(cursor.getKey(), encodeNull(cursor.getValue())); } }
public OptionValuesImpl( final OptionDescriptors descriptors, final UnmodifiableEconomicMap<OptionKey<?>, Object> values) { this.descriptors = descriptors; this.values = EconomicMap.create(); final UnmodifiableMapCursor<OptionKey<?>, Object> cursor = values.getEntries(); while (cursor.advance()) { this.values.put(cursor.getKey(), maskNull(cursor.getValue())); } }
/** * Updates this object with the key/value pairs in {@code values}. * * @see #UNSET_KEY */ public void update(UnmodifiableEconomicMap<OptionKey<?>, Object> values) { if (values.isEmpty()) { return; } UnmodifiableEconomicMap<OptionKey<?>, Object> expect; EconomicMap<OptionKey<?>, Object> newMap; do { expect = v.get(); newMap = EconomicMap.create(Equivalence.IDENTITY, expect); UnmodifiableMapCursor<OptionKey<?>, Object> cursor = values.getEntries(); while (cursor.advance()) { OptionKey<?> key = cursor.getKey(); Object value = cursor.getValue(); if (value == UNSET_KEY) { newMap.removeKey(key); } else { key.update(newMap, value); // Need to do the null encoding here as `key.update()` doesn't do it newMap.put(key, encodeNull(value)); } } } while (!v.compareAndSet(expect, newMap)); }
do { currentOptions = optionsRef.get(); UnmodifiableMapCursor<OptionKey<?>, Object> cursor = currentOptions.getMap().getEntries(); while (cursor.advance()) { OptionKey<?> key = cursor.getKey();
OptionValuesImpl( final OptionValuesImpl owner, final UnmodifiableEconomicMap<OptionKey<?>, Object> overrides) { this.descriptors = owner.descriptors; this.values = EconomicMap.create(); UnmodifiableMapCursor<OptionKey<?>, Object> cursor = owner.values.getEntries(); while (cursor.advance()) { this.values.put(cursor.getKey(), maskNull(cursor.getValue())); } cursor = overrides.getEntries(); while (cursor.advance()) { this.values.put(cursor.getKey(), maskNull(cursor.getValue())); } }
UnmodifiableMapCursor<ResolvedJavaMethod, InvocationPlugin> cursor = resolvedRegistrations.getEntries(); while (cursor.advance()) { ResolvedJavaMethod method = cursor.getKey();
newNodes.addAll(invokeGraph.getNewNodes(mark)); EconomicMap<NodeSourcePosition, NodeSourcePosition> posMap = EconomicMap.create(Equivalence.DEFAULT); UnmodifiableMapCursor<Node, Node> cursor = duplicates.getEntries(); ResolvedJavaMethod inlineeRoot = null; while (cursor.advance()) {