Exemple #1
0
        public override object[,] ObjInfo(object column, object row)
        {
            if (column.ToString().Length == 0 && row.ToString().Length == 0)
            {
                var result = new MatrixBuilder();
                result.Add(new object[, ] {
                    { UpperLeft }
                }, false, true, false);
                result.Add(ColumnHeaders, true, false, true);
                result.Add(RowHeaders, false, true, false);
                result.Add(Content, true, false, false);
                return(result.Deliver());
            }
            if (Convert.ToInt32(column) == -1 && Convert.ToInt32(row) == -1)
            {
                return new object[, ] {
                           { UpperLeft }
                }
            }
            ;
            if (Convert.ToInt32(column) == -1 && row.ToString().Length == 0)
            {
                var result = new object[Content.GetLength(0), 1];

                for (var iRow = 0; iRow < Content.GetLength(0); iRow++)
                {
                    result[iRow, 0] = RowHeaders[iRow];
                }
                return(result);
            }
            return(base.ObjInfo(column, FindHeader(row, RowHeaders, "Row")));
        }
    }
Exemple #2
0
 public override object[,] ObjInfo(object column, object row)
 {
     if (column.ToString().Length == 0 && row.ToString().Length == 0)
     {
         var result = new MatrixBuilder();
         result.Add(ColumnHeaders, false, true, true);
         result.Add(Content, false, true, false);
         return(result.Deliver());
     }
     if (row.ToString().Length == 0 && Convert.ToInt32(row) == -1)
     {
         var result = new MatrixBuilder();
         result.Add(ColumnHeaders, false, true, true);
         return(result.Deliver());
     }
     return(base.ObjInfo(FindHeader(column, ColumnHeaders, "Column"), row));
 }
Exemple #3
0
        public object[,] Display()
        {
            FieldInfo[]   keyList = GetType().GetFields(BindingFlags.Public | BindingFlags.Instance);
            MatrixBuilder result  = new MatrixBuilder();

            foreach (var key in keyList)
            {
                if (key.GetValue(this) != null)
                {
                    result.Add(new[] { key.Name }, false, true, false);
                    if (typeof(IIMatrix).IsAssignableFrom(key.FieldType))
                    {
                        result.Add(((IIMatrix)key.GetValue(this)).ObjInfo("", ""), true, true, false);
                    }
                    else
                    {
                        result.Add(new[] { key.GetValue(this) }, true, false, false);
                    }
                }
            }
            return(result.Deliver());
        }
Exemple #4
0
        public object[,] ObjInfo(object column, object row)
        {
            int iCol;
            var keyList = GetType().GetFields(BindingFlags.Public | BindingFlags.Instance);
            var nCol    = keyList.Length;

            if (column.ToString().Length == 0 && row.ToString().Length == 0)
            {
                var header = new string[nCol];
                for (iCol = 0; iCol < nCol; iCol++)
                {
                    header[iCol] = keyList[iCol].Name;
                }
                var resi = new MatrixBuilder();
                resi.Add(header, false, true, true);
                resi.Add((Array)keyList[0].GetValue(this), false, true, false);
                for (iCol = 1; iCol < nCol; iCol++)
                {
                    resi.Add((Array)keyList[iCol].GetValue(this), true, false, false);
                }
                return(resi.Deliver());
            }
            if (column.ToString().Length == 0 && Convert.ToInt32(row) == -1)
            {
                var result2 = new object[1, nCol];
                for (iCol = 0; iCol < nCol; iCol++)
                {
                    result2[0, iCol] = keyList[iCol].Name;
                }
                return(result2);
            }
            for (iCol = 0; iCol < nCol; iCol++)
            {
                if (keyList[iCol].Name.Equals(column))
                {
                    break;
                }
            }
            if (iCol == nCol)
            {
                return new object[, ] {
                           { "Column " + column + " not found!" }
                }
            }
            ;
            var b = (Array)keyList[iCol].GetValue(this);

            if (b.Length == 0)
            {
                return new object[, ] {
                           { "Column " + column + " has not been initialized!" }
                }
            }
            ;
            if (row.ToString().Length == 0)
            {
                return new[, ] {
                           { b.GetValue(Convert.ToInt32(row)) }
                }
            }
            ;
            var result = new object[b.Length, 1];

            for (int iRow = 0; iRow < b.Length; iRow++)
            {
                result[iRow, 0] = b.GetValue(iRow);
            }
            return(result);
        }
    }
}