public void initZ(EventInterval s1, EventInterval s2, int ek, string Rnew, string Si, string Rprev, Dictionary <string, Dictionary <string, List <Tuple <List <EventInterval>, int> > > > Ak) { List <int> to_check = new List <int>(); to_check.Add(s2.getLabel()); to_check.Add(ek); List <EventInterval> candidates = this.getZTableSecondTable(to_check, Rnew, Si, s2); if (candidates == null) { return; } foreach (EventInterval s3 in candidates) { if (s3.getStart() - Math.Min(s1.getEnd(), s2.getEnd()) >= this.constraints["gap"]) { continue; } string Rk = Rprev; List <int> pair = new List <int>(); pair.Add(s1.getLabel()); pair.Add(s3.getLabel()); bool foundRelation = false; foreach (string Rcand in this.FL2[2][pair].Keys) { this.comparisoncount += 1; List <EventInterval> relatArr = this.getZTableSecondTable(pair, Rcand, Si, s1); if (relatArr != null && relatArr.Contains(s3)) { Rk += "_" + Rcand; foundRelation = true; break; } } if (foundRelation == false) { continue; } Rk += "_" + Rnew; if (!Ak.ContainsKey(Rk)) { Ak.Add(Rk, new Dictionary <string, List <Tuple <List <EventInterval>, int> > >()); Ak[Rk].Add(Si, new List <Tuple <List <EventInterval>, int> >()); } else if (!Ak[Rk].ContainsKey(Si)) { Ak[Rk].Add(Si, new List <Tuple <List <EventInterval>, int> >()); } List <EventInterval> intervals = new List <EventInterval>(); intervals.Add(s1); intervals.Add(s2); intervals.Add(s3); Tuple <List <EventInterval>, int> z = new Tuple <List <EventInterval>, int>(intervals, Math.Min(Math.Min(s1.getEnd(), s2.getEnd()), s3.getEnd())); Ak[Rk][Si].Add(z); } }
public Tuple <List <EventInterval>, int> moveFollowsToEarlierIntervals(Tuple <List <EventInterval>, int> z, EventInterval sk, int k) { int fft = Math.Min(sk.getEnd(), z.Item2); List <EventInterval> newl = new List <EventInterval>(z.Item1); newl.Add(sk); Tuple <List <EventInterval>, int> znew = new Tuple <List <EventInterval>, int>(newl, fft); return(znew); }
public static string getRelation(EventInterval A, EventInterval B, Dictionary <string, double> constraints) { string relation = null; double epsilon = constraints["epsilon"]; double gap = constraints["gap"]; if (Math.Abs(B.getStart() - A.getStart()) <= epsilon) { if (Math.Abs(B.getEnd() - A.getEnd()) <= epsilon) { relation = "="; } else if (B.getEnd() - A.getEnd() > epsilon) { relation = "S"; } } else if (Math.Abs(B.getEnd() - A.getEnd()) <= epsilon && B.getStart() - A.getStart() > epsilon) { relation = "fi"; } else if (B.getStart() - A.getStart() > epsilon && A.getEnd() - B.getEnd() > epsilon) { relation = "c"; } else if (A.getEnd() - B.getStart() > epsilon && B.getStart() - A.getStart() > epsilon) { relation = "o"; } else if (Math.Abs(B.getStart() - A.getEnd()) <= epsilon) { relation = "m"; } else if (B.getStart() - A.getEnd() > epsilon && (gap == 0 || B.getStart() - A.getEnd() < gap)) { relation = "<"; } return(relation); }