private ITripChain FindRepTripChain(SchedulerTripChain chain, ITashaHousehold tashaHousehold)
 {
     foreach (var person in tashaHousehold.Persons)
     {
         foreach (var tc in person.TripChains)
         {
             if (tc.JointTripID == chain.JointTripID && tc.JointTripRep)
             {
                 return(tc);
             }
         }
     }
     throw new XTMFRuntimeException("We were unable to find a joint trip representative's trip chain!");
 }
        private SchedulerTripChain LoadTripChain(BinaryReader reader, Datastructure.SparseArray <IZone> zoneArray, TashaPerson person)
        {
            SchedulerTripChain chain = SchedulerTripChain.GetTripChain(person);

            chain.JointTripID  = reader.ReadInt32();
            chain.JointTripRep = reader.ReadBoolean();
            LoadKeys(reader, chain);
            int numberOfTrips = reader.ReadInt32();

            for (int i = 0; i < numberOfTrips; i++)
            {
                SchedulerTrip trip = LoadTrip(reader, zoneArray, chain, i);
                // Now that we have all of the data that we need, add ourselves to the trip chain
                chain.Trips.Add(trip);
            }
            return(chain);
        }
        private SchedulerTrip LoadTrip(BinaryReader reader, Datastructure.SparseArray <IZone> zoneArray, SchedulerTripChain chain, int tripNumber)
        {
            SchedulerTrip trip = SchedulerTrip.GetTrip(HouseholdIterations);

            trip.TripNumber = tripNumber;
            trip.TripChain  = chain;
            // figure out where we are going
            trip.OriginalZone    = zoneArray[reader.ReadInt32()];
            trip.DestinationZone = zoneArray[reader.ReadInt32()];
            trip.Purpose         = (Activity)reader.ReadInt32();
            // And learn when we are leaving, and at what time we need to get there
            Time time = new Time();

            // The activity's start time
            time.Hours             = reader.ReadInt32();
            time.Minutes           = reader.ReadInt32();
            time.Seconds           = reader.ReadInt32();
            trip.ActivityStartTime = time;
            // Get the observed mode
            var modeName = reader.ReadString();

            for (int i = 0; i < AllModes.Count; i++)
            {
                if (modeName == AllModes[i].ModeName)
                {
                    trip.ObservedMode = AllModes[i];
                }
            }
            LoadKeys(reader, trip);
            return(trip);
        }