Exemple #1
0
        public override Tolerance GetTolerance(int index)
        {
            if (GetColumnType(index) != ColumnType.Numeric && GetColumnType(index) != ColumnType.DateTime && GetColumnType(index) != ColumnType.Text)
            {
                return(null);
            }

            var col = ColumnsDef.FirstOrDefault(c => c.Index == index);

            if (col == null || !col.IsToleranceSpecified)
            {
                switch (GetColumnType(index))
                {
                case ColumnType.Text:
                    return((DefaultTolerance as TextSingleMethodTolerance) ?? TextSingleMethodTolerance.None);

                case ColumnType.Numeric:
                    return((DefaultTolerance as NumericTolerance) ?? NumericAbsoluteTolerance.None);

                case ColumnType.DateTime:
                    return((DefaultTolerance as DateTimeTolerance) ?? DateTimeTolerance.None);

                default:
                    return(null);
                }
            }

            return(ToleranceFactory.Instantiate(col));
        }
Exemple #2
0
        public override Tolerance GetTolerance(string name)
        {
            if (GetColumnType(name) != ColumnType.Numeric && GetColumnType(name) != ColumnType.DateTime)
            {
                return(null);
            }

            var col = ColumnsDef.FirstOrDefault(c => (c.Identifier as ColumnNameIdentifier)?.Name == name);

            if (col == null || !col.IsToleranceSpecified)
            {
                if (GetColumnType(name) == ValuesDefaultType)
                {
                    return(DefaultTolerance);
                }
                else
                {
                    if (IsNumeric(name))
                    {
                        return(NumericAbsoluteTolerance.None);
                    }
                    else if (IsDateTime(name))
                    {
                        return(DateTimeTolerance.None);
                    }
                    else
                    {
                        return(null);
                    }
                }
            }

            return(new ToleranceFactory().Instantiate(col));
        }
Exemple #3
0
        public Tolerance GetTolerance(int index)
        {
            if (!IsNumeric(index) && !IsDateTime(index))
            {
                return(null);
            }

            var col = ColumnsDef.FirstOrDefault(c => c.Index == index);

            if (col == null || !col.IsToleranceSpecified)
            {
                if (IsNumeric(index))
                {
                    return(DefaultTolerance);
                }
                else
                {
                    return(DateTimeTolerance.None);
                }
            }

            return(ToleranceFactory.Instantiate(col));
        }
        public override Tolerance GetTolerance(string name)
        {
            if (GetColumnType(name) != ColumnType.Numeric && GetColumnType(name) != ColumnType.DateTime)
            {
                return(null);
            }

            var col = ColumnsDef.FirstOrDefault(c => c.Name == name);

            if (col == null || !col.IsToleranceSpecified)
            {
                if (IsNumeric(name))
                {
                    return(DefaultTolerance);
                }
                else
                {
                    return(DateTimeTolerance.None);
                }
            }

            return(ToleranceFactory.Instantiate(col));
        }
Exemple #5
0
        public decimal GetTolerance(int index)
        {
            var col = ColumnsDef.FirstOrDefault(c => c.Index == index);

            return(col == null ? DefaultTolerance : col.Tolerance);
        }