Пример #1
0
 /**
  * Search this environment frame for a procedure. If the procedure is not found, recursively
  * search the calling frames.
  *
  * @param name the procedure name
  * @return the procedure
  */
 public LogoFunc getFunction(String name) {
   LogoFunc f = null;
   f = (LogoFunc) functions.get(name);
   if (f == null) {
     if (this.parent == null) return null;
     else return parent.getFunction(name);
   } else return f;
 }
Пример #2
0
 /**
  * Search the current environment frame for the variable If the variable is not found, recursively
  * search the calling frames.
  *
  * @param var the variable to lookup in the environment
  * @return the variable
  */
 public String getVariable(String var) {
   String v = null;
   v = (String) variables.get(var);
   if (v == null) {
     if (this.parent == null) return null;
     else return parent.getVariable(var);
   } else {
     return v;
   }
 }