public void Clear() { deleteCount = 0; TernaryTable.Iter it = table.GetIter(); while (!it.Done()) { deleteIdxs = Array.Append(deleteIdxs, deleteCount, it.Index()); deleteList = Array.Append3(deleteList, deleteCount++, it.Get1(), it.Get2(), it.Get3()); it.Next(); } }
////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// public static void Write(DataWriter writer, int fieldSymbId, TernaryTable[] tables, int col1, int col2, int col3, int indentation, bool indentFirstLine, bool writeSeparator) { string baseWs = new string(Array.Repeat(' ', indentation)); string entryWs = new string(Array.Repeat(' ', indentation + 2)); int count = 0; for (int i = 0; i < tables.Length; i++) { count += tables[i].Size(); } if (indentFirstLine) { writer.Write(baseWs); } writer.Write(SymbObj.IdxToStr(fieldSymbId)); writer.Write(": ["); if (count > 0) { writer.Write("\n"); int written = 0; for (int i = 0; i < tables.Length; i++) { TernaryTable table = tables[i]; SurrObjMapper mapper1 = table.mapper1; SurrObjMapper mapper2 = table.mapper2; SurrObjMapper mapper3 = table.mapper3; TernaryTable.Iter it = table.GetIter(); while (!it.Done()) { writer.Write(entryWs); Obj obj1 = mapper1(it.Get1()); Obj obj2 = mapper2(it.Get2()); Obj obj3 = mapper3(it.Get3()); if (col1 == 0) { ObjPrinter.PrintNoFlush(obj1, writer); } else if (col1 == 1) { ObjPrinter.PrintNoFlush(obj2, writer); } else { ObjPrinter.PrintNoFlush(obj3, writer); } writer.Write(", "); if (col2 == 0) { ObjPrinter.PrintNoFlush(obj1, writer); } else if (col2 == 1) { ObjPrinter.PrintNoFlush(obj2, writer); } else { ObjPrinter.PrintNoFlush(obj3, writer); } writer.Write(", "); if (col3 == 0) { ObjPrinter.PrintNoFlush(obj1, writer); } else if (col3 == 1) { ObjPrinter.PrintNoFlush(obj2, writer); } else { ObjPrinter.PrintNoFlush(obj3, writer); } written++; writer.Write(written < count || count == 1 ? ";\n" : "\n"); it.Next(); } } Debug.Assert(written == count); writer.Write(baseWs); } writer.Write(writeSeparator ? "],\n" : "]\n"); }