1 package gnu.expr; 2 import gnu.mapping.*; 3 4 7 8 public class BuiltinEnvironment extends Environment 9 { 10 static final BuiltinEnvironment instance = new BuiltinEnvironment(); 11 static { instance.setName("language-builtins"); } 12 13 public static BuiltinEnvironment getInstance() { return instance; } 14 15 public Environment getLangEnvironment () 16 { 17 Language lang = Language.getDefaultLanguage(); 18 return lang == null ? null : lang.getLangEnvironment(); 19 } 20 21 public NamedLocation lookup (Symbol name, Object property, int hash) 22 { 23 if (property == ThreadLocation.ANONYMOUS) 24 return null; 25 Language lang = Language.getDefaultLanguage(); 26 return lang == null ? null : lang.lookupBuiltin(name, property, hash); 27 } 28 29 public NamedLocation getLocation (Symbol key, Object property, 30 int hash, boolean create) 31 { 32 throw new RuntimeException (); 33 } 34 35 public void define (Symbol key, Object property, Object newValue) 36 { 37 throw new RuntimeException (); 38 } 39 40 public LocationEnumeration enumerateLocations () 41 { 42 return getLangEnvironment().enumerateLocations(); 43 } 44 45 public LocationEnumeration enumerateAllLocations () 46 { 47 return getLangEnvironment().enumerateLocations(); 48 } 49 50 protected boolean hasMoreElements (LocationEnumeration it) 51 { 52 throw new RuntimeException (); 53 } 54 55 public NamedLocation addLocation (Symbol name, Object prop, Location loc) 56 { 57 throw new RuntimeException (); 58 } 59 } 60 | Popular Tags |