public override bool Equals(ColumnType other) { if (other == this) { return(true); } var tmp = other.AsVector; if (tmp == null) { return(false); } if (!_itemType.Equals(tmp._itemType)) { return(false); } if (_size != tmp._size) { return(false); } int count = Utils.Size(_dims); if (count != Utils.Size(tmp._dims)) { return(false); } if (count == 0) { return(true); } for (int i = 0; i < count; i++) { if (_dims[i] != tmp._dims[i]) { return(false); } } return(true); }
/// <summary> /// Tries to get the metadata kind of the specified type for a column. /// </summary> /// <typeparam name="T">The raw type of the metadata, should match the PrimitiveType type</typeparam> /// <param name="schema">The schema</param> /// <param name="type">The type of the metadata</param> /// <param name="kind">The metadata kind</param> /// <param name="col">The column</param> /// <param name="value">The value to return, if successful</param> /// <returns>True if the metadata of the right type exists, false otherwise</returns> public static bool TryGetMetadata <T>(this Schema schema, PrimitiveType type, string kind, int col, ref T value) { Contracts.CheckValue(schema, nameof(schema)); Contracts.CheckValue(type, nameof(type)); var metadataType = schema.GetMetadataTypeOrNull(kind, col); if (!type.Equals(metadataType)) { return(false); } schema.GetMetadata(kind, col, ref value); return(true); }