DataViewRow ISchemaBoundRowMapper.GetRow(DataViewRow input, IEnumerable <DataViewSchema.Column> activeColumns)
            {
                Contracts.AssertValue(input);
                Contracts.AssertValue(activeColumns);
                var totalColumnsCount = 1 + _outputGenericSchema.Count;
                var getters           = new Delegate[totalColumnsCount];

                if (activeColumns.Select(c => c.Index).Contains(_outputGenericSchema.Count))
                {
                    getters[totalColumnsCount - 1] = _parent.Stringify
                        ? _parent.GetTextContributionGetter(input, FeatureColumn.Index, _slotNames)
                        : _parent.GetContributionGetter(input, FeatureColumn.Index);
                }

                var genericRow = _genericRowMapper.GetRow(input, activeColumns);

                for (var i = 0; i < _outputGenericSchema.Count; i++)
                {
                    if (genericRow.IsColumnActive(genericRow.Schema[i]))
                    {
                        getters[i] = RowCursorUtils.GetGetterAsDelegate(genericRow, i);
                    }
                }

                return(new SimpleRow(OutputSchema, genericRow, getters));
            }
Exemple #2
0
            public DataViewRow GetRow(DataViewRow input, Func <int, bool> active)
            {
                Contracts.AssertValue(input);
                Contracts.AssertValue(active);
                var totalColumnsCount = 1 + _outputGenericSchema.Count;
                var getters           = new Delegate[totalColumnsCount];

                if (active(totalColumnsCount - 1))
                {
                    getters[totalColumnsCount - 1] = _parent.Stringify
                        ? _parent.GetTextContributionGetter(input, FeatureColumn.Index, _slotNames)
                        : _parent.GetContributionGetter(input, FeatureColumn.Index);
                }

                var genericRow = _genericRowMapper.GetRow(input, GetGenericPredicate(active));

                for (var i = 0; i < _outputGenericSchema.Count; i++)
                {
                    if (genericRow.IsColumnActive(i))
                    {
                        getters[i] = RowCursorUtils.GetGetterAsDelegate(genericRow, i);
                    }
                }

                return(new SimpleRow(OutputSchema, genericRow, getters));
            }