public void addGarage(int newNumber, int newSize) { if (CompanySize == 0) { firstGarage = new Garage(newNumber, newSize); lastGarage = firstGarage; CompanySize++; } else { lastGarage.setNext(new Garage(newNumber, newSize)); lastGarage = lastGarage.getNext(); CompanySize++; } }
public bool removeGarage() { if (CompanySize > 0) { firstGarage = firstGarage.getNext(); if (CompanySize == 1) lastGarage = null; CompanySize--; return (true); } else return (false); }
public void setNext(Garage newNext) { next = newNext; }
public bool loadFile(string FileName) { try { int i, c, n, k; firstGarage = null; lastGarage = null; CompanySize = 0; StreamReader sr = new StreamReader(FileName); k = Convert.ToInt32(sr.ReadLine()); for (c = 0; c < k; c++) { addGarage(Convert.ToInt32(sr.ReadLine()), Convert.ToInt32(sr.ReadLine())); n = Convert.ToInt32(sr.ReadLine()); for (i = 0; i < n; i++) { lastGarage.addAuto(sr.ReadLine(), Convert.ToInt32(sr.ReadLine())); } } return(true); } catch(Exception){return(false);} }