/** * Create a new aggregating map expression using a backing LinkedHashMap * * @param key key for the map entries * @param value value for the map entries * @return wrapper expression */ public static <K, V> AbstractGroupExpression<Pair<K, V>,Map<K, V>> map(Expression<K> key, Expression<V> value) { return GMap.createLinked(QPair.create(key, value)); }
public static <K, V> QPair<K, V> create(Expression<K> key, Expression<V> value) { return new QPair<K, V>(key, value); }
@Override @SuppressWarnings("unchecked") public <K, V> Map<K, V> getMap(Expression<K> key, Expression<V> value) { for (QPair<?, ?> pair : maps) { if (pair.equals(key, value)) { return (Map<K, V>) groupCollectorMap.get(pair).get(); } } throw new NoSuchElementException("GMap(" + key + ", " + value + ")"); }
/** * Create a new aggregating map expression using a backing TreeMap * * @param key key for the map entries * @param value value for the map entries * @return wrapper expression */ public static <K extends Comparable<? super K>, V> AbstractGroupExpression<Pair<K, V>, SortedMap<K, V>> sortedMap(Expression<K> key, Expression<V> value) { return GMap.createSorted(QPair.create(key, value)); }
@SuppressWarnings("unchecked") @Override public <K, V> SortedMap<K, V> getSortedMap(Expression<K> key, Expression<V> value) { for (QPair<?, ?> pair : maps) { if (pair.equals(key, value)) { return (SortedMap<K, V>) groupCollectorMap.get(pair).get(); } } throw new NoSuchElementException("GMap(" + key + ", " + value + ")"); }
public static <K, V> QPair<K, V> create(Expression<K> key, Expression<V> value) { return new QPair<K, V>(key, value); }
/** * Create a new aggregating map expression using a backing TreeMap using the given comparator * * @param key key for the map entries * @param value value for the map entries * @param comparator comparator for the created TreeMap instances * @return wrapper expression */ public static <K, V> AbstractGroupExpression<Pair<K, V>, SortedMap<K, V>> sortedMap(Expression<K> key, Expression<V> value, Comparator<? super K> comparator) { return GMap.createSorted(QPair.create(key, value), comparator); }
@Override @SuppressWarnings("unchecked") public <K, V> Map<K, V> getMap(Expression<K> key, Expression<V> value) { for (QPair<?, ?> pair : maps) { if (pair.equals(key, value)) { return (Map<K, V>) groupCollectorMap.get(pair).get(); } } throw new NoSuchElementException("GMap(" + key + ", " + value + ")"); }
/** * Create a new aggregating map expression using a backing LinkedHashMap * * @param key key for the map entries * @param value value for the map entries * @return wrapper expression */ public static <K, V, T, U> AbstractGroupExpression<Pair<K, V>, Map<T, U>> map(GroupExpression<K, T> key, GroupExpression<V, U> value) { return new GMap.Mixin<K, V, T, U, Map<T, U>>(key, value, GMap.createLinked(QPair.create(key, value))); }
@SuppressWarnings("unchecked") @Override public <K, V> SortedMap<K, V> getSortedMap(Expression<K> key, Expression<V> value) { for (QPair<?, ?> pair : maps) { if (pair.equals(key, value)) { return (SortedMap<K, V>) groupCollectorMap.get(pair).get(); } } throw new NoSuchElementException("GMap(" + key + ", " + value + ")"); }
/** * Create a new aggregating map expression using a backing TreeMap * * @param key key for the map entries * @param value value for the map entries * @return wrapper expression */ public static <K, V, T extends Comparable<? super T>, U> AbstractGroupExpression<Pair<K, V>, SortedMap<T, U>> sortedMap(GroupExpression<K, T> key, GroupExpression<V, U> value) { return new GMap.Mixin<K, V, T, U, SortedMap<T, U>>(key, value, GMap.createSorted(QPair.create(key, value))); }
/** * Create a new aggregating map expression using a backing TreeMap using the given comparator * * @param key key for the map entries * @param value value for the map entries * @param comparator comparator for the created TreeMap instances * @return wrapper expression */ public static <K, V, T, U> AbstractGroupExpression<Pair<K, V>, SortedMap<T, U>> sortedMap(GroupExpression<K, T> key, GroupExpression<V, U> value, Comparator<? super T> comparator) { return new GMap.Mixin<K, V, T, U, SortedMap<T, U>>(key, value, GMap.createSorted(QPair.create(key, value), comparator)); }
@SuppressWarnings({ "rawtypes", "unchecked" }) public Mixin(GroupExpression<K, T> keyExpression, GroupExpression<V, U> valueExpression, AbstractGroupExpression<Pair<T, U>, R> mixin) { super((Class) mixin.getType(), QPair.create(keyExpression.getExpression(), valueExpression.getExpression())); this.keyExpression = keyExpression; this.valueExpression = valueExpression; this.mixin = mixin; }
/** * Create a new aggregating map expression using a backing TreeMap * * @param key key for the map entries * @param value value for the map entries * @return wrapper expression */ public static <K extends Comparable<? super K>, V> AbstractGroupExpression<Pair<K, V>, SortedMap<K, V>> sortedMap(Expression<K> key, Expression<V> value) { return GMap.createSorted(QPair.create(key, value)); }
/** * Create a new aggregating map expression using a backing LinkedHashMap * * @param key key for the map entries * @param value value for the map entries * @return wrapper expression */ public static <K, V> AbstractGroupExpression<Pair<K, V>,Map<K, V>> map(Expression<K> key, Expression<V> value) { return GMap.createLinked(QPair.create(key, value)); }
/** * Create a new aggregating map expression using a backing TreeMap using the given comparator * * @param key key for the map entries * @param value value for the map entries * @param comparator comparator for the created TreeMap instances * @return wrapper expression */ public static <K, V> AbstractGroupExpression<Pair<K, V>, SortedMap<K, V>> sortedMap(Expression<K> key, Expression<V> value, Comparator<? super K> comparator) { return GMap.createSorted(QPair.create(key, value), comparator); }