1 7 package com.inversoft.verge.examples.madlib; 8 9 10 import java.util.ArrayList ; 11 12 13 20 public class MadLibBean { 21 22 private String title; 23 private ArrayList numbers = new ArrayList (); 24 private ArrayList words = new ArrayList (); 25 private MadLib madLib; 26 private String finalMadLib; 27 28 29 32 public MadLibBean() { 33 } 35 36 37 42 public MadLib getMadLib() { 43 return madLib; 44 } 45 46 51 public void setMadLib(MadLib madLib) { 52 this.madLib = madLib; 53 } 54 55 60 public String getTitle() { 61 return title; 62 } 63 64 69 public void setTitle(String title) { 70 this.title = title; 71 } 72 73 79 public Integer getNumber(int index) { 80 if (index >= numbers.size()) { 81 return null; 82 } 83 84 return (Integer ) numbers.get(index); 85 } 86 87 93 public void setNumber(int index, Integer number) { 94 numbers.ensureCapacity(index + 1); 95 numbers.add(index, number); 96 } 97 98 104 public String getWord(int index) { 105 if (index >= words.size()) { 106 return null; 107 } 108 109 return (String ) words.get(index); 110 } 111 112 118 public void setWord(int index, String word) { 119 words.ensureCapacity(index + 1); 120 words.add(index, word); 121 } 122 123 128 public int getNumberOfNumbers() { 129 return numbers.size(); 130 } 131 132 137 public int getNumberOfWords() { 138 return words.size(); 139 } 140 141 147 public String getFinalMadLib() { 148 return finalMadLib; 149 } 150 151 157 public void setFinalMadLib(String finalMadLib) { 158 this.finalMadLib = finalMadLib; 159 } 160 161 164 public void reset() { 165 numbers.clear(); 166 words.clear(); 167 finalMadLib = null; 168 } 169 } | Popular Tags |