コード例 #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="UPConfigAnalysis"/> class.
        /// </summary>
        /// <param name="definition">
        /// The definition.
        /// </param>
        public UPConfigAnalysis(List <object> definition)
        {
            this.QueryName = definition[1] as string;
            var tableDefs = (definition[2] as JArray)?.ToObject <List <object> >();

            if (tableDefs != null && tableDefs.Any())
            {
                var tables = new List <UPConfigAnalysisTable>(tableDefs.Count);
                foreach (JArray tableDef in tableDefs)
                {
                    var table = new UPConfigAnalysisTable(tableDef?.ToObject <List <object> >(), this);
                    tables.Add(table);
                }

                this.Tables = tables;
            }

            var valueDefs = (definition[4] as JArray)?.ToObject <List <object> >();

            if (valueDefs != null && valueDefs.Count > 0)
            {
                var values = new List <UPConfigAnalysisValue>(valueDefs.Count);
                foreach (JArray valueDef in valueDefs)
                {
                    var value = new UPConfigAnalysisValue(valueDef?.ToObject <List <object> >(), this);
                    values.Add(value);
                }

                this.Values = values;
            }

            var resultColumnDefs = (definition[3] as JArray)?.ToObject <List <object> >();

            if (resultColumnDefs != null && resultColumnDefs.Count > 0)
            {
                var resultColumns = new List <UPConfigAnalysisResultColumn>(resultColumnDefs.Count);
                foreach (JArray resultColumnDef in resultColumnDefs)
                {
                    var resultColumn = new UPConfigAnalysisResultColumn(resultColumnDef?.ToObject <List <object> >(), this);
                    resultColumns.Add(resultColumn);
                }

                this.ResultColumns = resultColumns;
            }

            if (definition.Count < 8)
            {
                this.MaxBars = 0;
                this.Options = 0;
                this.Flags   = 0;
            }
            else
            {
                this.MaxBars = JObjectExtensions.ToInt(definition[5]);
                this.Options = JObjectExtensions.ToInt(definition[6]);
                this.Flags   = JObjectExtensions.ToInt(definition[7]);
            }
        }
コード例 #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="UPConfigAnalysisField"/> class.
        /// </summary>
        /// <param name="definition">
        /// The definition.
        /// </param>
        /// <param name="analysisTable">
        /// The analysis table.
        /// </param>
        public UPConfigAnalysisField(List <object> definition, UPConfigAnalysisTable analysisTable)
        {
            if (definition == null || definition.Count < 8)
            {
                return;
            }

            this.AnalysisTable = analysisTable;
            this.FieldId       = JObjectExtensions.ToInt(definition[0]);
            this.Flags         = JObjectExtensions.ToInt(definition[1]);
            this.DefaultValue  = definition[2] as string;
            this.DefaultEnd    = definition[3] as string;
            this.CategoryName  = definition[4] as string;
            this.ListColNr     = JObjectExtensions.ToInt(definition[5]);
            this.ListWidth     = JObjectExtensions.ToInt(definition[6]);
            this.Options       = definition[7] as string;
            this.Slices        = JObjectExtensions.ToInt(definition[8]);
        }