///////////////////////////////////////////////////////////////////i/////// // Utils ////////////////////////////////////////////////////////////////////////// void verifyGrid(string str, HDict meta, object[] cols, HVal[][] rows) { /* * System.out.println(); * System.out.println("###############################################"); * System.out.println(); * System.out.println(str); */ // normalize nulls if (meta == null) { meta = HDict.Empty; } for (int i = 0; i < cols.Length; ++i) { if (cols[i] == null) { cols[i] = HDict.Empty; } } // read from zinc HGrid grid = new HZincReader(str).readGrid(); verifyGridEq(grid, meta, cols, rows); // write grid and verify we can parse that too string writeStr = HZincWriter.gridToString(grid); HGrid writeGrid = new HZincReader(writeStr).readGrid(); verifyGridEq(writeGrid, meta, cols, rows); }
// Depart from Java - This has a method where mimetype selection can be specified - NOTE: This toolkit // does not yet support a JsonReader private HGrid postGrid(string op, HGrid req, string mimeType) { string reqStr = HZincWriter.gridToString(req); string resStr = postString(uri + op, reqStr, mimeType); return(new HZincReader(resStr).readGrid()); }
private async Task <HGrid> PostGridAsync(string op, HGrid req, string mimeType) { string reqStr = HZincWriter.gridToString(req); string resStr = await PostStringAsync(op, reqStr, mimeType); return(new HZincReader(resStr).readGrid()); }
/** * Call "evalAll" operation to evaluate a batch of vendor specific * expressions on the server. See "eval" method for list of vendor * expression formats. The request grid must specify an "expr" column. * A separate grid is returned for each row in the request. If checked * is false, then this call does *not* automatically check for error * grids. Client code must individual check each grid for partial * failures using "Grid.isErr". If checked is true and one of the * requests failed, then raise CallErrException for first failure. */ public HGrid[] evalAll(HGrid req, bool bChecked) { string reqStr = HZincWriter.gridToString(req); string resStr = postString(uri + "evalAll", reqStr); HGrid[] res = new HZincReader(resStr).readGrids(); if (bChecked) { for (int i = 0; i < res.Length; ++i) { if (res[i].isErr()) { throw new CallErrException(res[i]); } } } return(res); }
/** * Call "evalAll" operation to evaluate a batch of vendor specific * expressions on the server. See "eval" method for list of vendor * expression formats. The request grid must specify an "expr" column. * A separate grid is returned for each row in the request. If checked * is false, then this call does *not* automatically check for error * grids. Client code must individual check each grid for partial * failures using "Grid.isErr". If checked is true and one of the * requests failed, then raise CallErrException for first failure. */ public async Task <HGrid[]> EvalAllAsync(HGrid req, bool bChecked) { string reqStr = HZincWriter.gridToString(req); string resStr = await PostStringAsync("evalAll", reqStr, "text/zinc"); HGrid[] res = new HZincReader(resStr).readGrids(); if (bChecked) { for (int i = 0; i < res.Length; ++i) { if (res[i].isErr()) { throw new CallErrException(res[i]); } } } return(res); }
// .NET Implementation in case it is wpf testing or something else where // stdout and debug out is not available public string dumpAsString() { return(HZincWriter.gridToString(this)); }
// .NET Implementation writing to stdout (Console) public void dumpToConsole() { Console.WriteLine(HZincWriter.gridToString(this)); }
// As per HDict comments .NET does not need a hashcode ////////////////////////////////////////////////////////////////////////// // Debug ////////////////////////////////////////////////////////////////////////// // .NET Implementation writing to Debug out public void dump() { Debug.WriteLine(HZincWriter.gridToString(this)); Debug.Flush(); }
// HDict needed here // Create iteratator to walk each row - Removed as it is not needed /*public IEnumerable<HRow> iterator() * { * return (m_rows.AsEnumerable()); * }*/ ////////////////////////////////////////////////////////////////////////// // HVal ////////////////////////////////////////////////////////////////////////// public override string toZinc() { return(HZincWriter.valToString(this)); }