1 package org.catacomb.act; 2 3 import java.util.ArrayList; 4 5 public class ArrayDeclaration { 6 7 String type; 8 String name; 9 10 ArrayList<String> vals; 11 12 public ArrayDeclaration(String sn) { 13 name = sn; 14 vals = new ArrayList<String>(); 15 } 16 17 public void setType(String st) { 18 type = st; 19 } 20 21 public void addValue(String s) { 22 vals.add(s); 23 } 24 25 public String toJava() { 26 StringBuffer sb = new StringBuffer(); 27 sb.append("public " + type + "[] " + name + " = {"); 28 29 boolean follower = false; 30 for (String sv : vals) { 31 if (follower) { 32 sb.append(",\n "); 33 } 34 sb.append(sv); 35 follower = true; 36 } 37 38 sb.append("};\n"); 39 return sb.toString(); 40 } 41 42 43 }