public void RemoveACanOf(Flavor flavorName) { Debug.WriteLine($"CanRack.RemoveACanOf was called for flavor {flavorName}."); Bin bin; if (Bins.TryGetValue(flavorName, out bin)) { bin.RemoveCan(); } }
public void EmptyTheCanRackOf(Flavor flavorName) { Debug.WriteLine($"CanRack.EmptyTheCanRackOf was called for flavor {flavorName}."); Bin bin; if (Bins.TryGetValue(flavorName, out bin)) { bin.EmptyBin(); } }
public void FillOneCanRack(Flavor OneFlavor) { Debug.WriteLine("Filling the can rack"); { rack[OneFlavor] = BINSIZE; } }
public void AddACanOf(Flavor flavorName) { Debug.WriteLine($"CanRack.AddACanOf was called for flavor {flavorName.ToString()}."); Bin bin; if (Bins.TryGetValue(flavorName, out bin)) { bin.AddCan(); } else { Debug.WriteLine($"unknown flavor {flavorName}"); } }
public bool IsFull(Flavor flavorName) { Debug.WriteLine($"CanRack.IsFull was called for flavor {flavorName}."); Bin bin; bool isFull = false; if (Bins.TryGetValue(flavorName, out bin)) { isFull = bin.IsFull; } return isFull; }
public bool IsEmpty(Flavor flavorName) { Debug.WriteLine($"CanRack.IsEmpty was called for flavor {flavorName}."); Bin bin; bool isEmpty = true; if (Bins.TryGetValue(flavorName, out bin)) { isEmpty = bin.IsEmpty; } return isEmpty; }
public CyclingMeasureMode(ushort startDelay, Flavor.Common.Data.Measure.MeasureMode.Precise cycle, Action<long[][], List<PreciseEditorData>, short?> successfulExit, int iterations, int timeLimit, PreciseEditorData checkerPeak, int checkerIndex, short? initialShift, ushort allowedShift) : base((s, e) => { var ee = (Flavor.Common.Data.Measure.MeasureMode.Precise.SuccessfulExitEventArgs)e; successfulExit(ee.Counts, ee.Points, ee.Shift); }) { // TODO: checker peak received by index, after sort found by equality again //_cycle = new Flavor.Common.Data.Measure.MeasureMode.Precise(min, max, peaks, startDelay, stepDelay, exposition, forwardDelay, backwardDelay, graphUpdater, (ps, peds, shift) => OnSuccessfulExit(new Flavor.Common.Data.Measure.MeasureMode.Precise.SuccessfulExitEventArgs(ps, peds, shift)), initialShift, CheckShift); _cycle = cycle; _cycle.VoltageStepChangeRequested += Cycle_VoltageStepRequested; _cycle.Finalize += Cycle_Finalize; _cycle.Disable += cycle_Disable; this.allowedShift = allowedShift; stopper = new MeasureStopper(iterations, timeLimit); _checkerIndex = checkerIndex; peak = checkerPeak; }
internal Qualifier(DocumentRange location, string name, object parameter, Flavor flavors) : base(location) { this.m_name = name; this.m_parameter = parameter; this.m_flavors = flavors; }
public Boolean IsEmpty(Flavor FlavorOfBinToBeChecked) { return IsEmpty(FlavorOfBinToBeChecked.ToString()); }
public Boolean IsFull(Flavor FlavorOfBinToCheck) { Debug.WriteLine("IsFull method called"); if (rack[FlavorOfBinToCheck] == maxCans) { return true; } else { return false; } }
public Can(Flavor flavor) { Flavor = flavor; }
public ActionResult Edit(Flavor flavor) { _db.Entry(flavor).State = EntityState.Modified; _db.SaveChanges(); return(RedirectToAction("Index")); }
static void Add( MonsterNature nature, Stat pref, Stat dim, Flavor fav, Flavor dis ) { _store.Add( nature, new PreferenceEntry { PreferredStat = pref, DiminishedStat = dim, FavoriteFlavor = fav, DislikedFlavor = dis } ); }
public void EmptyCanRackOf(Flavor FlavorOfBinToBeEmptied) { Debug.WriteLine("Emptying a bin of {0}", (object)FlavorOfBinToBeEmptied); this.rack[FlavorOfBinToBeEmptied] = 0; }
public void RemoveACanOf(Flavor FlavorOfCanToBeRemoved) { Debug.WriteLine("Removing a can of {0}", (object)FlavorOfCanToBeRemoved); this.rack[FlavorOfCanToBeRemoved]--; }
public void RemoveACanOf(Flavor FlavorOfCanToBeRemoved) { RemoveACanOf(FlavorOfCanToBeRemoved.ToString()); }
public ActionResult Edit(Flavor flavor) { _db.Entry(flavor).State = EntityState.Modified; _db.SaveChanges(); return(RedirectToAction("Details", new { id = flavor.FlavorId })); }
public bool IsFull(Flavor FlavorOfBinToCheck) { Debug.WriteLine("Checking whether bin of {0} is full", (object)FlavorOfBinToCheck); return this.rack[FlavorOfBinToCheck] > 2; }
static void Main(string[] args) { PurchasePrice sodaPrice = new PurchasePrice(0.35M); CanRack sodaRack = new CanRack(); Console.WriteLine("Welcome to the .NET C# Soda Vending Machine"); Boolean timeToExit = false; do { sodaRack.DisplayCanRack(); Console.Write("Please insert {0:c} worth of coins: ", sodaPrice.PriceDecimal); decimal totalValueInserted = 0M; while (totalValueInserted < sodaPrice.PriceDecimal) { // get the coin inserted string coinNameInserted = Console.ReadLine().ToUpper(); Coin coinInserted = new Coin(coinNameInserted); Console.WriteLine("You have inserted a {0} worth {1:c}", coinInserted, coinInserted.ValueOf); // running total of the value of the coins inserted totalValueInserted += coinInserted.ValueOf; Console.WriteLine("Total value inserted is {0:c}", totalValueInserted); } // select a flavor of soda Boolean canDispensed = false; while (!canDispensed) { Console.Write("What flavor would you like? : "); // oooh, this looks like trouble. Why? //Needs exception handling Flavor flavor = new Flavor(); bool flavorFound = false; while (flavorFound == false) //I think this will work for exception handling? { try { //ask the user for flavor string flavorName = Console.ReadLine().ToUpper(); flavor = FlavorOps.ToFlavor(flavorName); //If this parse is successful... flavorFound = true; //... this WILL execute and get us out of the loop. Maybe? } catch (System.ArgumentException e) { Console.WriteLine($"{e.Message}" + " Please try again."); } } if (!sodaRack.IsEmpty(flavor)) { sodaRack.RemoveACanOf(flavor); Console.WriteLine("Thanks, here is your can of {0}.", flavor); canDispensed = true; } else { Console.WriteLine("We are out of {0}", flavor); } } Console.Write("Exit the vending machine? (y/n): "); string response = Console.ReadLine(); timeToExit = response.Trim().ToUpper().StartsWith("Y"); } while (!timeToExit); }
public bool IsEmpty(Flavor FlavorOfBinToCheck) { Debug.WriteLine("Checking whether bin of {0} is empty", (object)FlavorOfBinToCheck); return this.rack[FlavorOfBinToCheck] < 1; }
public ActionResult Edit(int id) { Flavor thisFlavor = _db.Flavors.FirstOrDefault(flavor => flavor.FlavorId == id); return(View(thisFlavor)); }
public static FlavorModel Map(Flavor flavor) => new FlavorModel { FlavorId = flavor.FlavorId, Name = flavor.Name, Description = flavor.Description, };
// This method will remove a can of the specified flavor from the rack. public void RemoveACanOf(Flavor FlavorOfCanToBeRemoved) { Debug.WriteLine("RemoveACanOf method called"); if (!IsEmpty(FlavorOfCanToBeRemoved)) { rack[FlavorOfCanToBeRemoved] -= 1; } else { throw new Exception("Shelf is empty"); } }
public ActionResult AddFlavorType(Flavor newFlavorType) { _db.Flavors.Add(newFlavorType); _db.SaveChanges(); return(RedirectToAction("Index", "Treat")); }
public RungeKuttaIntegrator(EulerState s, Flavor f) { state = new LeapFrogState(s); flavor = f; }
public List <IceCreamItem> RemoveFlavor(Flavor flavor) { return(RemoveFlavor(flavor, Capacity)); }
public Bin(Flavor flavor) { Flavor = flavor; }
private bool CheckIfFlavorAlreadyExist(Flavor flavor) { return(db.Flavors.Any(x => x.Name == flavor.Name && x.IsDefault == true)); }
public void AddACanOf(Flavor FlavorOfCanToBeAdded) { AddACanOf(FlavorOfCanToBeAdded.ToString()); }
public Boolean IsFull(Flavor CanBinToCheck) { return(IsFull(CanBinToCheck.ToString())); }
public void EmptyCanRackOf(Flavor FlavorOfBinToBeEmptied) { EmptyCanRackOf(FlavorOfBinToBeEmptied.ToString()); }
public Can(Flavor f) { this.flavor = f; }
public Can(Flavor AFlavor) { TheFlavor = AFlavor; }
public static string GetFlavorName(Flavor flavor) => flavor switch {
static void Main(string[] args) { PurchasePrice sodaPrice = new PurchasePrice(0.35M); CanRack sodaRack = new CanRack(); CoinBox changeBox = new CoinBox(new List <Coin> { new Coin(Coin.Denomination.QUARTER), new Coin(Coin.Denomination.DIME), new Coin(Coin.Denomination.NICKEL), new Coin(Coin.Denomination.QUARTER), new Coin(Coin.Denomination.QUARTER), new Coin(Coin.Denomination.DIME) }); Console.WriteLine("Welcome to the .NET C# Soda Vending Machine"); Boolean timeToExit = false; do { sodaRack.DisplayCanRack(); Console.Write("Please insert {0:c} worth of coins: ", sodaPrice.PriceDecimal); decimal totalValueInserted = 0M; while (totalValueInserted < sodaPrice.PriceDecimal) { // get the coin inserted string coinNameInserted = Console.ReadLine().ToUpper(); Coin coinInserted = new Coin(coinNameInserted); Console.WriteLine("You have inserted a {0} worth {1:c}", coinInserted, coinInserted.ValueOf); changeBox.Deposit(coinInserted); // running total of the value of the coins inserted totalValueInserted += coinInserted.ValueOf; Console.WriteLine("Total value inserted is {0:c}", totalValueInserted); } // select a flavor of soda Boolean canDispensed = false; while (!canDispensed) { Console.Write("What flavor would you like? : "); string flavorName = Console.ReadLine().ToUpper(); // Well, this used to be trouble. Flavor flavorEnumeral = FlavorOps.ToFlavor(flavorName); if (!sodaRack.IsEmpty(flavorEnumeral)) { sodaRack.RemoveACanOf(flavorEnumeral); Console.WriteLine("Thanks, here is your can of {0}.", flavorEnumeral); canDispensed = true; } else { Console.WriteLine("We are out of {0}", flavorEnumeral); } } Console.Write("Exit the vending machine? (y/n): "); string response = Console.ReadLine(); timeToExit = response.Trim().ToUpper().StartsWith("Y"); } while (!timeToExit); Console.WriteLine("Contents of Coin Box:"); Console.WriteLine("{0}\tHalf Dollar(s)", changeBox.HalfDollarCount); Console.WriteLine("{0}\tQuarter(s)", changeBox.QuarterCount); Console.WriteLine("{0}\tDime(s)", changeBox.DimeCount); Console.WriteLine("{0}\tNickel(s)", changeBox.NickelCount); Console.WriteLine("{0}\tSlug(s)", changeBox.SlugCount); Console.WriteLine(); Console.WriteLine("Total value in coin box is {0:c}", changeBox.ValueOf); }
public ActionResult Details(int id) { Flavor model = _db.Flavors.FirstOrDefault(e => e.FlavorId == id); return(View(model)); }
public async Task <IActionResult> Edit(int id) { Flavor thisFlavor = await _db.Flavors.SingleOrDefaultAsync(flavors => flavors.FlavorId == id); return(View(thisFlavor)); }
public ActionResult Delete(int id) { Flavor thisFlavor = _db.Flavors.FirstOrDefault(x => x.FlavorId == id); return(View(thisFlavor)); }
public ActionResult Create(Flavor flavor) { _db.Flavors.Add(flavor); _db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Delete(int id) { Flavor flavorToDelete = _db.Flavors.FirstOrDefault(flavor => flavor.FlavorId == id); return(View(flavorToDelete)); }
public Boolean IsEmpty(Flavor CanBinToCheck) { return IsEmpty(CanBinToCheck.ToString()); }
public int this[Flavor FlavorOfBin] { get { return rack[FlavorOfBin]; } set { // we could just assign a value // (once we verify it is not too big or too small), // but let's pretend that AddACanOf() and RemoveACanOf() // perform some kind of data tracking operation // for sales statistics, or something of that sort if (rack[FlavorOfBin] == value) { // do nothing } else if (rack[FlavorOfBin] < value) { while (!IsFull(FlavorOfBin) && rack[FlavorOfBin] < value) { AddACanOf(FlavorOfBin); } } else if (rack[FlavorOfBin] > value) { while (!IsEmpty(FlavorOfBin) && rack[FlavorOfBin] > value) { RemoveACanOf(FlavorOfBin); } } int sodaCansLeftOver = rack[FlavorOfBin] - value; if (sodaCansLeftOver == 0) { // do nothing } else if (sodaCansLeftOver < 0) { string pluralCan = string.Format(sodaCansLeftOver == -1 ? "" : "s"); string pluralWas = string.Format(sodaCansLeftOver == -1 ? "was" : "were"); Debug.WriteLine("{0} Bin Full. {1} can{2} of flavor {0} {3} not placed in vending machine", FlavorOfBin, -sodaCansLeftOver, pluralCan, pluralWas); } else if (sodaCansLeftOver > 0) { string pluralCan = string.Format(sodaCansLeftOver == 1 ? "" : "s"); string pluralWas = string.Format(sodaCansLeftOver == 1 ? "was" : "were"); Debug.WriteLine("{0} Bin Empty. {1} can{2} of flavor {0} {3} not available for removal", FlavorOfBin, sodaCansLeftOver, pluralCan, pluralWas); } } }
// This method adds a can of the specified flavor to the rack. public void AddACanOf(Flavor FlavorOfCanToBeAdded) { Debug.WriteLine("AddACanOf method called"); if (!IsFull(FlavorOfCanToBeAdded)) { rack[FlavorOfCanToBeAdded] += 1; } else { throw new Exception("Shelf is full"); } }
public ActionResult Edit(int id) { Flavor flavor = _db.Flavors.FirstOrDefault(x => x.Id == id); return(View(flavor)); }
public void EmptyCanRackOf(Flavor FlavorOfBinToBeEmptied) { Debug.WriteLine("EmptyCanRackOf method called"); rack[FlavorOfBinToBeEmptied] = 0; }
public ActionResult Delete(int deleteID) { Flavor deletingFlavor = _dataBase.Flavors.FirstOrDefault(flavors => flavors.FlavorId == deleteID); return(View(deletingFlavor)); }
public Boolean IsEmpty(Flavor FlavorOfBinToCheck) { Debug.WriteLine("IsEmpty method called"); if (rack[FlavorOfBinToCheck] == 0) { return true; } else { return false; } }
public StackNode(Flavor flavor, int startIndex) { this.flavor = flavor; this.startIndex = startIndex; consecutiveScoops = 1; }
public Boolean IsFull(Flavor CanBinToCheck) { return IsFull(CanBinToCheck.ToString()); }
/// <summary> /// This is tricky. Enabling AbsoluteCrosspath and RelativeCrosspath to be equal /// limits count of internals that still remain different. /// </summary> /// <returns></returns> public override Int32 GetHashCode() { //return ToAbsolutizedString().GetHashCode(); return(Flavor.GetHashCode() + LastEntry.GetHashCode()); }
public ActionResult Delete(int id) { Flavor foundAuthor = _db.Flavors.FirstOrDefault(flavor => flavor.FlavorId == id); return(View(foundAuthor)); }
public Cone(Flavor flavor) { this._flavor = flavor; }
public MultiStepIntegrator(EulerState s, Flavor f) { state = new MultiStepState(s); flavor = f; }
public Boolean IsEmpty(Flavor FlavorOfBinToBeChecked) { return(IsEmpty(FlavorOfBinToBeChecked.ToString())); }