All pastes #956665 Raw Edit

Meins

public java v1 · immutable
#956665 ·published 2008-03-25 14:10 UTC
rendered paste body
package org.hecl.playground;import org.hecl.Command;import org.hecl.HeclException;import org.hecl.Interp;import org.hecl.LongThing;import org.hecl.Thing;/** * Return an ObjectThing for the given variable name which is passed as StringThing. *  * Useful when using lists which ObjectThings *  * @author Alexander Futász */public class ObjGetCmd implements Command {	private static final String CMDNAME = "objget";	private static ObjGetCmd cmd = new ObjGetCmd();	public static void load(Interp ip) {		ip.addCommand(CMDNAME, cmd);	}	public static void unload(Interp ip) {		ip.removeCommand(CMDNAME);	}	public Thing cmdCode(Interp interp, Thing[] argv) throws HeclException {		Thing t = null;		if (argv.length > 1) {			String var = argv[1].toString();			t = interp.getVar(var.substring(1));		}		return t == null ? LongThing.create(0) : t;	}}