1 package serp.bytecode; 2 3 import java.util.*; 4 5 /*** 6 * State implementing the behavior of an array class. 7 * 8 * @author Abe White 9 */ 10 class ArrayState extends State { 11 private String _name = null; 12 private String _componentName = null; 13 14 public ArrayState(String name, String componentName) { 15 _name = name; 16 _componentName = componentName; 17 } 18 19 public int getMagic() { 20 return Constants.VALID_MAGIC; 21 } 22 23 public int getMajorVersion() { 24 return Constants.MAJOR_VERSION; 25 } 26 27 public int getMinorVersion() { 28 return Constants.MINOR_VERSION; 29 } 30 31 public int getAccessFlags() { 32 return Constants.ACCESS_PUBLIC | Constants.ACCESS_FINAL; 33 } 34 35 public int getIndex() { 36 return 0; 37 } 38 39 public int getSuperclassIndex() { 40 return 0; 41 } 42 43 public List getInterfacesHolder() { 44 return Collections.EMPTY_LIST; 45 } 46 47 public List getFieldsHolder() { 48 return Collections.EMPTY_LIST; 49 } 50 51 public List getMethodsHolder() { 52 return Collections.EMPTY_LIST; 53 } 54 55 public Collection getAttributesHolder() { 56 return Collections.EMPTY_LIST; 57 } 58 59 public String getName() { 60 return _name; 61 } 62 63 public String getSuperclassName() { 64 return Object.class.getName(); 65 } 66 67 public String getComponentName() { 68 return _componentName; 69 } 70 71 public boolean isPrimitive() { 72 return false; 73 } 74 75 public boolean isArray() { 76 return true; 77 } 78 }