Exemple #1
0
        // Map HGrid to HHisItem[].  Grid must have ts and val columns.
        public static HHisItem[] gridToItems(HGrid grid)
        {
            HCol ts  = grid.col("ts");
            HCol val = grid.col("val");

            HHisItem[] items = new HHisItem[grid.numRows];
            for (int i = 0; i < items.Length; ++i)
            {
                HRow row = grid.row(i);
                // Timestamp can't be NULL but val can
                items[i] = new HHisItem((HDateTime)row.get(ts, true), row.get(val, false));
            }
            return(items);
        }
Exemple #2
0
        public override bool hequals(object o)
        {
            // Instance check
            if (o.Equals(this))
            {
                return(true);
            }
            // null and unlike type check
            if (o == null || GetType() != o.GetType())
            {
                return(false);
            }
            // further checks require it is of type HGrid
            if (!(o is HGrid))
            {
                return(false);
            }
            HGrid gridO = (HGrid)o;

            // Compare Meta
            if (!meta.hequals(gridO.meta))
            {
                return(false);
            }
            // Compare Cols - don't like the java implementation
            if (numCols != gridO.numCols)
            {
                return(false);
            }
            for (int iCurCol = 0; iCurCol < numCols; iCurCol++)
            {
                if (!col(iCurCol).hequals(gridO.col(iCurCol)))
                {
                    return(false);
                }
            }
            // Compare Rows - don't like the java implementation
            if (numRows != gridO.numRows)
            {
                return(false);
            }
            for (int iCurRow = 0; iCurRow < numRows; iCurRow++)
            {
                if (!row(iCurRow).hequals(gridO.col(iCurRow)))
                {
                    return(false);
                }
            }
            return(true);
        }