private void BranchResultI(string sp, LLNCC sNode, LLNCC eNode, ResultCollection rc) { int count = 0; ResultSetI result = new ResultSetI(sNode.Value.Key, sp); double sum = 0; while (sNode != null && sNode != eNode.Next) { CqCollection cc = sNode.Value; if (cc.SamplesExist.Contains(sp)) { sum += cc[sp]; result.Node = sNode; count++; } else { break; } sNode = sNode.Next; } if (sum != 0) { double avg = sum / count; result.Result[0, 0] = avg; rc.SetResult(result); } }
public ResultCollection ToCalculate(IGroup group) { ResultCollection rc = new ResultCollection(); LLNCC node = group.Lists.Last; LLNCC fNode = node, nNode = node, bNode = node; double single = (double)(Maximum - Progress) / group.Lists.Count; while (node != null) { LLNCC preNode = node.Previous; if (preNode == null) { BranchToDeal(node, ref bNode, group.Samples, rc); } else { CqCollection preCqs = preNode.Value; CqCollection cqs = node.Value; int mark = cqs.Key.CompareTo(preCqs.Key); string name = cqs[cqs.SamplesExist[0]].TargetName; switch (mark) { case 3: case -3: //Branch不同 BranchToDeal(node, ref bNode, group.Samples, rc); break; case 2: case -2: //FID不同 fNode = preNode; BranchToDeal(node, ref bNode, group.Samples, rc); break; case 1: case -1: //Name不同 fNode = preNode; BranchToDeal(node, ref bNode, group.Samples, rc); nNode = preNode; break; case 0: //相同 break; } } node = node.Previous; Progress += single; } return(rc); }
protected override void WriteRow(int row, Dictionary <string, int> samples, LLNCC cqsNode, ResultCollection result) { CqCollection cqs = cqsNode.Value; Record first = cqs[cqs.SamplesExist[0]]; Write(first.TargetName, row, 3); Write(first.Date.ToString("yyyy-MM-dd"), row, 1); base.WriteRow(row, samples, cqsNode, result); }
public override void ToExcel(IGroup group, IExcWriter writer, ResultCollection result) { _writer = writer; double single = (double)(Maximum - Progress) / group.Lists.Count; LLNCC node = group.Lists.First; writer.Open(); int row = 0; Dictionary <string, int> kv = WriteHeader(group.Samples, row++); while (node != null) { CqCollection cqs = node.Value; WriteRow(row, kv, node, result); LLNCC next = node.Next; if (next != null) { int mark = cqs.Key.CompareTo(next.Value.Key); switch (mark) { case 3: case -3: break; case 2: case -2: break; case 1: case -1: //创建表头 row += 7; WriteHeader(group.Samples, row); break; case 0: break; } } row++; node = node.Next; Progress += single; } writer.Save(); writer.Close(); }
protected override void WriteRow(int row, Dictionary <string, int> samples, LinkedListNode <CqCollection> cqsNode, ResultCollection result) { CqCollection cqs = cqsNode.Value; Record r = cqs[cqs.SamplesExist[0]]; Write(r.TargetName, row, 1); Write(rep, row, 4); foreach (Record item in cqs.Records) { Write(r.Value, row, samples[item.SampleName]); } }
protected virtual void WriteRow(int row, Dictionary <string, int> samples, LLNCC cqsNode, ResultCollection result) { CqCollection cqs = cqsNode.Value; foreach (KeyValuePair <string, int> sp in samples) { Write(sp.Key, row, sp.Value); Record cq = cqs[sp.Key]; if (cq != null) { if (cq.SampleKey != cq.SampleName) { Write(cq.SampleName, row, sp.Value); } Write(cq.Value, row, sp.Value + 1); } ResultSetI rsi = new ResultSetI(cqs.Key, sp.Key); string key = rsi.Key; if (result != null && result.Results.ContainsKey(rsi.Key)) { rsi = result.Results[rsi.Key] as ResultSetI; if (rsi.Node == cqsNode) { int col = sp.Value + 2; for (int x = 0; x < rsi.X; x++) { for (int y = 0; y < rsi.Y; y++) { double value = rsi.Result[x, y]; if (value > 0) { Write(value, row + y, col + x); } } } } } } }
public override void ToExcel(IGroup group, IExcWriter writer, ResultCollection result) { _writer = writer; double single = (double)(Maximum - Progress) / group.Lists.Count; _writer.Open(); int row = 0; Dictionary <string, int> spIndex = WriteHeader(group.Samples, row++); LLNCC node = group.Lists.First; while (node != null) { CqCollection cqs = node.Value; LLNCC next = node.Next; WriteRow(row++, spIndex, node, result); if (next != null) { int mark = cqs.Key.CompareTo(next.Value.Key); switch (mark) { case 1: case -1: rep = 1; break; default: rep++; break; } } node = node.Next; Progress += single; } _writer.Save(); _writer.Close(); }