001package headfirst.composite.menuiterator;
002
003import java.util.Iterator;
004
005@SuppressWarnings("rawtypes")
006public class MenuItem extends MenuComponent {
007
008        String name;
009        String description;
010        boolean vegetarian;
011        double price;
012
013        public MenuItem(String name,
014                        String description,
015                        boolean vegetarian,
016                        double price)
017        {
018                this.name = name;
019                this.description = description;
020                this.vegetarian = vegetarian;
021                this.price = price;
022        }
023
024        public String getName() {
025                return name;
026        }
027
028        public String getDescription() {
029                return description;
030        }
031
032        public double getPrice() {
033                return price;
034        }
035
036        public boolean isVegetarian() {
037                return vegetarian;
038        }
039
040        public Iterator createIterator() {
041                return new NullIterator();
042        }
043
044        public void print() {
045                System.out.print("  " + getName());
046                if (isVegetarian()) {
047                        System.out.print("(v)");
048                }
049                System.out.println(", " + getPrice());
050                System.out.println("     -- " + getDescription());
051        }
052        //vv MenuItemCompositeV2Main
053}
054//^^ MenuItemCompositeV2Main
055//^^ MenuItemCompositeV2