|
|||||||||
| Home >> All >> [ silk overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
silk
Class Environment

java.lang.Objectsilk.Environment
- public class Environment
- extends java.lang.Object
Environments store mappings from symbols to locations. At compile time, we can lookup to see if a symbol names a location, and at run time we can get or set the value in a location.
| Field Summary | |
static Environment |
GLOBAL
The global environment. |
private Environment |
parent
The parent Environment: where you look if you can't find a variable. |
private java.lang.Object[] |
vals
An array of values in a 1-1 correspondance with the vars. |
private java.lang.Object |
vars
A list of variables in this env. |
| Constructor Summary | |
Environment(java.lang.Object vars,
java.lang.Object[] vals,
Environment parent)
Create an Environment with local variables and values, and a parent Environment. |
|
| Method Summary | |
java.lang.Object |
get(LocalVariable var)
Get the value of the LocalVariable in this Environment. |
java.lang.Object |
lookup(Symbol var)
|
java.lang.Object |
lookup(Symbol var,
int up,
int in,
java.lang.Object vars)
Lookup the symbol in the environment. |
java.lang.Object |
set(LocalVariable var,
java.lang.Object newVal)
Set the value of the LocalVariable in this Environment to a new value. |
java.lang.String |
toString()
Convert this Object to a human-readable String. |
private java.lang.String |
toString0()
|
(package private) Environment |
up(int levels)
Go up a specified number of levels in the parent chain. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
GLOBAL
public static final Environment GLOBAL
- The global environment. All info is in the Symbols themselves.
parent
private Environment parent
- The parent Environment: where you look if you can't find a variable.
vars
private java.lang.Object vars
- A list of variables in this env. May be dotted or a lone symbol.
vals
private java.lang.Object[] vals
- An array of values in a 1-1 correspondance with the vars.
| Constructor Detail |
Environment
public Environment(java.lang.Object vars, java.lang.Object[] vals, Environment parent)
- Create an Environment with local variables and values, and a parent
Environment.
| Method Detail |
lookup
public java.lang.Object lookup(Symbol var)
lookup
public java.lang.Object lookup(Symbol var, int up, int in, java.lang.Object vars)
- Lookup the symbol in the environment. Return either a
LocalVariable a Symbol representing the global variable.
Symbols which are Java Literals are assigned a value in "lookupGlobal"
get
public java.lang.Object get(LocalVariable var)
- Get the value of the LocalVariable in this Environment.
set
public java.lang.Object set(LocalVariable var, java.lang.Object newVal)
- Set the value of the LocalVariable in this Environment to a new value.
up
Environment up(int levels)
- Go up a specified number of levels in the parent chain.
toString
public java.lang.String toString()
- Description copied from class:
java.lang.Object - Convert this Object to a human-readable String.
There are no limits placed on how long this String
should be or what it should contain. We suggest you
make it as intuitive as possible to be able to place
it into System.out.println() 55
and such.
It is typical, but not required, to ensure that this method never completes abruptly with a java.lang.RuntimeException.
This method will be called when performing string concatenation with this object. If the result is
null, string concatenation will instead use"null".The default implementation returns
getClass().getName() + "@" + Integer.toHexString(hashCode()).
toString0
private java.lang.String toString0()
|
|||||||||
| Home >> All >> [ silk overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
silk.Environment