public void Add(SummonInformation summonInformation) { if (!_visitationPlan.Contains(summonInformation)) { _visitationPlan.Add(summonInformation); } }
public bool CanAddToExecutionPlan(SummonInformation summon) { if (summon.IsInsideCall()) { return(IsTriggeringSummonInExecutionPlan(summon.TriggeringSummon)); } return(true); }
public override bool Equals(object obj) { SummonInformation summonInfo = (SummonInformation)obj; if (summonInfo == null) { return(false); } return(this.SummonFloor == summonInfo.SummonFloor && this.Direction == summonInfo.Direction); }
public SummonInformation(int currentFloor, TravelDirection direction = TravelDirection.None, SummonInformation triggeringSummon = null) { SummonFloor = currentFloor; Direction = direction; if (direction == TravelDirection.None) { TriggeringSummon = triggeringSummon; } else { TriggeringSummon = null; } }
private bool IsTriggeringSummonInExecutionPlan(SummonInformation triggeringSummon) { return(_visitationPlan.Contains(triggeringSummon)); }
private bool IsFirstRequestForCurrentFloor(SummonInformation summonInformation) { return(CurrentFloor == summonInformation.SummonFloor); }
private TravelDirection DeduceTravelDirection(SummonInformation summon) { return((CurrentFloor < summon.SummonFloor) ? TravelDirection.Up : TravelDirection.Down); }
private TravelDirection GetInitialDirectionOfTravel(SummonInformation firstSummon) { return(firstSummon.SummonFloor == CurrentFloor ? firstSummon.Direction : DeduceTravelDirection(firstSummon)); }
private bool IsSummonRequestInBoundariesAndMatchingDirection(SummonInformation summon, TravelDirection direction, Tuple <int, int> boundaries) { return((summon.Direction == direction || summon.Direction == TravelDirection.None) && summon.SummonFloor.Between(boundaries.Item1, boundaries.Item2)); }
private bool NeedToRunSameSegmentInOppositeDirection(SummonInformation firstSummon, TravelDirection direction) { return(firstSummon.Direction != direction); }
public void SummonCall(SummonInformation summonInfo) { _door.RequestOpening(); }