Example #1
0
        public virtual void FromJson(JObject json, DcSpace ws) // Init this object fields by using json object
        {
            // No super-object

            Name  = (string)json["name"];
            IsKey = json["key"] != null?StringSimilarity.JsonTrue((string)json["key"]) : false;

            IsSuper = json["super"] != null?StringSimilarity.JsonTrue((string)json["super"]) : false;

            Input  = (DcTable)Utils.ResolveJsonRef((JObject)json["lesser_table"], ws);
            Output = (DcTable)Utils.ResolveJsonRef((JObject)json["greater_table"], ws);
        }
Example #2
0
        public DcTable GetSubTable(string name)
        {
            DcTable tab = null;
            if (StringSimilarity.SameTableName(Name, name))
            {
                tab = this;
            }

            foreach (DcColumn col in SubColumns)
            {
                if (tab != null) break;
                tab = col.Input.GetSubTable(name);
            }

            return tab;
        }
Example #3
0
        /// <summary>
        /// Creae storage for the function and its definition depending on the output set type.
        /// </summary>
        /// <returns></returns>
        public static DcColumnData CreateColumnData(DcTable type, DcColumn column)
        {
            DcColumnData colData = new ColumnDataEmpty();

            /*
             * if (column.Input != null && column.Input.Schema != null && column.Input.Schema.GetType() != typeof(Schema)) // Import col
             * {
             * }
             * else if (column.Output != null && column.Output.Schema != null && column.Output.Schema.GetType() != typeof(Schema)) // Output col
             * {
             * }
             */
            if (column.Input == null || column.Output == null)
            {
            }
            if (type == null || string.IsNullOrEmpty(type.Name))
            {
            }
            else if (StringSimilarity.SameTableName(type.Name, "Void"))
            {
            }
            else if (StringSimilarity.SameTableName(type.Name, "Top"))
            {
            }
            else if (StringSimilarity.SameTableName(type.Name, "Bottom")) // Not possible by definition
            {
            }
            else if (StringSimilarity.SameTableName(type.Name, "Root"))
            {
            }
            else if (StringSimilarity.SameTableName(type.Name, "Integer"))
            {
                colData = new ColumnData <int>(column);
            }
            else if (StringSimilarity.SameTableName(type.Name, "Double"))
            {
                colData = new ColumnData <double>(column);
            }
            else if (StringSimilarity.SameTableName(type.Name, "Decimal"))
            {
                colData = new ColumnData <decimal>(column);
            }
            else if (StringSimilarity.SameTableName(type.Name, "String"))
            {
                colData = new ColumnData <string>(column);
            }
            else if (StringSimilarity.SameTableName(type.Name, "Boolean"))
            {
                colData = new ColumnData <bool>(column);
            }
            else if (StringSimilarity.SameTableName(type.Name, "DateTime"))
            {
                colData = new ColumnData <DateTime>(column);
            }
            else if (StringSimilarity.SameTableName(type.Name, "Set"))
            {
            }
            else // User (non-primitive) set
            {
                colData = new ColumnData <int>(column);
            }

            return(colData);
        }
Example #4
0
 public virtual DcSchema GetSchema(string name)
 {
     return(_schemas.FirstOrDefault(x => StringSimilarity.SameTableName(x.Name, name)));
 }
Example #5
0
 public DcTable GetTable(string name) 
 { 
     DcColumn col = Columns.FirstOrDefault(d => StringSimilarity.SameColumnName(d.Output.Name, name));
     return col == null ? null : col.Input; 
 }
Example #6
0
        //
        // Name methods
        //

        public DcColumn GetColumn(string name)
        {
            return Columns.FirstOrDefault(d => StringSimilarity.SameColumnName(d.Name, name));
        }
Example #7
0
        public virtual DcTable GetPrimitiveType(string name)
        {
            DcColumn col = SubColumns.FirstOrDefault(x => StringSimilarity.SameTableName(x.Input.Name, name));

            return(col != null ? col.Input : null);
        }