/* Below are tool methods*/ /// <summary> /// Find the index of pair in list /// return -1 denotes list does not contains pair /// </summary> /// <param name="list"></param> /// <param name="pair"></param> /// <returns></returns> private int Indexof(List <AnotationPair> list, AnotationPair pair) { for (int i = 0; i < list.Count; i++) { if (list[i].indexChild == pair.indexChild && list[i].indexParent == pair.indexParent) { return(i); } } return(-1); }
private void AnotationPairConstruction(Range AttributeRange, Worksheet sheet, bool SampleConstruction = true) { this.anotationPairList = new List <AnotationPair>(); this.celllist = new List <Range>(); int rowcount = AttributeRange.Rows.Count; int colnum = AttributeRange.Column; for (int i = 1; i <= rowcount; i++) { celllist.Add(AttributeRange.Cells[i, colnum]); } // Exhaust Construction if (SampleConstruction) { for (int i = 0; i < celllist.Count; i++) { for (int j = i + 1; j < celllist.Count; j++) { if (i != j) { AnotationPair pair = new AnotationPair(celllist, i, j); anotationPairList.Add(pair); } } } } else { for (int i = 0; i < celllist.Count; i++) { if (celllist.Count - i <= this.RANDOMSAMPLECOUNT) { break; } for (int j = 0; j < this.RANDOMSAMPLECOUNT; j++) { Random rand = new Random(); int index = rand.Next(celllist.Count - i); AnotationPair pair = new AnotationPair(celllist, i, i + index); anotationPairList.Add(pair); } } } }
private void AnotationPairConstruction(Range AttributeRange, Worksheet sheet, List <Tuple <int, int> > indexPairList) { this.anotationPairList = new List <AnotationPair>(); this.celllist = new List <Range>(); int rowcount = AttributeRange.Rows.Count; int colnum = AttributeRange.Column; for (int i = 1; i <= rowcount; i++) { celllist.Add(AttributeRange.Cells[i, colnum]); } for (int i = 0; i < indexPairList.Count; i++) { AnotationPair pair = new AnotationPair(celllist, indexPairList[i].Item1, indexPairList[i].Item2); anotationPairList.Add(pair); } }
public AnotationPairEdge(AnotationPair pair1, AnotationPair pair2) { this.pair1 = pair1; this.pair2 = pair2; }