Exemplo n.º 1
0
 public void Format_DBNullValue_NullDisplay(ColumnType columnType)
 {
     var factory = new CellFormatterFactory();
     var formatter = factory.GetObject(columnType);
     var text = formatter.Format(DBNull.Value);
     Assert.That(text, Is.EqualTo("(null)"));
 }
Exemplo n.º 2
0
 public void AddColumn(string colName, int width, ColumnType columnType, string description, bool persistent)
 {
     AddColumn(colName, width, columnType, description);
     if (persistent){
         AddPersistentColumn(colName, width, columnType, description, null);
     }
 }
 public ColumnMappingField(FieldInfo field, ColumnAttribute attribute)
 {
     this._Field = field;
     this._ColumnName = string.IsNullOrEmpty(attribute.ColumnName) ? field.Name : attribute.ColumnName;
     this._ColumnType = attribute.ColumnType;
     this._ColumnId = attribute.ColumnId;
 }
 public ColumnMappingProperty(PropertyInfo Property, ColumnAttribute attribute)
 {
     this._Property = Property;
     this._ColumnName = string.IsNullOrEmpty(attribute.ColumnName) ? Property.Name : attribute.ColumnName;
     this._ColumnType = attribute.ColumnType;
     this._ColumnId = attribute.ColumnId;
 }
Exemplo n.º 5
0
 public static string ColumnTypeToString(ColumnType ct)
 {
     switch (ct){
         case ColumnType.Boolean:
             return "C";
         case ColumnType.Categorical:
             return "C";
         case ColumnType.Color:
             return "C";
         case ColumnType.DateTime:
             return "T";
         case ColumnType.DashStyle:
             return "C";
         case ColumnType.Integer:
             return "N";
         case ColumnType.MultiInteger:
             return "M";
         case ColumnType.MultiNumeric:
             return "M";
         case ColumnType.Numeric:
             return "N";
         case ColumnType.Text:
             return "T";
         default:
             return "T";
     }
 }
Exemplo n.º 6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Column" /> class.
 /// </summary>
 /// <param name="name">The name.</param>
 /// <param name="title">The title.</param>
 /// <param name="type">The type.</param>
 /// <param name="pk">if set to <c>true</c> the column is a primary key.</param>
 public Column(string name, string title = null, ColumnType type = ColumnType.Text, bool pk = false)
 {
     this.Name = name;
     this.Title = (title == null) ? name : title;
     this.Type = type;
     this.PrimaryKey = pk;
 }
Exemplo n.º 7
0
 /// <summary>
 /// Copy constructor
 /// </summary>
 /// <param name="objectSrc"></param>
 public ColumnSchema(ColumnSchema objectSrc)
 {
     Name = objectSrc.Name;
     Type = objectSrc.Type;
     Reference = objectSrc.Reference;
     Comment = objectSrc.Comment;
 }
Exemplo n.º 8
0
 /// <summary>
 /// Explicit constructor for a foreign key
 /// </summary>
 /// <param name="name">Name of the column</param>
 /// <param name="type">Type of the column</param>
 public ColumnSchema(string name, ColumnType type, string tableName, string columnName, string comment)
 {
     Name = name;
     Type = type;
     Reference = string.Format("{0}.{1}", tableName, columnName);
     Comment = comment;
 }
Exemplo n.º 9
0
        public override string GetNativeSqlType(ColumnType type)
        {
            switch (type)
            {
                case ColumnType.ID:
                    return "integer primary key autoincrement";

                case ColumnType.ForeignKey:
                case ColumnType.Integer:
                    return "integer";

                case ColumnType.String:
                    return "text";

                case ColumnType.Bool:
                    return "bool";

                case ColumnType.Timestamp:
                    return "timestamp";

                case ColumnType.Date:
                    return "date";

                case ColumnType.Double:
                    return "double";

                default:
                    return null;
            }
        }
Exemplo n.º 10
0
 public ColumnAttribute(ColumnType type)
 {
     switch (type)
     {
         case ColumnType.IncrementPrimary:
             ParameterDirection = ParameterDirection.InputOutput;
             IsUnique = IsPrimaryKey = IsIncrement = true;
             break;
         case ColumnType.Primary:
             ParameterDirection = ParameterDirection.Input;
             IsUnique = IsPrimaryKey = true;
             break;
         case ColumnType.Unique:
             ParameterDirection = ParameterDirection.Input;
             IsUnique = true;
             break;
         case ColumnType.Nullable:
             IsNullable = true;
             ParameterDirection = ParameterDirection.Input;
             break;
         default:
             ParameterDirection = ParameterDirection.Input;
             break;
     }
 }
Exemplo n.º 11
0
 public ColumnData(String name, ColumnType type, String comparison, String method)
 {
     Name = name;
     Type = type;
     Comparison = comparison;
     TimingMethod = method;
 }
Exemplo n.º 12
0
 public ValuedExpression(string expression, object value, ColumnType type, string tolerance)
     : base(expression)
 {
     Value = value;
     Type = type;
     Tolerance = tolerance;
 }
Exemplo n.º 13
0
        public static ColumnParser Create(ColumnType type, string format)
        {
            switch (type)
            {
                case ColumnType.Logger:
                    return new LoggerParser();

                case ColumnType.Level:
                    return new LevelParser();

                case ColumnType.Timestamp:
                    return new TimestampParser(format);

                case ColumnType.Thread:
                    return new ThreadParser();

                case ColumnType.Line:
                    return new LineParser();

                case ColumnType.Newline:
                    return new NewlineParser();

                case ColumnType.Message:
                    return new MessageParser();

                case ColumnType.Date:
                    return new DateParser(format, DateTimeKind.Local);

                case ColumnType.UtcDate:
                    return new DateParser(format, DateTimeKind.Utc);

                default:
                    throw new KeyNotFoundException(string.Format("Unable to find a parser for '{0}'", type));
            }
        }
 /// <summary>
 ///     The column definition.
 /// </summary>
 /// <param name="theName">The name of the column.</param>
 /// <param name="theDataType">The type of the column.</param>
 public ColumnDefinition(String theName, ColumnType theDataType)
 {
     Name = theName;
     DataType = theDataType;
     Count = -1;
     Low = High = Mean = Sd = Double.NaN;
 }
Exemplo n.º 15
0
 public TableInfo(string name, string primaryKeyName, ColumnType? primaryKeyType, short? primaryKeySize)
 {
     Name = name;
       PrimaryKeyName = primaryKeyName;
       PrimaryKeyType = primaryKeyType;
       PrimaryKeySize = primaryKeySize;
 }
Exemplo n.º 16
0
		/// <summary>
		/// Filter items in ImageListView incrementally. 
		/// This method optimizes on-the-fly filtering as user types in a search box.
		/// </summary>
		/// <param name="key">An item is visible only if it contains this string</param>
		private void FilterIncrementallyWith(string key, ColumnType attrType)
		{
			if (key.Length == mLastSearch.Length) return;

			if (mVisibleItems == null)
			{
				mVisibleItems = new LinkedList<ImageListViewItem>(mItems);
				mInvisibleItems = new LinkedList<ImageListViewItem>();
			}
			if (key.Length > mLastSearch.Length)
			{
				ToggleMatchedItems(mVisibleItems, mInvisibleItems, false, key, attrType);
			}
			else if (key.Length < mLastSearch.Length)
			{
				ToggleMatchedItems(mInvisibleItems, mVisibleItems, true, key, attrType);
			}
			mImageListView.Items.Clear(false);
			mImageListView.SuspendLayout();
			foreach (ImageListViewItem item in mVisibleItems)
			{
				mImageListView.Items.Add(item, mAdaptor);
			}
			mImageListView.ResumeLayout();
			mLastSearch = key;
		}
Exemplo n.º 17
0
		/// <summary>
		/// Filter out items in ImageListView according to given criterion.
		/// </summary>
		/// <param name="key">An item is visible only if it contains this string</param>
		internal void FilterWith(string key, ColumnType attrType)
		{
			if (mItems == null)
			{
				throw new InvalidOperationException("Method Snapshot() should be called before the first search.");
			}
			mImageListView.Items.Clear(false);
			if (key.Length == 0) // reset items
			{
				mImageListView.Items.AddRange(mItems, mAdaptor);
			}
			else
			{
				string uKey = key.ToUpperInvariant();
				mImageListView.SuspendLayout();
				foreach (ImageListViewItem item in mItems)
				{
					Boolean isMatched = false;
					switch (attrType)
					{
						case ColumnType.Name:
							isMatched = item.Text.Contains(uKey); break;
						default:
							throw new NotImplementedException();
					}
					if (isMatched) mImageListView.Items.Add(item, mAdaptor);
				}
				mImageListView.ResumeLayout();
			}
			mLastSearch = key;
		}
Exemplo n.º 18
0
        public void AddColumn(string colName, int width, ColumnType columnType, string description, RenderTableCell renderer,
			bool persistent)
        {
            AddColumn(colName, width, columnType, description, renderer);
            if (persistent){
                AddPersistentColumn(colName, width, columnType, description, renderer);
            }
        }
Exemplo n.º 19
0
 public DataTypeItem(DataType dataType, ColumnType[] allowedColumns)
 {
   eX4XcIhHpDXt70u2x3N.k8isAcYzkUOGF();
   // ISSUE: explicit constructor call
   base.\u002Ector();
   this.mjxdnU89b0 = dataType;
   this.Awnd7GaIPh = new ArrayList((ICollection) allowedColumns);
 }
Exemplo n.º 20
0
        public void AddColumn(string tableName, string columnName, ColumnType columnType)
        {
            var tableForInsert = getTable(tableName);
            if (hasColumn(tableForInsert, columnName))
                throw new ZException("Table [{0}] already contains column with specified name: {1}.", tableName, columnName);

            tableForInsert.Columns.Add(new Column(columnName, columnType));
        }
 private ColumnDefinitionPayload(string name, CharacterSet characterSet, int columnLength, ColumnType columnType, ColumnFlags columnFlags)
 {
     Name = name;
     CharacterSet = characterSet;
     ColumnLength = columnLength;
     ColumnType = columnType;
     ColumnFlags = columnFlags;
 }
 /// <summary>
 /// Initializes a new instance of the EsentInvalidConversionException class.
 /// </summary>
 /// <param name="tablename">The name of the table the column wasn't found in.</param>
 /// <param name="columnName">The name of the column.</param>
 /// <param name="columnType">The type of column data was being converted for.</param>
 /// <param name="objectType">The type of object that the conversion failed for.</param>
 /// <param name="innerException">The exception raised during conversion.</param>
 internal EsentInvalidConversionException(string tablename, string columnName, ColumnType columnType, Type objectType, Exception innerException)
     : base(String.Format("Unable to convert an object of type {0} for column '{1}' ({2}) of table '{3}'", objectType, columnName, columnType, tablename), innerException)
 {
     this.Data["table"] = tablename;
     this.Data["column"] = columnName;
     this.Data["columnType"] = columnType;
     this.Data["objectType"] = objectType;
 }
Exemplo n.º 23
0
 public Column()
 {
   eX4XcIhHpDXt70u2x3N.k8isAcYzkUOGF();
   // ISSUE: explicit constructor call
   base.\u002Ector();
   this.aBGgvFVujA = ColumnType.Skipped;
   this.NrkgoRFju2 = "";
 }
Exemplo n.º 24
0
        public static string Translate(ColumnType type, int length, int precision, int scale, string customType)
        {
            string physicalTypeString = String.Empty;
            length = length >= 1 ? length : 1;

            switch(type)
            {
                case ColumnType.CUSTOM:
                    physicalTypeString = customType;
                    break;
                case ColumnType.INT32:
                    physicalTypeString = "INTEGER";
                    break;
                case ColumnType.UINT32:
                    physicalTypeString = "INTEGER";
                    break;
                case ColumnType.INT64:
                    physicalTypeString = "BIGINT";
                    break;
                case ColumnType.UINT64:
                    physicalTypeString = "BIGINT";
                    break;
                case ColumnType.DOUBLE:
                    physicalTypeString = "FLOAT";
                    break;
                case ColumnType.FLOAT:
                    physicalTypeString = "FLOAT";
                    break;
                case ColumnType.BOOL:
                    physicalTypeString = "BIT";
                    break;
                case ColumnType.DATE:
                    physicalTypeString = "DATE";
                    break;
                case ColumnType.TIME:
                    physicalTypeString = String.Format("TIME({0})",scale >= 0 ? scale : 7);
                    break;
                case ColumnType.DATETIME:
                    //physicalTypeString = String.Format("DATETIMEOFFSET({0})", scale >= 0 ? scale : 7);
                    physicalTypeString = "DATETIME2(7)";
                    break;
                case ColumnType.DECIMAL:
                    physicalTypeString = String.Format("DECIMAL({0},{1})", precision >= 1 ? precision : 38, scale >= 0 ? scale : 0);
                    break;
                case ColumnType.BINARY:
                    physicalTypeString = String.Format("BINARY VARYING({0})", length <= 8000 ? length.ToString() : "max");
                    break;
                case ColumnType.WSTR:
                    physicalTypeString = String.Format("NATIONAL CHARACTER VARYING({0})", length <= 4000 ? length.ToString() : "max");
                    break;
                case ColumnType.STR:
                    physicalTypeString = String.Format("CHARACTER VARYING({0})", length <= 8000 ? length.ToString() : "max");
                    break;
                default:
                    throw new Exception("Unknown Data Type");
            }
            return physicalTypeString;
        }
Exemplo n.º 25
0
 public void InsertDMIn(TwitterDirectMessage dm, ColumnType colType)
 {
     for (int i = 0; i < flowColumns.Controls.Count; i++) {
     ColumnControl cc = (ColumnControl)flowColumns.Controls[i];
     if (cc.ColType == colType) {
       cc.InsertDM(cc.flowColumn, dm);
     }
       }
 }
Exemplo n.º 26
0
 public void InsertTweetIn(TwitterStatus tweet, ColumnType colType)
 {
     for (int i = 0; i < flowColumns.Controls.Count; i++) {
     ColumnControl cc = (ColumnControl)flowColumns.Controls[i];
     if (cc.ColType == colType) {
       cc.InsertTweet(cc.flowColumn, tweet);
     }
       }
 }
Exemplo n.º 27
0
		private Column GetColumn(ColumnType type)
		{
			foreach (Column column in (List<Column>) this.Columns)
			{
				if (type == column.ColumnType)
					return column;
			}
			return (Column)null;
		}
Exemplo n.º 28
0
 /// <summary>
 /// Initializes a new instance of the ImageListViewColumnHeader class.
 /// </summary>
 /// <param name="type">The type of data to display in this column.</param>
 /// <param name="text">Text of the column header.</param>
 /// <param name="width">Width in pixels of the column header.</param>
 public ImageListViewColumnHeader(ColumnType type, string text, int width)
 {
     mImageListView = null;
     owner = null;
     mText = text;
     mType = type;
     mWidth = width;
     mVisible = true;
     mDisplayIndex = -1;
 }
Exemplo n.º 29
0
        private bool _unique; // just for scripting; all indexes are made unique

        #endregion Fields

        #region Constructors

        public Index(string name, int[] column, ColumnType[] type, bool unique)
        {
            _name = name;
            _fields = column.Length;
            _column = column;
            _type = type;
            _unique = unique;
            _column_0 = _column[0];
            _type_0 = _type[0];
        }
Exemplo n.º 30
0
        public TestFactory()
        {
            ObservableCollection<ColumnType> listOfProperties = new ObservableCollection<ColumnType>();

            ColumnType ct = new ColumnType();
            ct.Name = "name";
            ct.Type = typeof(string).AssemblyQualifiedName;
            listOfProperties.Add(ct);
            factory = Factory.GetInstance(listOfProperties);
        }
Exemplo n.º 31
0
        /// <summary>
        /// Refresh the dynamic columns
        /// </summary>
        public void Refresh()
        {
            if (_source == null || !DynamicColumns)
            {
                return;
            }

            try
            {
                Information = "";
                Error       = "";
                MustRefresh = true;
                //Build table def from SQL or table name

                var sql = "";
                if (IsForSQLModel)
                {
                    if (Model.UseRawSQL)
                    {
                        sql = Sql;
                    }
                    else
                    {
                        sql = string.Format("SELECT * FROM ({0}) a WHERE 1=0", Sql);
                    }
                }
                else
                {
                    string CTE = "", name = "";
                    GetExecSQLName(ref CTE, ref name);
                    sql = string.Format("{0}SELECT * FROM {1} WHERE 1=0", CTE, name);
                }

                DataTable defTable = GetDefinitionTable(sql);

                foreach (DataColumn column in defTable.Columns)
                {
                    string     fullColumnName = (IsSQL && !IsForSQLModel ? Source.GetTableName(AliasName) + "." : "") + Source.GetColumnName(column.ColumnName);
                    MetaColumn newColumn      = Columns.FirstOrDefault(i => i.Name == fullColumnName);
                    column.ColumnName = fullColumnName; //Set it here to clear the columns later
                    ColumnType type = Helper.NetTypeConverter(column.DataType);
                    if (newColumn == null)
                    {
                        newColumn              = MetaColumn.Create(fullColumnName);
                        newColumn.Source       = _source;
                        newColumn.DisplayName  = (KeepColumnNames ? column.ColumnName.Trim() : Helper.DBNameToDisplayName(column.ColumnName.Trim()));
                        newColumn.Category     = (Alias == MetaData.MasterTableName ? "Master" : AliasName);
                        newColumn.DisplayOrder = GetLastDisplayOrder();
                        Columns.Add(newColumn);
                        newColumn.Type = type;
                        newColumn.SetStandardFormat();
                    }
                    newColumn.Source = _source;
                    if (type != newColumn.Type)
                    {
                        newColumn.Type = type;
                        newColumn.SetStandardFormat();
                    }
                }

                //Clear columns for No SQL or SQL Model
                if (!IsSQL || IsForSQLModel)
                {
                    Columns.RemoveAll(i => !defTable.Columns.Contains(i.Name));
                }

                MustRefresh = false;
                Information = "Dynamic columns have been refreshed successfully";
            }
            catch (Exception ex)
            {
                Error       = ex.Message;
                Information = "Error got when refreshing dynamic columns.";
            }
            Information = Helper.FormatMessage(Information);
            UpdateEditorAttributes();
        }
Exemplo n.º 32
0
        // Checks that all the label columns of the model have the same key type as their label column - including the same
        // cardinality and the same key values, and returns the cardinality of the label column key.
        private static int CheckKeyLabelColumnCore <T>(IHostEnvironment env, IPredictorModel[] models, KeyType labelType, ISchema schema, int labelIndex, ColumnType keyValuesType)
            where T : IEquatable <T>
        {
            env.Assert(keyValuesType.ItemType.RawType == typeof(T));
            env.AssertNonEmpty(models);
            var labelNames = default(VBuffer <T>);

            schema.GetMetadata(MetadataUtils.Kinds.KeyValues, labelIndex, ref labelNames);
            var classCount = labelNames.Length;

            var curLabelNames = default(VBuffer <T>);

            for (int i = 1; i < models.Length; i++)
            {
                var model = models[i];
                var edv   = new EmptyDataView(env, model.TransformModel.InputSchema);
                model.PrepareData(env, edv, out RoleMappedData rmd, out IPredictor pred);
                var labelInfo = rmd.Schema.Label;
                if (labelInfo == null)
                {
                    throw env.Except("Training schema for model {0} does not have a label column", i);
                }

                var curLabelType = rmd.Schema.Schema.GetColumnType(rmd.Schema.Label.Index);
                if (!labelType.Equals(curLabelType.AsKey))
                {
                    throw env.Except("Label column of model {0} has different type than model 0", i);
                }

                var mdType = rmd.Schema.Schema.GetMetadataTypeOrNull(MetadataUtils.Kinds.KeyValues, labelInfo.Index);
                if (!mdType.Equals(keyValuesType))
                {
                    throw env.Except("Label column of model {0} has different key value type than model 0", i);
                }
                rmd.Schema.Schema.GetMetadata(MetadataUtils.Kinds.KeyValues, labelInfo.Index, ref curLabelNames);
                if (!AreEqual(ref labelNames, ref curLabelNames))
                {
                    throw env.Except("Label of model {0} has different values than model 0", i);
                }
            }
            return(classCount);
        }
Exemplo n.º 33
0
 public string[] GetLabelNamesOrNull(out ColumnType labelType)
 {
     Host.AssertNonEmpty(PredictorModels);
     return(PredictorModels[0].GetLabelInfo(Host, out labelType));
 }
            private static IDataTransform CreateLambdaTransform(IHost host, IDataView input, string inputColumnName,
                                                                string outputColumnName, Action <TState> initFunction, bool hasBuffer, ColumnType outputColTypeOverride)
            {
                var inputSchema = SchemaDefinition.Create(typeof(DataBox <TInput>));

                inputSchema[0].ColumnName = inputColumnName;

                var outputSchema = SchemaDefinition.Create(typeof(DataBox <TOutput>));

                outputSchema[0].ColumnName = outputColumnName;

                if (outputColTypeOverride != null)
                {
                    outputSchema[0].ColumnType = outputColTypeOverride;
                }

                Action <DataBox <TInput>, DataBox <TOutput>, TState> lambda;

                if (hasBuffer)
                {
                    lambda = MapFunction;
                }
                else
                {
                    lambda = MapFunctionWithoutBuffer;
                }

                return(LambdaTransform.CreateMap(host, input, lambda, initFunction, inputSchema, outputSchema));
            }
Exemplo n.º 35
0
        private bool IsNumeric(int ind)
        {
            ColumnType c = columnTypes[ind];

            return(c == ColumnType.Expression || c == ColumnType.Integer || c == ColumnType.Numeric || c == ColumnType.NumericLog);
        }
Exemplo n.º 36
0
 public ColumnAttribute(string columnName, ColumnType columnType)
 {
     this.ColumnName = columnName;
     this.ColumnType = columnType;
 }
Exemplo n.º 37
0
 /// <summary>
 ///     Assign a normalizer to the specified column type for output.
 /// </summary>
 /// <param name="colType">The column type.</param>
 /// <param name="norm">The normalizer.</param>
 public void AssignOutputNormalizer(ColumnType colType, INormalizer norm)
 {
     _outputNormalizers[colType] = norm;
 }
 /// <summary>
 /// Whether this type is a standard scalar type completely determined by its <see cref="ColumnType.RawType"/>
 /// (not a <see cref="KeyType"/> or <see cref="StructuredType"/>, etc).
 /// </summary>
 public static bool IsStandardScalar(this ColumnType columnType) =>
 (columnType is NumberType) || (columnType is TextType) || (columnType is BoolType) ||
 (columnType is TimeSpanType) || (columnType is DateTimeType) || (columnType is DateTimeOffsetType);
 /// <summary>
 /// Zero return means either it's not a key type or the cardinality is unknown.
 /// </summary>
 public static int GetKeyCount(this ColumnType columnType) => (columnType as KeyType)?.Count ?? 0;
Exemplo n.º 40
0
 internal abstract IColumnFunctionBuilder MakeBuilder(IHost host, int srcIndex, ColumnType srcType, RowCursor cursor);
 public ExportColumn()
 {
     columnType = ColumnType.InternalName;
 }
 public ExportColumn(ColumnType _columnType)
 {
     columnType = _columnType;
 }
Exemplo n.º 43
0
        // When the label column is not a key, we check that the number of classes is the same for all the predictors, by checking the
        // OutputType property of the IValueMapper.
        // If any of the predictors do not implement IValueMapper we throw an exception. Returns the class count.
        private static int CheckNonKeyLabelColumnCore(IHostEnvironment env, IPredictor pred, IPredictorModel[] models, bool isBinary, ColumnType labelType)
        {
            env.Assert(!labelType.IsKey);
            env.AssertNonEmpty(models);

            if (isBinary)
            {
                return(2);
            }

            // The label is numeric, we just have to check that the number of classes is the same.
            if (!(pred is IValueMapper vm))
            {
                throw env.Except("Cannot determine the number of classes the predictor outputs");
            }
            var classCount = vm.OutputType.VectorSize;

            for (int i = 1; i < models.Length; i++)
            {
                var model = models[i];
                var edv   = new EmptyDataView(env, model.TransformModel.InputSchema);
                model.PrepareData(env, edv, out RoleMappedData rmd, out pred);
                vm = pred as IValueMapper;
                if (vm.OutputType.VectorSize != classCount)
                {
                    throw env.Except("Label of model {0} has different number of classes than model 0", i);
                }
            }
            return(classCount);
        }
Exemplo n.º 44
0
        /// <summary>
        /// Returns the sub item item text corresponding to the specified column type.
        /// </summary>
        /// <param name="type">The type of information to return.</param>
        /// <returns>Formatted text for the given column type.</returns>
        public string GetSubItemText(ColumnType type)
        {
            switch (type)
            {
            case ColumnType.DateAccessed:
                if (DateAccessed == DateTime.MinValue)
                {
                    return("");
                }
                else
                {
                    return(DateAccessed.ToString("g"));
                }

            case ColumnType.DateCreated:
                if (DateCreated == DateTime.MinValue)
                {
                    return("");
                }
                else
                {
                    return(DateCreated.ToString("g"));
                }

            case ColumnType.DateModified:
                if (DateModified == DateTime.MinValue)
                {
                    return("");
                }
                else
                {
                    return(DateModified.ToString("g"));
                }

            case ColumnType.FileName:
                return(FileName);

            case ColumnType.Name:
                return(Text);

            case ColumnType.FilePath:
                return(FilePath);

            case ColumnType.FileSize:
                if (FileSize == 0)
                {
                    return("");
                }
                else
                {
                    return(Utility.FormatSize(FileSize));
                }

            case ColumnType.FileType:
                return(FileType);

            case ColumnType.Dimensions:
                if (Dimensions == Size.Empty)
                {
                    return("");
                }
                else
                {
                    return(string.Format("{0} x {1}", Dimensions.Width, Dimensions.Height));
                }

            case ColumnType.Resolution:
                if (Resolution == SizeF.Empty)
                {
                    return("");
                }
                else
                {
                    return(string.Format("{0} x {1}", Resolution.Width, Resolution.Height));
                }

            case ColumnType.ImageDescription:
                return(ImageDescription);

            case ColumnType.EquipmentModel:
                return(EquipmentModel);

            case ColumnType.DateTaken:
                if (DateTaken == DateTime.MinValue)
                {
                    return("");
                }
                else
                {
                    return(DateTaken.ToString("g"));
                }

            case ColumnType.Artist:
                return(Artist);

            case ColumnType.Copyright:
                return(Copyright);

            case ColumnType.ExposureTime:
                return(ExposureTime);

            case ColumnType.FNumber:
                if (FNumber == 0.0f)
                {
                    return("");
                }
                else
                {
                    return(FNumber.ToString("f2"));
                }

            case ColumnType.ISOSpeed:
                if (ISOSpeed == 0)
                {
                    return("");
                }
                else
                {
                    return(ISOSpeed.ToString());
                }

            case ColumnType.ShutterSpeed:
                return(ShutterSpeed);

            case ColumnType.Aperture:
                return(Aperture);

            case ColumnType.UserComment:
                return(UserComment);

            default:
                throw new ArgumentException("Unknown column type", "type");
            }
        }
Exemplo n.º 45
0
 /// <summary>
 /// 构造
 /// </summary>
 /// <param name="columnType"></param>
 public NumberPrecentageDataType(ColumnType columnType) : base(columnType)
 {
 }
        private IColumnView readArrayColumn(JsonReader reader, ColumnType type, int rowCount)
        {
            readCheck(reader, JsonToken.PropertyName, "values");
            readCheck(reader, JsonToken.StartArray);
            switch (type)
            {
            case ColumnType.String:
            {
                string[] values = new string[rowCount];
                int      i      = 0;
                while (i < rowCount)
                {
                    values[i++] = reader.ReadAsString();
                }
                readCheck(reader, JsonToken.EndArray);

                return(new StringArrayColumnView(values));
            }

            case ColumnType.Number:
            {
                double[] values = new double[rowCount];
                int      i      = 0;
                while (i < rowCount)
                {
                    reader.Read();
                    if (reader.TokenType == JsonToken.Null)
                    {
                        values[i++] = double.NaN;
                    }
                    else
                    {
                        values[i++] = (double)reader.Value;
                    }
                }
                readCheck(reader, JsonToken.EndArray);

                return(new DoubleArrayColumnView(values));
            }

            case ColumnType.Boolean:
            {
                byte[] values = new byte[rowCount];
                int    i      = 0;
                while (i < rowCount)
                {
                    reader.Read();
                    if (reader.TokenType == JsonToken.Null)
                    {
                        values[i++] = BooleanArrayColumnView.MISSING;
                    }
                    else
                    {
                        values[i++] = (byte)(((bool)reader.Value) ? 1 : 0);
                    }
                }
                readCheck(reader, JsonToken.EndArray);

                return(new BooleanArrayColumnView(values));
            }
            }
            throw new Exception(string.Format("Unsupported type '{0}'", type));
        }
Exemplo n.º 47
0
        public Pair <int> constraintNum; //constraintNum is a catchall variable for the 4 different constraint types, since each can be labeled by 2 integers.
                                         //Cells are labelled by (row,column), rows by (row,content), columns by (column,content), and squares by (square, content).
                                         //Squares are labelled via: 1 2 3
                                         //                          4 5 6
                                         //                          7 8 9

        public SudokuColumnHeader(ColumnType t, Pair <int> constraints)
        {
            type = t; constraintNum = constraints;
        }
Exemplo n.º 48
0
 public Plays Plays(ColumnType type) => _plays.Single(x => x.Type == type);
Exemplo n.º 49
0
 public ColInfo(int index, ColumnType type)
 {
     Index = index;
     Type  = type;
 }
Exemplo n.º 50
0
 /// <summary>
 /// Adds an output variable to the list.
 /// </summary>
 public void AddOutputVariable(ColumnType type, string variableName, List <long> dim = null)
 {
     _host.CheckValue(type, nameof(type));
     _host.CheckParam(IsVariableDefined(variableName), nameof(variableName));
     _outputs.Add(OnnxUtils.GetModelArgs(type, variableName, dim));
 }
Exemplo n.º 51
0
 public GridEXColumn AddColumn(string colName, ColumnType colType, int width, ColumnBoundMode boundMode, string caption, FilterEditType editType)
 {
     return(AddColumn(colName, colType, width, boundMode, caption, editType, TextAlignment.Near));
 }
        /// <summary>
        /// The main constructor for the sequential transform
        /// </summary>
        /// <param name="host">The host.</param>
        /// <param name="windowSize">The size of buffer used for windowed buffering.</param>
        /// <param name="initialWindowSize">The number of datapoints picked from the beginning of the series for training the transform parameters if needed.</param>
        /// <param name="inputColumnName">The name of the input column.</param>
        /// <param name="outputColumnName">The name of the dst column.</param>
        /// <param name="outputColType"></param>
        private protected SequentialTransformerBase(IHost host, int windowSize, int initialWindowSize, string inputColumnName, string outputColumnName, ColumnType outputColType)
        {
            Host = host;
            Host.CheckParam(initialWindowSize >= 0, nameof(initialWindowSize), "Must be non-negative.");
            Host.CheckParam(windowSize >= 0, nameof(windowSize), "Must be non-negative.");
            // REVIEW: Very bad design. This base class is responsible for reporting errors on
            // the arguments, but the arguments themselves are not derived form any base class.
            Host.CheckNonEmpty(inputColumnName, nameof(PercentileThresholdTransform.Arguments.Source));
            Host.CheckNonEmpty(outputColumnName, nameof(PercentileThresholdTransform.Arguments.Source));

            InputColumnName   = inputColumnName;
            OutputColumnName  = outputColumnName;
            OutputColumnType  = outputColType;
            InitialWindowSize = initialWindowSize;
            WindowSize        = windowSize;
        }
Exemplo n.º 53
0
 public ColumnDef(string name, ColumnType type, int ord)
 {
     name_ = Utils.normalizeName(name);
     type_ = type; ordinal_ = ord;
 }
Exemplo n.º 54
0
        /* Function: GetColumn
         * Returns the bounds of a parameter's column and what type it is, which depends on <ColumnOrder>.  You *must* call
         * <CalculateColumns()> beforehand.  Returns false if the column index is out of bounds or the contents are empty for
         * that particular slot.
         */
        public bool GetColumn(int columnIndex, out TokenIterator start, out TokenIterator end, out ColumnType type)
        {
            if (columnIndex >= columnIndexes.Length)
            {
                start = parsedPrototype.Tokenizer.LastToken;
                end   = parsedPrototype.Tokenizer.LastToken;
                type  = ColumnType.Name;
                return(false);
            }

            int startIndex = columnIndexes[columnIndex];
            int endIndex   = (columnIndex + 1 >= columnIndexes.Length ? endOfColumnsIndex : columnIndexes[columnIndex + 1]);

            start = parsedPrototype.Tokenizer.FirstToken;

            if (startIndex > 0)
            {
                start.Next(startIndex);
            }

            end = start;

            if (endIndex > startIndex)
            {
                end.Next(endIndex - startIndex);
            }

            type = ColumnOrder[columnIndex];

            end.PreviousPastWhitespace(PreviousPastWhitespaceMode.EndingBounds, start);
            start.NextPastWhitespace(end);

            return(end > start);
        }
Exemplo n.º 55
0
 public ColumnBinding(string property, ColumnType type) : this(property, property, type)
 {
 }
Exemplo n.º 56
0
 /// <summary>
 /// Establishes a new mapping from an data view column in the context, if necessary generates a unique name, and
 /// returns that newly allocated name.
 /// </summary>
 /// <param name="type">The data view type associated with this column name</param>
 /// <param name="colName">The data view column name</param>
 /// <param name="skip">Whether we should skip the process of establishing the mapping from data view column to
 /// ONNX variable name.</param>
 /// <returns>The returned value is the name of the variable corresponding </returns>
 public abstract string AddIntermediateVariable(ColumnType type, string colName, bool skip = false);
Exemplo n.º 57
0
 public void ForcePlay(ColumnType columnType)
 {
     HasForcedPlay        = true;
     ForcedPlayColumnType = columnType;
 }
 public void ShowFieldSelector(int i)
 {
     columnType = (ColumnType)EditorGUILayout.EnumPopup("Column #" + (i + 1).ToString(), columnType);
 }
Exemplo n.º 59
0
 internal override IColumnFunctionBuilder MakeBuilder(IHost host, int srcIndex, ColumnType srcType, RowCursor cursor)
 => NormalizeTransform.LogMeanVarUtils.CreateBuilder(this, host, srcIndex, srcType, cursor);
Exemplo n.º 60
0
 internal override IColumnFunctionBuilder MakeBuilder(IHost host, int srcIndex, ColumnType srcType, RowCursor cursor)
 => NormalizeTransform.SupervisedBinUtils.CreateBuilder(this, host, LabelColumn, srcIndex, srcType, cursor);