public void setupPartyList() { peanut = new dog("peanut", "bichon"); fifi = new dog("fifi", "poodle"); clarence = new dog("clarence", "german"); gizelle = new dog("gizelle", "buorder collie"); lulu = new dog("lulu", "shitzu"); roy = new dog("roy", "beagle"); peanut.prev_dog = null; peanut.next_dog = fifi; fifi.prev_dog = peanut; fifi.next_dog = clarence; clarence.prev_dog = fifi; clarence.next_dog = gizelle; gizelle.prev_dog = clarence; gizelle.next_dog = lulu; lulu.prev_dog = gizelle; lulu.next_dog = roy; roy.prev_dog = lulu; roy.next_dog = null; head = peanut; tail = roy; }
public void walkoverthelist_tail() { current = tail; while (current != null) { Console.WriteLine(current.dogname); current = current.previousdog; } }
public void walkoverthelist() { current = head; while (current != null) { Console.WriteLine(current.dogname); current = current.nextdog; } }
public string reverseprintPartyList() { string inviteList = "*--"; temporary = tail; while (temporary.prev_dog != null) { inviteList += temporary.dog_name + " * --- * "; temporary = temporary.prev_dog; } inviteList += temporary.dog_name + " * --- * "; return(inviteList); }
public string printPartyList() { string inviteList = "*--"; temporary = head; while (temporary.next_dog != null) { inviteList += temporary.dog_name + " * --- * "; temporary = temporary.next_dog; } inviteList += temporary.dog_name + " * --- * "; return(inviteList); }
public void run() { head = peanut; peanut.dogname = "peanut"; peanut.dogbreed = "bichon"; peanut.nextdog = fifi; peanut.previousdog = null; fifi.dogname = "fifi"; fifi.dogbreed = "poodle"; fifi.nextdog = roy; fifi.previousdog = peanut; roy.dogname = "roy"; roy.dogbreed = "spaniel"; roy.nextdog = coco; roy.previousdog = fifi; // hhh coco.dogname = "coco"; coco.dogbreed = "border collie"; coco.nextdog = jordan; coco.previousdog = roy; jordan.dogname = "jordan"; jordan.dogbreed = "german shepard"; jordan.nextdog = fido; jordan.previousdog = coco; fido.dogname = "fido"; fido.dogbreed = "beagel"; fido.nextdog = null; fido.previousdog = jordan; }