Пример #1
0
        internal object GetColumnValue(int columnIndex)
        {
            if (!owner.Contains(this) || !owner.Functions.Any())
            {
                return(null);
            }

            object value = null;

            var variable = owner.GetVariableForColumnIndex(columnIndex);
            var values   = variable.Values;

            if (columnIndex < owner.Function.Arguments.Count)
            {
                var argumentIndex = Index[columnIndex];

                if (values.Count > argumentIndex)
                {
                    value = values[argumentIndex];
                }
            }
            else
            {
                var index = Index;
                if (MultiDimensionalArrayHelper.IsIndexWithinShape(index, values.Shape))
                {
                    value = values[Index];
                }
            }

            return(value);
        }
        protected override object OnGetColumnValue(int columnIndex)
        {
            if (owner.GetIndexOfRow(this) == -1 || owner.Function == null)
            {
                return(null);
            }

            object value = null;

            if (columnIndex < owner.Function.Arguments.Count)
            {
                if (columnIndex >= Index.Count())
                {
                    return(null);
                }

                var values = owner.GetVariableForColumnIndex(columnIndex).Values;

                var argumentIndex = Index[columnIndex];
                if (values.Count > argumentIndex)
                {
                    value = values[argumentIndex];
                }
            }
            else
            {
                var componentIndex = columnIndex - owner.Function.Arguments.Count;
                if (componentIndex >= owner.Function.Components.Count)
                {
                    return(value);
                }

                var values = owner.GetVariableForColumnIndex(columnIndex).Values;

                // component column
                var index = Index;
                if (MultiDimensionalArrayHelper.IsIndexWithinShape(index, values.Shape))
                {
                    value = values[index];
                }
            }

            return(value);
        }
Пример #3
0
        protected override object OnGetColumnValue(int columnIndex)
        {
            if (owner.GetIndexOfRow(this) == -1 || owner.Function == null)
            {
                return(null);
            }

            object value = null;

            if (columnIndex < owner.Function.Arguments.Count)
            {
                var argumentIndex = Index[columnIndex];

                //log.DebugFormat("GetColumnValue: {0}, {1}", columnIndex, argumentIndex);

                var values = owner.Function.Arguments[columnIndex].Values;
                if (values.Count > argumentIndex)
                {
                    value = values[argumentIndex];
                }
            }
            else
            {
                var componentIndex = columnIndex - owner.Function.Arguments.Count;
                if (componentIndex >= owner.Function.Components.Count)
                {
                    return(value);
                }

                // component column
                var component = owner.Function.Components[componentIndex];
                var values    = component.Values;

                var index = Index;
                if (MultiDimensionalArrayHelper.IsIndexWithinShape(index, values.Shape))
                {
                    value = values[index];
                }
            }

            return(value);
        }
        internal object GetColumnValue(int columnIndex)
        {
            if (!owner.Contains(this))
            {
                return(null);
            }

            lock (owner.Function.Store)
            {
                object value = null;
                if (columnIndex < owner.Function.Arguments.Count)
                {
                    var argumentIndex = Index[columnIndex];

                    //log.DebugFormat("GetColumnValue: {0}, {1}", columnIndex, argumentIndex);


                    var values = owner.Function.Arguments[columnIndex].Values;
                    if (values.Count > argumentIndex)
                    {
                        value = values[argumentIndex];
                    }
                }
                else
                {
                    // component column
                    var component = owner.Function.Components[columnIndex - owner.Function.Arguments.Count];
                    var values    = component.Values;

                    var index = Index;
                    if (MultiDimensionalArrayHelper.IsIndexWithinShape(index, values.Shape))
                    {
                        value = values[Index];
                    }
                }

                return(value);
            }
        }
Пример #5
0
 public void IsIndexWithinShapeIsFalseForAShapeContaining0()
 {
     Assert.IsFalse(MultiDimensionalArrayHelper.IsIndexWithinShape(new[] { 0 }, new[] { 0, 2, 2 }));
     Assert.IsFalse(MultiDimensionalArrayHelper.IsIndexWithinShape(new[] { 0, 0 }, new[] { 2, 2, 0 }));
 }