KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > gnu > expr > BuiltinEnvironment


1 package gnu.expr;
2 import gnu.mapping.*;
3
4 /** An Environment containing the default bindings for the current Language.
5  * All <code>lookup</code> operatiosn are indirected to the
6  * current <code>Language</code>. */

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 JavaDoc 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 JavaDoc property,
30                                     int hash, boolean create)
31   {
32     throw new RuntimeException JavaDoc();
33   }
34
35   public void define (Symbol key, Object JavaDoc property, Object JavaDoc newValue)
36   {
37     throw new RuntimeException JavaDoc();
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 JavaDoc();
53   }
54
55   public NamedLocation addLocation (Symbol name, Object JavaDoc prop, Location loc)
56   {
57     throw new RuntimeException JavaDoc();
58   }
59 }
60
Popular Tags