示例#1
0
        //----------------------------------------------------

        public Graph(ITraveler <T> aTravel)
        {
            this.TravelMethod = aTravel;

            this.Nodes    = new List <Node <T> >();
            this.Notifier = new NodeProcessor <T>();
        }
示例#2
0
            public void DisplayTravellingCost(int km)
            {
                ITraveler traveler = GetTraveler();

                int cost = traveler.GetTravellingCost(km);

                Console.WriteLine($"Travelling {km} km by {traveler.Name} costs {cost} euros.");
            }
示例#3
0
        public ITraveler InnerAdd(ITraveler traveler)
        {
            using var dbContext = _dataAccessor.GetNewDatabaseContext();
            var travelerEntity = dbContext.Travelers.Add((Traveler)traveler);

            dbContext.SaveChanges();

            return(travelerEntity.Entity);
        }
示例#4
0
            /// <summary>
            /// Pooling is optional. It simply illustrates the possibilities of having this abstract factory class
            /// </summary>
            private ITraveler GetTraveler()
            {
                if (traveler is null)
                {
                    traveler = CreateTraveler();
                }

                return(traveler);
            }
示例#5
0
 public void AlignToTraveler(ITraveler indexTraveler, int offset)
 {
     _leftMostTraveler.AlignToTraveler(indexTraveler, offset);
     _childTroupe.AlignToTraveler(indexTraveler, (offset + 1));
 }
示例#6
0
 public Troupe(ITraveler leftMostTraveler, ITroupe childTroupe, int travelerCount)
 {
     _leftMostTraveler = leftMostTraveler;
     _childTroupe = childTroupe;
     _travelerCount = travelerCount;
 }
示例#7
0
 public void AlignToTraveler(ITraveler indexTraveler, int offset)
 {
     CurrentValue = indexTraveler.CurrentValue + offset;
     TroupeValue = CurrentValue;
 }
示例#8
0
 public void Remove(ITraveler traveler)
 {
     using var dbContext = _dataAccessor.GetNewDatabaseContext();
     dbContext.Travelers.Remove((Traveler)traveler);
     dbContext.SaveChanges();
 }
示例#9
0
 public void Update(ITraveler traveler)
 {
     using var dbContext = _dataAccessor.GetNewDatabaseContext();
     dbContext.Update(traveler);
     dbContext.SaveChanges();
 }
 public void AlignToTraveler(ITraveler indexTraveler, int offset)
 {
     _traveler.AlignToTraveler(indexTraveler, offset);
 }
 public SingletonTroupe(ITraveler loneTraveler)
 {
     _traveler = loneTraveler;
 }
示例#12
0
 public void SetTraveler(ITraveler <T> rTravel)
 {
     this.TravelMethod = rTravel;
 }