public int CompareTo(object obj) { if (obj is IntersectionInvolved) { IntersectionInvolved ii = (IntersectionInvolved)obj; if (this.TurnDirection == ii.TurnDirection) { if (this.Exit != null && ii.Exit == null) { return(-1); } else if (ii.Exit != null && ii.Exit != null) { return(0); } else if (ii.Exit == null && ii.Exit != null) { return(1); } else { return(0); } } else { return(this.TurnDirection.CompareTo(ii.TurnDirection)); } } else { return(-1); } }
/// <summary> /// Constructor /// </summary> /// <param name="turnFinal"></param> public ZoneAreaEntryMonitor(ArbiterPerimeterWaypoint turnFinal, ArbiterInterconnect ai, bool isOurs, IntersectionMonitor globalMonitor, IntersectionInvolved involved) { this.finalWaypoint = turnFinal; this.entryPolygon = this.GenerateEntryMonitorPolygon(ai); this.failedTimer = new Stopwatch(); this.isOurs = isOurs; this.globalMonitor = globalMonitor; this.involved = involved; }
public override bool Equals(object obj) { if (obj is IntersectionInvolved) { IntersectionInvolved other = (IntersectionInvolved)obj; return(other.Area.Equals(this.Area)); } return(false); }
/// <summary> /// Constructor /// </summary> /// <param name="globalMonitor"></param> /// <param name="involved"></param> public DominantLaneEntryMonitor(IntersectionMonitor globalMonitor, IntersectionInvolved involved) { this.waitingTimer = new Stopwatch(); this.globalMonitor = globalMonitor; this.lane = (ArbiterLane)involved.Area; this.involved = involved; if (involved.Exit != null) this.exit = (ArbiterWaypoint)involved.Exit; else this.exit = null; if (this.exit != null) { // create the polygon this.exitPolygon = this.ExitPolygon(); } }