import java.util.ArrayList; /** * Created by flo on 1/10/16. */ public class CheeseburgerNode { // Node Data members public int burgerID; public String buns; public String veggie; public ArrayList patty; public ArrayList cheese; public String toppings; public String cheeseType; public String addons; public String condiment; public CheeseburgerNode next; // Default empty Node Constructor public CheeseburgerNode() { this.burgerID = 0; this.buns = ""; this.veggie = ""; this.patty = new ArrayList(); this.cheese = new ArrayList(); this.toppings = ""; this.cheeseType = ""; this.addons = ""; this.condiment = ""; this.next = null; } // Node constructor with data public CheeseburgerNode(int d) { this.next = null; this.burgerID = d; } // Node constructor specify a particular node public CheeseburgerNode(int d, CheeseburgerNode n) { this.next = n; this.burgerID = d; } // return next node public CheeseburgerNode getNext() { return this.next; } // set this node to next node public void setNext(CheeseburgerNode n) { this.next = n; } public int getData() { return burgerID; } public void setData(int data) { this.burgerID = data; } public String getBuns() { return this.buns; } public void setBuns(String buns) { this.buns = buns; } public String getVeggie() { return this.veggie; } public void setVeggie(String veggie) { this.veggie = veggie; } public ArrayList getPatty() { return this.patty; } public void setPatty(String patty) { this.patty.add(patty); } public ArrayList getCheese() { return this.cheese; } public void setCheese(String cheese) { this.cheese.add(cheese); } public String getToppings() { return this.toppings; } public void setToppings(String toppings) { this.toppings = toppings; } public String getCheeseType() { return this.cheeseType; } public void setCheeseType(String cheeseType) { this.cheeseType = cheeseType; } public String getAddons() { return this.addons; } public void setAddons(String addons) { this.addons = addons; } public String getCondiment() { return this.condiment; } public void setCondiment(String condiment) { this.condiment = condiment; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; CheeseburgerNode that = (CheeseburgerNode) o; if (burgerID != that.burgerID) return false; if (buns != null ? !buns.equals(that.buns) : that.buns != null) return false; if (veggie != null ? !veggie.equals(that.veggie) : that.veggie != null) return false; if (patty != null ? !patty.equals(that.patty) : that.patty != null) return false; if (toppings != null ? !toppings.equals(that.toppings) : that.toppings != null) return false; if (cheeseType != null ? !cheeseType.equals(that.cheeseType) : that.cheeseType != null) return false; if (addons != null ? !addons.equals(that.addons) : that.addons != null) return false; if (condiment != null ? !condiment.equals(that.condiment) : that.condiment != null) return false; return !(next != null ? !next.equals(that.next) : that.next != null); } @Override public int hashCode() { int result = burgerID; result = 31 * result + (buns != null ? buns.hashCode() : 0); result = 31 * result + (veggie != null ? veggie.hashCode() : 0); result = 31 * result + (patty != null ? patty.hashCode() : 0); result = 31 * result + (toppings != null ? toppings.hashCode() : 0); result = 31 * result + (cheeseType != null ? cheeseType.hashCode() : 0); result = 31 * result + (addons != null ? addons.hashCode() : 0); result = 31 * result + (condiment != null ? condiment.hashCode() : 0); result = 31 * result + (next != null ? next.hashCode() : 0); return result; } @Override public String toString() { return "CheeseburgerNode{" + "data=" + burgerID + ", buns='" + buns + '\'' + ", veggie='" + veggie + '\'' + ", patty=" + patty + ", toppings='" + toppings + '\'' + ", cheeseType='" + cheeseType + '\'' + ", addons='" + addons + '\'' + ", condiment='" + condiment + '\'' + ", next=" + next + '}'; } }