public override void execEvent()
 {
     if (Simulation.EXPLICIT)
     {
         Console.WriteLine("Recruiting tram at station " + Place.Name + " at time " + Time.Now().ToString());
         if (Simulation.WAIT)
         {
             Console.ReadLine();
         }
     }
     Place.TramRecruit();
 }
 public override void execEvent()
 {
     if (Simulation.EXPLICIT)
     {
         Console.WriteLine("Waiting further passenger embarkation of tram " + Subject.TramNo.ToString() + " at station " + Place.Name + " at time " + Time.Now().ToString());
         if (Simulation.WAIT)
         {
             Console.ReadLine();
         }
     }
     if (!Place.Name.Trim().Equals(Subject.Position.Name.Trim()))
     {
         Console.WriteLine("At Execution of passembarkwait: place and subject.position do not match. " + Place.Name + " vs " + Subject.Position.Name);
         Console.ReadLine(); EventList.Sim.EmergencyExit();
     }
     Place.EndPassExchange(Subject, Pin, 0, true);
 }
        public TrackLock(int time, Tram tram, iHasRails place, int track, bool incoming)
        {
            Priority = 6;
            ETime    = time; Place = place; Track = track; Incoming = incoming;
            Place.LockTrack(track);
            Name = "TrackLock";
            if (Simulation.EXPLICIT)
            {
                Console.WriteLine("Starting tracklock of  at station " + Place.Name + " at time " + Time.Now().ToString());
                if (Simulation.WAIT)
                {
                    Console.ReadLine();
                }
            }

            base.addToList();
        }
 public override void execEvent()
 {
     if (Simulation.EXPLICIT)
     {
         Console.WriteLine("Ending tracklock at station " + Place.Name + " at time " + Time.Now().ToString());
         if (Simulation.WAIT)
         {
             Console.ReadLine();
         }
     }
     Place.UnlockTrack(Track);
 }
 public override void execEvent()
 {
     if (Simulation.EXPLICIT)
     {
         Console.WriteLine("Ending passenger transfer of tram " + Subject.TramNo.ToString() + " at station " + Place.Name + " at time " + Time.Now().ToString());
         Console.WriteLine(" In : " + PassIn.ToString() + " out : " + PassOut.ToString());
         if (Simulation.WAIT)
         {
             Console.ReadLine();
         }
     }
     if (!Place.Name.Trim().Equals(Subject.Position.Name.Trim()))
     {
         Console.WriteLine("At Execution of endpasstransfer: place and subject.position do not match. " + Place.Name + " vs " + Subject.Position.Name);
         Console.ReadLine(); EventList.Sim.EmergencyExit();
     }
     Place.EndPassExchange(Subject, PassIn, PassOut, Cont);
 }
 override public void execEvent()
 {
     if (Simulation.EXPLICIT)
     {
         Console.WriteLine("Ending of tram " + Subject.TramNo.ToString() + " at station " + Place.Name + " at time " + Time.Now().ToString());
         if (Simulation.WAIT)
         {
             Console.ReadLine();
         }
     }
     Place.handleArrival(Subject); //handle crossover locking for endstations here. For other stations: just start loading passengers and shit.
 }
        public static void addEvent(Event happening)
        {
            foreach (Event oud in list)
            {
                if ((happening.Subject != null) && oud.Subject != null && (happening.Name == oud.Name) && (happening.Subject.TramNo == oud.Subject.TramNo))
                {
                    Console.WriteLine("Duplicate event " + happening.Name + " detected at station " + happening.Place.Name + " for tram " + happening.Subject.TramNo.ToString());
                    Console.ReadLine(); Sim.EmergencyExit();
                }
                if ((happening.Subject != null) && oud.Subject != null && (happening.Subject.TramNo == oud.Subject.TramNo))
                {
                    Console.WriteLine("Dual event found for tram" + happening.Subject.TramNo.ToString() + ": " + happening.Name + " at " + happening.Place.Name + "  and " + oud.Name + " at " + oud.Place.Name);
                    Console.ReadLine(); Sim.EmergencyExit();
                }
            }


            int time = happening.ETime;

            for (int i = 0; i < list.Count(); i++)
            {
                if (time < list[i].ETime)
                {
                    list.Insert(i, happening);
                    if (Simulation.EXPLICIT)
                    {
                        Console.WriteLine("Inserted event " + happening.Name + " at station " + happening.Place.Name + " for time " + happening.ETime.ToString() + " at time " + Time.Now().ToString());
                    }
                    return;
                }
                else if (time == list[i].ETime && happening.Priority > list[i].Priority)
                {
                    list.Insert(i, happening);
                    if (Simulation.EXPLICIT)
                    {
                        Console.WriteLine("Inserted event " + happening.Name + " at station " + happening.Place.Name + " for time " + happening.ETime.ToString() + " at time " + Time.Now().ToString());
                    }
                    return;
                }
            }
            list.Add(happening);
        }
 override public void execEvent()
 {
     if (Simulation.EXPLICIT)
     {
         Console.WriteLine("Starting Transit of tram " + Subject.TramNo.ToString() + " at station " + Place.Name + "planned for" + ETime.ToString() + " at time " + Time.Now().ToString());
         if (Simulation.WAIT)
         {
             Console.ReadLine();
         }
     }
     if (!Place.Name.Trim().Equals(Subject.Position.Name.Trim()))
     {
         Console.WriteLine("At Execution of starttransit: place and subject.position do not match. " + Place.Name + " vs " + Subject.Position.Name);
         Console.ReadLine(); EventList.Sim.EmergencyExit();
     }
     Place.handleDepart(Subject, number);
 }
        public StartTransit(int time, Tram tram, iHasRails place, int timenumber)
        {
            EventList.checkForTram(tram);
            Priority     = 5;
            ETime        = time; Subject = tram; Place = place; number = timenumber;
            Subject.busy = true;
            if (Place != tram.Position)
            {
                Console.WriteLine("At StartTransit event: place and subject.Position did not match. " + Place.Name + " vs " + Subject.Position.Name);
                Console.ReadLine(); EventList.Sim.EmergencyExit();
            }

            if (Simulation.EXPLICIT)
            {
                Console.WriteLine("Planned Starttransit of tram" + Subject.TramNo.ToString() + " at station " + Place.Name + " at time " + Time.Now().ToString());
            }
            Name = "StartTransit";
            base.addToList();
        }