jsint
Class LocalVariable
java.lang.Object
|
+--jsint.LocalVariable
- All Implemented Interfaces:
- java.io.Serializable
- public class LocalVariable
- extends java.lang.Object
- implements java.io.Serializable
A LocalVariable is denoted by its position in the environment, in terms
of the number of levels "up" we have to go (number of nested environments),
the number of variables "in" we have to go (ordinal position of variable),
and whether the variable is a "rest" (or "dotted") variable.
Example of variables in (list x y z a b):
(lambda (x y) x.up=2, x.in=0 y.up=2, y.in=1
(lambda (z . a) z.up=1, z.in=0 a.up=1, a.in=1
(lambda b b.up=0, b.in=0
(list x y z a b))))
- Author:
- Peter Norvig, Copyright 1998, peter@norvig.com, license
subsequently modified by Jscheme project members
licensed under zlib licence (see license.txt)
- See Also:
- Serialized Form
|
Field Summary |
int |
in
The ordinal position in the environment where the variable is. |
int |
up
The number of levels up in the parent chain where the variable is. |
|
Method Summary |
java.lang.String |
toString()
Use the name, up and in of the variable as its String
representation so they distinguish themselves from a Global
variable. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
up
public int up
- The number of levels up in the parent chain where the variable is.
in
public int in
- The ordinal position in the environment where the variable is.
LocalVariable
public LocalVariable(int up,
int in,
Symbol name)
- Create a new variable.
toString
public java.lang.String toString()
- Use the name, up and in of the variable as its String
representation so they distinguish themselves from a Global
variable.
- Overrides:
toString in class java.lang.Object