//---------------------------------------------------- public Graph(ITraveler <T> aTravel) { this.TravelMethod = aTravel; this.Nodes = new List <Node <T> >(); this.Notifier = new NodeProcessor <T>(); }
public void DisplayTravellingCost(int km) { ITraveler traveler = GetTraveler(); int cost = traveler.GetTravellingCost(km); Console.WriteLine($"Travelling {km} km by {traveler.Name} costs {cost} euros."); }
public ITraveler InnerAdd(ITraveler traveler) { using var dbContext = _dataAccessor.GetNewDatabaseContext(); var travelerEntity = dbContext.Travelers.Add((Traveler)traveler); dbContext.SaveChanges(); return(travelerEntity.Entity); }
/// <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); }
public void AlignToTraveler(ITraveler indexTraveler, int offset) { _leftMostTraveler.AlignToTraveler(indexTraveler, offset); _childTroupe.AlignToTraveler(indexTraveler, (offset + 1)); }
public Troupe(ITraveler leftMostTraveler, ITroupe childTroupe, int travelerCount) { _leftMostTraveler = leftMostTraveler; _childTroupe = childTroupe; _travelerCount = travelerCount; }
public void AlignToTraveler(ITraveler indexTraveler, int offset) { CurrentValue = indexTraveler.CurrentValue + offset; TroupeValue = CurrentValue; }
public void Remove(ITraveler traveler) { using var dbContext = _dataAccessor.GetNewDatabaseContext(); dbContext.Travelers.Remove((Traveler)traveler); dbContext.SaveChanges(); }
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; }
public void SetTraveler(ITraveler <T> rTravel) { this.TravelMethod = rTravel; }