public static AggregationMultiFunctionAggregationMethod MakeSortedAggregationSubmap(
            ExprEvaluator fromKeyEval,
            ExprEvaluator fromInclusiveEval,
            ExprEvaluator toKeyEval,
            ExprEvaluator toInclusiveEval,
            AggregationMethodSortedEnum method,
            Type underlyingClass)
        {
            if (method.GetFootprint() != AggregationMethodSortedFootprintEnum.SUBMAP)
            {
                throw new IllegalStateException("Unrecognized aggregation method " + method);
            }

            if (method == AggregationMethodSortedEnum.EVENTSBETWEEN)
            {
                return(new AggregationMethodSortedEventsBetweenEval(
                           fromKeyEval,
                           fromInclusiveEval,
                           toKeyEval,
                           toInclusiveEval,
                           submap => UnderlyingEvents(submap, underlyingClass),
                           submap => CollEvents(submap)
                           ));
            }

            if (method == AggregationMethodSortedEnum.SUBMAP)
            {
                return(new AggregationMethodSortedSubmapEval(fromKeyEval, fromInclusiveEval, toKeyEval, toInclusiveEval, underlyingClass));
            }

            throw new IllegalStateException("Unrecognized aggregation method " + method);
        }
Пример #2
0
 public static bool IsReturnsCollectionOfEvents(this AggregationMethodSortedEnum value)
 {
     return(value switch {
         AggregationMethodSortedEnum.FLOOREVENT => (false),
         AggregationMethodSortedEnum.FLOOREVENTS => (true),
         AggregationMethodSortedEnum.FLOORKEY => (false),
         AggregationMethodSortedEnum.CEILINGEVENT => (false),
         AggregationMethodSortedEnum.CEILINGEVENTS => (true),
         AggregationMethodSortedEnum.CEILINGKEY => (false),
         AggregationMethodSortedEnum.LOWEREVENT => (false),
         AggregationMethodSortedEnum.LOWEREVENTS => (true),
         AggregationMethodSortedEnum.LOWERKEY => (false),
         AggregationMethodSortedEnum.HIGHEREVENT => (false),
         AggregationMethodSortedEnum.HIGHEREVENTS => (true),
         AggregationMethodSortedEnum.HIGHERKEY => (false),
         AggregationMethodSortedEnum.FIRSTEVENT => (false),
         AggregationMethodSortedEnum.FIRSTEVENTS => (true),
         AggregationMethodSortedEnum.FIRSTKEY => (false),
         AggregationMethodSortedEnum.LASTEVENT => (false),
         AggregationMethodSortedEnum.LASTEVENTS => (true),
         AggregationMethodSortedEnum.LASTKEY => (false),
         AggregationMethodSortedEnum.GETEVENT => (false),
         AggregationMethodSortedEnum.GETEVENTS => (true),
         AggregationMethodSortedEnum.CONTAINSKEY => (false),
         AggregationMethodSortedEnum.COUNTEVENTS => (false),
         AggregationMethodSortedEnum.COUNTKEYS => (false),
         AggregationMethodSortedEnum.EVENTSBETWEEN => (true),
         AggregationMethodSortedEnum.SUBMAP => (false),
         AggregationMethodSortedEnum.DICTIONARYREFERENCE => (false),
         _ => throw new ArgumentOutOfRangeException(nameof(value), value, null)
     });
Пример #3
0
 public AggregationMethodSortedNoParamForge(
     Type underlyingClass,
     AggregationMethodSortedEnum aggMethod,
     Type resultType)
 {
     _underlyingClass = underlyingClass;
     _aggMethod       = aggMethod;
     _resultType      = resultType;
 }
 public AggregationMethodSortedKeyedForge(
     ExprNode key,
     Type underlyingClass,
     AggregationMethodSortedEnum aggMethod,
     Type resultType)
 {
     _key             = key;
     _underlyingClass = underlyingClass;
     _aggMethod       = aggMethod;
     _resultType      = resultType;
 }
Пример #5
0
 public AggregationMethodSortedSubmapForge(
     ExprNode fromKey,
     ExprNode fromInclusive,
     ExprNode toKey,
     ExprNode toInclusive,
     Type underlyingClass,
     AggregationMethodSortedEnum aggMethod,
     Type resultType)
 {
     _fromKey         = fromKey;
     _fromInclusive   = fromInclusive;
     _toKey           = toKey;
     _toInclusive     = toInclusive;
     _underlyingClass = underlyingClass;
     _aggMethod       = aggMethod;
     _resultType      = resultType;
 }
        public static AggregationMethodSortedKeyedEval MakeSortedAggregationWithKey(
            ExprEvaluator keyEval,
            AggregationMethodSortedEnum method,
            Type underlyingClass)
        {
            if (method.GetFootprint() != AggregationMethodSortedFootprintEnum.KEYONLY)
            {
                throw new IllegalStateException("Unrecognized aggregation method " + method);
            }

            if (method == AggregationMethodSortedEnum.CEILINGEVENT)
            {
                return(new AggregationMethodSortedKeyedEval(
                           keyEval,
                           (map, key) => FirstUnd(map.GreaterThanOrEqualTo(key)),
                           (map, key) => FirstBean(map.GreaterThanOrEqualTo(key)),
                           (map, key) => FirstColl(map.GreaterThanOrEqualTo(key))
                           ));
            }

            if (method == AggregationMethodSortedEnum.CEILINGEVENTS)
            {
                return(new AggregationMethodSortedKeyedEval(
                           keyEval,
                           (map, key) => EventsArrayUnd(map.GreaterThanOrEqualTo(key), underlyingClass),
                           (map, key) => null,
                           (map, key) => EventsColl(map.GreaterThanOrEqualTo(key))
                           ));
            }

            if (method == AggregationMethodSortedEnum.CEILINGKEY)
            {
                return(new AggregationMethodSortedKeyedEval(
                           keyEval,
                           (map, key) => map.GreaterThanOrEqualTo(key)?.Key,
                           (map, key) => null,
                           (map, key) => null
                           ));
            }

            if (method == AggregationMethodSortedEnum.FLOOREVENT)
            {
                return(new AggregationMethodSortedKeyedEval(
                           keyEval,
                           (map, key) => FirstUnd(map.LessThanOrEqualTo(key)),
                           (map, key) => FirstBean(map.LessThanOrEqualTo(key)),
                           (map, key) => FirstColl(map.LessThanOrEqualTo(key))
                           ));
            }

            if (method == AggregationMethodSortedEnum.FLOOREVENTS)
            {
                return(new AggregationMethodSortedKeyedEval(
                           keyEval,
                           (map, key) => EventsArrayUnd(map.LessThanOrEqualTo(key), underlyingClass),
                           (map, key) => null,
                           (map, key) => EventsColl(map.LessThanOrEqualTo(key))
                           ));
            }

            if (method == AggregationMethodSortedEnum.FLOORKEY)
            {
                return(new AggregationMethodSortedKeyedEval(
                           keyEval,
                           (map, key) => map.LessThanOrEqualTo(key)?.Key,
                           (map, key) => null,
                           (map, key) => null
                           ));
            }

            if (method == AggregationMethodSortedEnum.LOWEREVENT)
            {
                return(new AggregationMethodSortedKeyedEval(
                           keyEval,
                           (map, key) => FirstUnd(map.LessThan(key)),
                           (map, key) => FirstBean(map.LessThan(key)),
                           (map, key) => FirstColl(map.LessThan(key))
                           ));
            }

            if (method == AggregationMethodSortedEnum.LOWEREVENTS)
            {
                return(new AggregationMethodSortedKeyedEval(
                           keyEval,
                           (map, key) => EventsArrayUnd(map.LessThan(key), underlyingClass),
                           (map, key) => null,
                           (map, key) => EventsColl(map.LessThan(key))
                           ));
            }

            if (method == AggregationMethodSortedEnum.LOWERKEY)
            {
                return(new AggregationMethodSortedKeyedEval(
                           keyEval,
                           (map, key) => map.LessThan(key)?.Key,
                           (map, key) => null,
                           (map, key) => null
                           ));
            }

            if (method == AggregationMethodSortedEnum.HIGHEREVENT)
            {
                return(new AggregationMethodSortedKeyedEval(
                           keyEval,
                           (map, key) => FirstUnd(map.GreaterThan(key)),
                           (map, key) => FirstBean(map.GreaterThan(key)),
                           (map, key) => FirstColl(map.GreaterThan(key))
                           ));
            }

            if (method == AggregationMethodSortedEnum.HIGHEREVENTS)
            {
                return(new AggregationMethodSortedKeyedEval(
                           keyEval,
                           (map, key) => EventsArrayUnd(map.GreaterThan(key), underlyingClass),
                           (map, key) => null,
                           (map, key) => EventsColl(map.GreaterThan(key))
                           ));
            }

            if (method == AggregationMethodSortedEnum.HIGHERKEY)
            {
                return(new AggregationMethodSortedKeyedEval(
                           keyEval,
                           (map, key) => map.GreaterThan(key)?.Key,
                           (map, key) => null,
                           (map, key) => null
                           ));
            }

            if (method == AggregationMethodSortedEnum.GETEVENT)
            {
                return(new AggregationMethodSortedKeyedEval(
                           keyEval,
                           (map, key) => FirstUnd(map.Get(key)),
                           (map, key) => FirstBean(map.Get(key)),
                           (map, key) => FirstColl(map.Get(key))
                           ));
            }

            if (method == AggregationMethodSortedEnum.GETEVENTS)
            {
                return(new AggregationMethodSortedKeyedEval(
                           keyEval,
                           (map, key) => EventsArrayUnd(map.Get(key), underlyingClass),
                           (map, key) => null,
                           (map, key) => EventsColl(map.Get(key))
                           ));
            }

            if (method == AggregationMethodSortedEnum.CONTAINSKEY)
            {
                return(new AggregationMethodSortedKeyedEval(
                           keyEval,
                           (map, key) => map.ContainsKey(key),
                           (map, key) => null,
                           (map, key) => null
                           ));
            }

            throw new IllegalStateException("Unrecognized aggregation method " + method);
        }
Пример #7
0
 public static AggregationMethodSortedNoParamEval MakeSortedAggregationNoParam(
     AggregationMethodSortedEnum method,
     Type underlyingClass)
 {
     if (method.GetFootprint() != AggregationMethodSortedFootprintEnum.NOPARAM)
     {
         throw new IllegalStateException("Unrecognized aggregation method " + method);
     }
     if (method == AggregationMethodSortedEnum.FIRSTEVENT)
     {
         return(new AggregationMethodSortedNoParamEval(
                    sorted => FirstUnd(sorted.Sorted.FirstEntry),
                    sorted => FirstBean(sorted.Sorted.FirstEntry),
                    sorted => FirstColl(sorted.Sorted.FirstEntry)
                    ));
     }
     if (method == AggregationMethodSortedEnum.FIRSTEVENTS)
     {
         return(new AggregationMethodSortedNoParamEval(
                    sorted => EventsArrayUnd(sorted.Sorted.FirstEntry, underlyingClass),
                    sorted => null,
                    sorted => EventsColl(sorted.Sorted.FirstEntry)
                    ));
     }
     if (method == AggregationMethodSortedEnum.FIRSTKEY)
     {
         return(new AggregationMethodSortedNoParamEval(
                    sorted => sorted.Sorted.FirstEntry.Key,
                    sorted => null,
                    sorted => null
                    ));
     }
     if (method == AggregationMethodSortedEnum.LASTEVENT)
     {
         return(new AggregationMethodSortedNoParamEval(
                    sorted => FirstUnd(sorted.Sorted.LastEntry),
                    sorted => FirstBean(sorted.Sorted.LastEntry),
                    sorted => FirstColl(sorted.Sorted.LastEntry)
                    ));
     }
     if (method == AggregationMethodSortedEnum.LASTEVENTS)
     {
         return(new AggregationMethodSortedNoParamEval(
                    sorted => EventsArrayUnd(sorted.Sorted.LastEntry, underlyingClass),
                    sorted => null,
                    sorted => EventsColl(sorted.Sorted.LastEntry)
                    ));
     }
     if (method == AggregationMethodSortedEnum.LASTKEY)
     {
         return(new AggregationMethodSortedNoParamEval(
                    sorted => sorted.Sorted.LastEntry.Key,
                    sorted => null,
                    sorted => null
                    ));
     }
     if (method == AggregationMethodSortedEnum.COUNTEVENTS)
     {
         return(new AggregationMethodSortedNoParamEval(
                    sorted => sorted.Count,
                    sorted => null,
                    sorted => null
                    ));
     }
     if (method == AggregationMethodSortedEnum.COUNTKEYS)
     {
         return(new AggregationMethodSortedNoParamEval(
                    sorted => sorted.Sorted.Count,
                    sorted => null,
                    sorted => null
                    ));
     }
     if (method == AggregationMethodSortedEnum.DICTIONARYREFERENCE)
     {
         return(new AggregationMethodSortedNoParamEval(
                    sorted => new AggregationMethodSortedWrapperDictionary(sorted.Sorted),
                    sorted => null,
                    sorted => null
                    ));
     }
     throw new IllegalStateException("Unrecognized aggregation method " + method);
 }