Code Search for Developers
 
 
  

Euboia.java from gzz at Krugle


Show Euboia.java syntax highlighted

/*
Euboia.java
 *
 *    Copyright (c) 2001, Ted Nelson and Tuomas Lukka
 *
 *    This file is part of Gzz.
 *    
 *    Gzz is free software; you can redistribute it and/or modify it under
 *    the terms of the GNU Lesser General Public License as published by
 *    the Free Software Foundation; either version 2 of the License, or
 *    (at your option) any later version.
 *    
 *    Gzz is distributed in the hope that it will be useful, but WITHOUT
 *    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 *    or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General
 *    Public License for more details.
 *    
 *    You should have received a copy of the GNU Lesser General
 *    Public License along with Gzz; if not, write to the Free
 *    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 *    MA  02111-1307  USA
 *    
 *
 */
/*
 * Written by Tero Mäyränen
 */

package org.gzigzag.module.homer;
import java.awt.*;
import java.util.*;
import java.lang.reflect.*;
import org.gzigzag.*;

/**
 *	Euboia is one way to make programming languages with static calls.
 *	You can add and remove calls dynamically.
 *
 *	For a practical example, see Modules/raytrace/Model.java
 */

public class Euboia
{
	public static final String rcsid = "$Id: Euboia.java,v 1.2 2003/02/21 20:02:21 tjl Exp $";

	protected Hashtable hashtable = new Hashtable();

	/**
	 *	Add a command to the language.
	 */
	public void put(String type, Method method) { hashtable.put(type, method); }

	/**
	 *	Remove a command from the language.
	 */
	public void remove(String type) { hashtable.remove(type); }

	/**
	 *	Invoke a command in the language.
	 */
	public void invoke(ZZCell name, Object params[])
	{
		if (name == null) return;
		ZZCell type = name.h("d.clone").s("d.1");
		if (type == null) return;
		Method method = (Method)hashtable.get(type.getText());
		if (method != null)
		{
			params[0] = type;
			try { method.invoke(null, params); } catch (Exception e)
			{
				ZZLogger.exc(e);
			}
		}
	}
}




See more files for this project here

gzz

An implementation of Ted Nelson's ZZstructure. ZZstructure is a new type of programming platform for structured data.

Project homepage: http://savannah.nongnu.org/projects/gzz
Programming language(s): C++,Java,Python
License: lgpl21

  Chios.java
  Euboia.java
  Ionia.java
  Smyrna.java
  Springfield.java