예제 #1
0
 public ExpressionResultCacheEntryEventBeanArrayAndCollBean(
     EventBean[] reference,
     FlexCollection result)
 {
     Reference = reference;
     Result = result;
 }
 public static object ToArray(FlexCollection input)
 {
     if (input.IsEventBeanCollection) {
         return input.EventBeanCollection.ToArray();
     }
     else {
         return input.ObjectCollection.ToArray();
     }
 }
 public void SavePropertyColl(
     string propertyNameFullyQualified,
     EventBean reference,
     FlexCollection events)
 {
     var entry = new ExpressionResultCacheEntryBeanAndCollBean(reference, events);
     collPropertyCache.Put(
         propertyNameFullyQualified,
         new SoftReference<ExpressionResultCacheEntryBeanAndCollBean>(entry));
 }
예제 #4
0
 public static bool EventsCheckStrings(
     FlexCollection events,
     string property,
     string value)
 {
     return EventsCheckStrings(
         events.EventBeanCollection,
         property,
         value);
 }
예제 #5
0
 public void SaveDeclaredExpressionLastColl(
     object node,
     EventBean[] eventsPerStream,
     FlexCollection result)
 {
     var copy = EventBeanUtility.CopyArray(eventsPerStream);
     var entry = new ExpressionResultCacheEntryEventBeanArrayAndCollBean(copy, result: result);
     exprDeclCacheCollection.Put(
         node,
         new SoftReference<ExpressionResultCacheEntryEventBeanArrayAndCollBean>(entry));
 }
예제 #6
0
 public static FlexCollection UnwrapEventBeans(
     EventBeanTypedEventFactory eventBeanTypedEventFactory,
     BeanEventType type,
     IEnumerable enumerable)
 {
     return FlexCollection.Of(
         enumerable
             .Cast<object>()
             .Select(value => eventBeanTypedEventFactory.AdapterForTypedObject(value, type))
             .ToList());
 }
예제 #7
0
        public static FlexCollection EvaluateEnumMethodTakeLast(
            FlexCollection enumcoll,
            int size)
        {
            if (enumcoll.IsEventBeanCollection) {
                return FlexCollection.Of(
                    EvaluateEnumMethodTakeLast(enumcoll.EventBeanCollection, size));
            }

            return FlexCollection.Of(
                EvaluateEnumMethodTakeLast(enumcoll.ObjectCollection, size));
        }
예제 #8
0
 public static EventBean EvaluateFilterExpectSingleMatch(
     EventBean[] eventsZeroSubselect,
     bool newData,
     FlexCollection matchingEvents,
     ExprEvaluatorContext exprEvaluatorContext,
     ExprEvaluator filter)
 {
     return EvaluateFilterExpectSingleMatch(
         eventsZeroSubselect,
         newData,
         matchingEvents.EventBeanCollection,
         exprEvaluatorContext,
         filter);
 }
예제 #9
0
        public static FlexCollection EnumExceptForgeEvalSet(
            FlexCollection other,
            FlexCollection enumcoll)
        {
            if (other.IsEventBeanCollection) {
                if (enumcoll.IsEventBeanCollection) {
                    return FlexCollection.Of(EnumExceptForgeEvalSet(
                        other.EventBeanCollection,
                        enumcoll.EventBeanCollection));
                }
            } else if (enumcoll.IsObjectCollection) {
                return FlexCollection.Of(EnumExceptForgeEvalSet(
                    other.ObjectCollection,
                    enumcoll.ObjectCollection));
            }

            throw new ArgumentException("mismatch in FlexCollection types");
        }
예제 #10
0
        public static FlexCollection ConvertToCollection(
            string propertyName, 
            object value)
        {
            if (value == null) {
                return null;
            }

            if (value is string stringValue) {
                // Convert to a collection of characters
                return FlexCollection.Of(
                    stringValue
                        .ToCharArray()
                        .Cast<object>()
                        .ToList());
            }

            Log.Warn(
                "Expected string-type input from property '" + propertyName + "' but received " + value.GetType());
            return null;
        }
예제 #11
0
        /// <summary>
        ///     NOTE: Code-generation-invoked method, method name and parameter order matters
        /// </summary>
        /// <param name="enumcoll">collection</param>
        /// <param name="size">size</param>
        /// <returns>collection</returns>
        public static FlexCollection EvaluateEnumTakeMethod(
            FlexCollection enumcoll,
            int size)
        {
            if (enumcoll.Count == 0) {
                return FlexCollection.Empty;
            }

            if (size <= 0) {
                return FlexCollection.Empty;
            }

            if (enumcoll.Count < size) {
                return enumcoll;
            }

            if (size == 1) {
                if (enumcoll.IsEventBeanCollection) {
                    return FlexCollection.OfEvent(
                        enumcoll.EventBeanCollection.First());
                }
                else {
                    return FlexCollection.OfObject(
                        enumcoll.ObjectCollection.First());
                }
            }

            if (enumcoll.IsEventBeanCollection) {
                return FlexCollection.Of(
                    enumcoll.EventBeanCollection
                    .Take(size)
                    .ToList());
            }

            return FlexCollection.Of(
                enumcoll.ObjectCollection
                    .Take(size)
                    .ToList());
        }
예제 #12
0
 /// <summary>
 ///     NOTE: Code-generation-invoked method, method name and parameter order matters
 /// </summary>
 /// <param name="matchingEvents">events</param>
 /// <returns>event</returns>
 public static EventBean GetNonemptyFirstEvent(FlexCollection matchingEvents)
 {
     return GetNonemptyFirstEvent(matchingEvents.EventBeanCollection);
 }
예제 #13
0
 public static object GetNonemptyFirstEventUnderlying(FlexCollection matchingEvents)
 {
     return GetNonemptyFirstEventUnderlying(matchingEvents.EventBeanCollection);
 }
예제 #14
0
 /// <summary>
 /// NOTE: Code-generation-invoked method, method name and parameter order matters
 /// </summary>
 /// <param name="enumcoll">events</param>
 /// <returns>array</returns>
 public static EventBean[] TakeWhileLastEventBeanToArray(FlexCollection enumcoll)
 {
     return(enumcoll.IsEventBeanCollection
                         ? enumcoll.EventBeanCollection.ToArray()
                         : enumcoll.ObjectCollection.UnwrapIntoArray <EventBean>());
 }
예제 #15
0
 public static FlexCollection AsFlexCollection(this object value)
 {
     return(FlexCollection.Of(value));
 }
예제 #16
0
 public EventUnderlyingCollection(FlexCollection flexCollection)
 {
     _underlyingCollection = flexCollection.EventBeanCollection;
 }