public override long[] GetMatchIndex(ArrayRange indices, Operation.Matcher matcher)
        {
            var expression = new Operation.ExpColumn <DataT>(this);
            var result     = matcher.GetMatchIndex(expression, indices);

            return(result);
        }
示例#2
0
        public override long[] GetMatchIndex(ArrayRange indices, Operation.Matcher matcher)
        {
            var expression = new Operation.ExpColumn <DataT>(this);
            var result     = matcher.GetMatchIndex(expression, indices);

#if MEMPROFILER_DEBUG_INFO
            Algorithm.DebugLog("GetMatchIndex : indexCount " + indices.Count
                               + " matcher: " + matcher.GetHashCode()
                               + " Result Count:" + (result != null ? result.Length : 0));
#endif
            return(result);
        }
        protected long[] GetMatchIndex(ArrayRange indices, Operation.Matcher matcher, Operation.Expression exp)
        {
            //translate group matches to row matches
            if (m_Table.m_RowData.Length == m_Table.m_GroupRowDataRange.Length)
            {
                //all group are closed, group matches are == to row matches
                return(matcher.GetMatchIndex(exp, indices));
            }
            else
            {
                //some group are expanded
                bool   matchAllData = indices.IsSequence && indices.Count == m_Table.m_RowData.Length;
                long[] groupMatches;
                if (matchAllData)
                {
                    //when asking to test all data, test all group
                    groupMatches = matcher.GetMatchIndex(exp, new ArrayRange(0, m_Column.GetRowCount()));
                }
                else
                {
                    //when asking to test only a subset of the data, test only the groups that fall in the indices range
                    var l = new System.Collections.Generic.List <long>((int)indices.Count);
                    for (int i = 0; i != indices.Count; ++i)
                    {
                        var row = indices[i];
                        if (m_Table.m_RowData[row].isGroupHead())
                        {
                            l.Add(m_Table.m_RowData[row].groupIndex);
                        }
                    }

                    groupMatches = matcher.GetMatchIndex(exp, new ArrayRange(l.ToArray()));
                }

                // translate from a list of group index to a list of index including the group's subdata
                var matches = new System.Collections.Generic.List <long>(m_Table.m_RowData.Length);
                for (int i = 0; i != groupMatches.Length; ++i)
                {
                    var groupIndex = groupMatches[i];
                    var groupRange = m_Table.m_GroupRowDataRange[groupIndex];
                    for (long j = groupRange.First; j != groupRange.Last; ++j)
                    {
                        matches.Add(j);
                    }
                }
                return(matches.ToArray());
            }
        }
示例#4
0
 public abstract long[] GetMatchIndex(ArrayRange indices, Operation.Matcher matcher);
 public override long[] GetMatchIndex(ArrayRange indices, Operation.Matcher matcher)
 {
     return(GetMatchIndex(indices, matcher, new Operation.ExpColumn <DataT>(m_Column)));
 }