Пример #1
0
        /// <summary>
        /// The FafTableLookup
        /// </summary>
        /// <param name="virtualDataWindow">The <see cref="VirtualDWView"/></param>
        /// <param name="indexMultiKey">The <see cref="IndexMultiKey"/></param>
        /// <param name="eventTable">The <see cref="EventTable"/></param>
        /// <param name="keyValues">The <see cref="Object"/> array</param>
        /// <param name="rangeValues">The <see cref="RangeIndexLookupValue" /> array</param>
        /// <param name="attributes">The <see cref="Attribute" /> array</param>
        /// <returns>The <see cref="ICollection{EventBean}"/></returns>
        private static ICollection <EventBean> FafTableLookup(
            VirtualDWView virtualDataWindow,
            IndexMultiKey indexMultiKey,
            EventTable eventTable,
            Object[] keyValues,
            RangeIndexLookupValue[] rangeValues,
            Attribute[] attributes)
        {
            if (virtualDataWindow != null)
            {
                return(virtualDataWindow.GetFireAndForgetData(eventTable, keyValues, rangeValues, attributes));
            }

            ISet <EventBean> result;

            if (indexMultiKey.HashIndexedProps.Length > 0 && indexMultiKey.RangeIndexedProps.Length == 0)
            {
                if (indexMultiKey.HashIndexedProps.Length == 1)
                {
                    var table = (PropertyIndexedEventTableSingle)eventTable;
                    result = table.Lookup(keyValues[0]);
                }
                else
                {
                    var table = (PropertyIndexedEventTable)eventTable;
                    result = table.Lookup(keyValues);
                }
            }
            else if (indexMultiKey.HashIndexedProps.Length == 0 && indexMultiKey.RangeIndexedProps.Length == 1)
            {
                var table = (PropertySortedEventTable)eventTable;
                result = table.LookupConstants(rangeValues[0]);
            }
            else
            {
                var table         = (PropertyCompositeEventTable)eventTable;
                var rangeCoercion = table.OptRangeCoercedTypes;
                var lookup        = CompositeIndexLookupFactory.Make(keyValues, rangeValues, rangeCoercion);
                result = new HashSet <EventBean>();
                lookup.Lookup(table.MapIndex, result, table.PostProcessor);
            }
            if (result != null)
            {
                return(result);
            }

            return(Collections.GetEmptyList <EventBean>());
        }
Пример #2
0
        private static ICollection<EventBean> FafTableLookup(
            VirtualDWView virtualDataWindow,
            IndexMultiKey indexMultiKey,
            EventTable eventTable,
            object[] keyValues,
            RangeIndexLookupValue[] rangeValues,
            Attribute[] annotations,
            AgentInstanceContext agentInstanceContext)
        {
            if (virtualDataWindow != null) {
                return virtualDataWindow.GetFireAndForgetData(eventTable, keyValues, rangeValues, annotations);
            }

            ISet<EventBean> result;
            if (indexMultiKey.HashIndexedProps.Length > 0 && indexMultiKey.RangeIndexedProps.Length == 0) {
                var table = (PropertyHashedEventTable) eventTable;
                var lookupKey = table.MultiKeyTransform.From(keyValues);
                result = table.Lookup(lookupKey);
            }
            else if (indexMultiKey.HashIndexedProps.Length == 0 && indexMultiKey.RangeIndexedProps.Length == 1) {
                var table = (PropertySortedEventTable) eventTable;
                result = table.LookupConstants(rangeValues[0]);
            }
            else {
                var table = (PropertyCompositeEventTable) eventTable;
                var rangeCoercion = table.OptRangeCoercedTypes;
                var lookup = CompositeIndexLookupFactory.Make(keyValues, table.MultiKeyTransform, rangeValues, rangeCoercion);
                result = new HashSet<EventBean>();
                lookup.Lookup(table.Index, result, table.PostProcessor);
            }

            if (result != null) {
                return result;
            }

            return EmptyList<EventBean>.Instance;
        }