1 3 5 22 23 package edu.neu.ccs.jmk; 24 25 31 final class Global 32 extends Expression 33 { 34 private String identifier; 35 private Value value = null; 36 37 Global (String identifier) { 38 this.identifier = identifier; 39 } 40 41 String getIdentifier() { 42 return identifier; 43 } 44 45 Value eval(Environment env, StringList list) 46 throws StringListCastException 47 { 48 if (list == null) 49 return value; 50 else if (StringList.isStringList(value)) 51 return StringList.append((StringList)value, list); 52 else { 53 String msg = "Append error: the value in " + identifier + 54 " is not a string list"; 55 throw new StringListCastException(msg); 56 } 57 } 58 59 void setValue(Value value) { 60 this.value = value; 61 } 62 } 63 | Popular Tags |