/**
 * Static mappings
 * 
 * @author Antonio Cruz adc2104@columbia.edu
 * @version $Id: Meta.java,v 1.7 2007/12/16 08:06:53 admin Exp $
 */

import java.util.HashMap;
import java.util.Map;

public class Meta {

	/** Map Sfal functions to arg Number and types 
	 * This is used for validating functions.
	 */
	static final Map SFAL_FUNCTIONS = new HashMap();
	static {
		SFAL_FUNCTIONS.put("makesquare", "Number,String|Hex");
		SFAL_FUNCTIONS.put("makecircle", "Number,String|Hex");
		SFAL_FUNCTIONS.put("makerect", "Number,Number,String|Hex");
		
		SFAL_FUNCTIONS.put("makegroup", "None");
		SFAL_FUNCTIONS.put("addtogroup", "Sprite,Sprite");
		
		SFAL_FUNCTIONS.put("maketext", "String");
		SFAL_FUNCTIONS.put("addtotext", "TextField,String");
		
		SFAL_FUNCTIONS.put("makemovie", "String");
		SFAL_FUNCTIONS.put("globalnumber", "None");
		
		SFAL_FUNCTIONS.put("setx", "Sprite,Number");
		SFAL_FUNCTIONS.put("sety", "Sprite,Number");
		
		SFAL_FUNCTIONS.put("settextx", "TextField,Number");
		SFAL_FUNCTIONS.put("settexty", "TextField,Number");
		
		SFAL_FUNCTIONS.put("getx", "Sprite");
		SFAL_FUNCTIONS.put("gety", "Sprite");
		
		SFAL_FUNCTIONS.put("gettextx", "TextField");
		SFAL_FUNCTIONS.put("gettexty", "TextField");
		
		SFAL_FUNCTIONS.put("sin", "Number");
		SFAL_FUNCTIONS.put("cos", "Number");
	}
	
	/**
	 * Map non-function call node types to corresponding ActionScript objects
	 */
	public static final Map NODE_TO_TYPE = new HashMap();
	static {
		NODE_TO_TYPE.put("*", "Number");
		NODE_TO_TYPE.put("+", "Number");
		NODE_TO_TYPE.put("-", "Number");
		NODE_TO_TYPE.put("/", "Number");
		NODE_TO_TYPE.put("%", "Number");
	
		// Number token literal
		NODE_TO_TYPE.put("Number", "Number");
	
		// String token literal
		NODE_TO_TYPE.put("String", "String");
	}
	
	/** 
	 * Map Sfal function return types to corresponding ActionScript objects 
	 * 
	 */
	public static final Map FUNC_TO_TYPE = new HashMap();
	static {
		FUNC_TO_TYPE.put("makemovie", "");
		FUNC_TO_TYPE.put("globalnumber", "Number");
		
		FUNC_TO_TYPE.put("makesquare", "Sprite");
		FUNC_TO_TYPE.put("makecircle", "Sprite");
		FUNC_TO_TYPE.put("makerect", "Sprite");
		
		FUNC_TO_TYPE.put("maketext", "TextField");
		FUNC_TO_TYPE.put("addtotext", "TextField");
		
		FUNC_TO_TYPE.put("makegroup", "Sprite");
		FUNC_TO_TYPE.put("addtogroup", "Sprite");
		
		FUNC_TO_TYPE.put("setx", "Sprite");
		FUNC_TO_TYPE.put("sety", "Sprite");
		
		FUNC_TO_TYPE.put("getx", "Number");
		FUNC_TO_TYPE.put("gety", "Number");
		
		FUNC_TO_TYPE.put("settextx", "TextField");
		FUNC_TO_TYPE.put("settexty", "TextField");
		
		FUNC_TO_TYPE.put("gettextx", "Number");
		FUNC_TO_TYPE.put("gettexty", "Number");
		
		FUNC_TO_TYPE.put("sin", "Number");
		FUNC_TO_TYPE.put("cos", "Number");
	}
	
	
	/**
	 * Basic web colors name to hex mappings.
	 * (http://www.htmlgoodies.com/tutorials/colors/article.php/3478961)
	 */
	public static final Map WEB_COLORS = new HashMap();
	static {
		WEB_COLORS.put("Aliceblue".toLowerCase(), "0xF0F8FF");
		WEB_COLORS.put("Antiquewhite".toLowerCase(), "0xFAEBD7");
		WEB_COLORS.put("Aqua".toLowerCase(), "0x00FFFF");
		WEB_COLORS.put("Aquamarine".toLowerCase(), "0x7FFFD4");
		WEB_COLORS.put("Azure".toLowerCase(), "0xF0FFFF");
		WEB_COLORS.put("Beige".toLowerCase(), "0xF5F5DC");
		WEB_COLORS.put("Bisque".toLowerCase(), "0xFFE4C4");
		WEB_COLORS.put("Black".toLowerCase(), "0x000000");
		WEB_COLORS.put("Blanchedalmond".toLowerCase(), "0xFFEBCD");
		WEB_COLORS.put("Blue".toLowerCase(), "0x0000FF");
		WEB_COLORS.put("Blueviolet".toLowerCase(), "0x8A2BE2");
		WEB_COLORS.put("Brown".toLowerCase(), "0xA52A2A");
		WEB_COLORS.put("Burlywood".toLowerCase(), "0xDEB887");
		WEB_COLORS.put("Cadetblue".toLowerCase(), "0x5F9EA0");
		WEB_COLORS.put("Chartreuse".toLowerCase(), "0x7FFF00");
		WEB_COLORS.put("Chocolate".toLowerCase(), "0xD2691E");
		WEB_COLORS.put("Coral".toLowerCase(), "0xFF7F50");
		WEB_COLORS.put("Cornflowerblue".toLowerCase(), "0x6495ED");
		WEB_COLORS.put("Cornsilk".toLowerCase(), "0xFFF8DC");
		WEB_COLORS.put("Crimson".toLowerCase(), "0xDC143C");
		WEB_COLORS.put("Cyan".toLowerCase(), "0x00FFFF");
		WEB_COLORS.put("Darkblue".toLowerCase(), "0x00008B");
		WEB_COLORS.put("Darkcyan".toLowerCase(), "0x008B8B");
		WEB_COLORS.put("Darkgoldenrod".toLowerCase(), "0xB8860B");
		WEB_COLORS.put("Darkgray".toLowerCase(), "0xA9A9A9");
		WEB_COLORS.put("Darkgreen".toLowerCase(), "0x006400");
		WEB_COLORS.put("Darkkhaki".toLowerCase(), "0xBDB76B");
		WEB_COLORS.put("Darkmagenta".toLowerCase(), "0x8B008B");
		WEB_COLORS.put("Darkolivegreen".toLowerCase(), "0x556B2F");
		WEB_COLORS.put("Darkorange".toLowerCase(), "0xFF8C00");
		WEB_COLORS.put("Darkorchid".toLowerCase(), "0x9932CC");
		WEB_COLORS.put("Darkred".toLowerCase(), "0x8B0000");
		WEB_COLORS.put("Darksalmon".toLowerCase(), "0xE9967A");
		WEB_COLORS.put("Darkseagreen".toLowerCase(), "0x8FBC8F");
		WEB_COLORS.put("Darkslateblue".toLowerCase(), "0x483D8B");
		WEB_COLORS.put("Darkslategray".toLowerCase(), "0x2F4F4F");
		WEB_COLORS.put("Darkturquoise".toLowerCase(), "0x00CED1");
		WEB_COLORS.put("Darkviolet".toLowerCase(), "0x9400D3");
		WEB_COLORS.put("Deeppink".toLowerCase(), "0xFF1493");
		WEB_COLORS.put("Deepskyblue".toLowerCase(), "0x00BFFF");
		WEB_COLORS.put("Dimgray".toLowerCase(), "0x696969");
		WEB_COLORS.put("Dodgerblue".toLowerCase(), "0x1E90FF");
		WEB_COLORS.put("Firebrick".toLowerCase(), "0xB22222");
		WEB_COLORS.put("Floralwhite".toLowerCase(), "0xFFFAF0");
		WEB_COLORS.put("Forestgreen".toLowerCase(), "0x228B22");
		WEB_COLORS.put("Fuchsia".toLowerCase(), "0xFF00FF");
		WEB_COLORS.put("Gainsboro".toLowerCase(), "0xDCDCDC");
		WEB_COLORS.put("Ghostwhite".toLowerCase(), "0xF8F8FF");
		WEB_COLORS.put("Gold".toLowerCase(), "0xFFD700");
		WEB_COLORS.put("Goldenrod".toLowerCase(), "0xDAA520");
		WEB_COLORS.put("Gray".toLowerCase(), "0x808080");
		WEB_COLORS.put("Green".toLowerCase(), "0x008000");
		WEB_COLORS.put("Greenyellow".toLowerCase(), "0xADFF2F");
		WEB_COLORS.put("Honeydew".toLowerCase(), "0xF0FFF0");
		WEB_COLORS.put("Hotpink".toLowerCase(), "0xFF69B4");
		WEB_COLORS.put("Indianred".toLowerCase(), "0xCD5C5C");
		WEB_COLORS.put("Indigo".toLowerCase(), "0x4B0082");
		WEB_COLORS.put("Ivory".toLowerCase(), "0xFFFFF0");
		WEB_COLORS.put("Khaki".toLowerCase(), "0xF0E68C");
		WEB_COLORS.put("Lavender".toLowerCase(), "0xE6E6FA");
		WEB_COLORS.put("Lavenderblush".toLowerCase(), "0xFFF0F5");
		WEB_COLORS.put("Lawngreen".toLowerCase(), "0x7CFC00");
		WEB_COLORS.put("Lemonchiffon".toLowerCase(), "0xFFFACD");
		WEB_COLORS.put("lightblue".toLowerCase(), "0xADD8E6");
		WEB_COLORS.put("Lightcoral".toLowerCase(), "0xF08080");
		WEB_COLORS.put("Lightcyan".toLowerCase(), "0xE0FFFF");
		WEB_COLORS.put("Lightgoldenrodyellow".toLowerCase(), "0xFAFAD2");
		WEB_COLORS.put("Lightgreen".toLowerCase(), "0x90EE90");
		WEB_COLORS.put("Lightgrey".toLowerCase(), "0xD3D3D3");
		WEB_COLORS.put("Lightpink".toLowerCase(), "0xFFB6C1");
		WEB_COLORS.put("Lightsalmon".toLowerCase(), "0xFFA07A");
		WEB_COLORS.put("Lightseagreen".toLowerCase(), "0x20B2AA");
		WEB_COLORS.put("Lightskyblue".toLowerCase(), "0x87CEFA");
		WEB_COLORS.put("Lightslategray".toLowerCase(), "0x778899");
		WEB_COLORS.put("Lightsteelblue".toLowerCase(), "0xB0C4DE");
		WEB_COLORS.put("Lightyellow".toLowerCase(), "0xFFFFE0");
		WEB_COLORS.put("Lime".toLowerCase(), "0x00FF00");
		WEB_COLORS.put("Limegreen".toLowerCase(), "0x32CD32");
		WEB_COLORS.put("Linen".toLowerCase(), "0xFAF0E6");
		WEB_COLORS.put("Magenta".toLowerCase(), "0xFF00FF");
		WEB_COLORS.put("Maroon".toLowerCase(), "0x800000");
		WEB_COLORS.put("Mediumauqamarine".toLowerCase(), "0x66CDAA");
		WEB_COLORS.put("Mediumblue".toLowerCase(), "0x0000CD");
		WEB_COLORS.put("Mediumorchid".toLowerCase(), "0xBA55D3");
		WEB_COLORS.put("Mediumpurple".toLowerCase(), "0x9370D8");
		WEB_COLORS.put("Mediumseagreen".toLowerCase(), "0x3CB371");
		WEB_COLORS.put("Mediumslateblue".toLowerCase(), "0x7B68EE");
		WEB_COLORS.put("Mediumspringgreen".toLowerCase(), "0x00FA9A");
		WEB_COLORS.put("Mediumturquoise".toLowerCase(), "0x48D1CC");
		WEB_COLORS.put("Mediumvioletred".toLowerCase(), "0xC71585");
		WEB_COLORS.put("Midnightblue".toLowerCase(), "0x191970");
		WEB_COLORS.put("Mintcream".toLowerCase(), "0xF5FFFA");
		WEB_COLORS.put("Mistyrose".toLowerCase(), "0xFFE4E1");
		WEB_COLORS.put("Moccasin".toLowerCase(), "0xFFE4B5");
		WEB_COLORS.put("Navajowhite".toLowerCase(), "0xFFDEAD");
		WEB_COLORS.put("Navy".toLowerCase(), "0x000080");
		WEB_COLORS.put("Oldlace".toLowerCase(), "0xFDF5E6");
		WEB_COLORS.put("Olive".toLowerCase(), "0x808000");
		WEB_COLORS.put("Olivedrab".toLowerCase(), "0x688E23");
		WEB_COLORS.put("Orange".toLowerCase(), "0xFFA500");
		WEB_COLORS.put("Orangered".toLowerCase(), "0xFF4500");
		WEB_COLORS.put("Orchid".toLowerCase(), "0xDA70D6");
		WEB_COLORS.put("Palegoldenrod".toLowerCase(), "0xEEE8AA");
		WEB_COLORS.put("Palegreen".toLowerCase(), "0x98FB98");
		WEB_COLORS.put("Paleturquoise".toLowerCase(), "0xAFEEEE");
		WEB_COLORS.put("Palevioletred".toLowerCase(), "0xD87093");
		WEB_COLORS.put("Papayawhip".toLowerCase(), "0xFFEFD5");
		WEB_COLORS.put("Peachpuff".toLowerCase(), "0xFFDAB9");
		WEB_COLORS.put("Peru".toLowerCase(), "0xCD853F");
		WEB_COLORS.put("Pink".toLowerCase(), "0xFFC0CB");
		WEB_COLORS.put("Plum".toLowerCase(), "0xDDA0DD");
		WEB_COLORS.put("Powderblue".toLowerCase(), "0xB0E0E6");
		WEB_COLORS.put("Purple".toLowerCase(), "0x800080");
		WEB_COLORS.put("Red".toLowerCase(), "0xFF0000");
		WEB_COLORS.put("Rosybrown".toLowerCase(), "0xBC8F8F");
		WEB_COLORS.put("Royalblue".toLowerCase(), "0x4169E1");
		WEB_COLORS.put("Saddlebrown".toLowerCase(), "0x8B4513");
		WEB_COLORS.put("Salmon".toLowerCase(), "0xFA8072");
		WEB_COLORS.put("Sandybrown".toLowerCase(), "0xF4A460");
		WEB_COLORS.put("Seagreen".toLowerCase(), "0x2E8B57");
		WEB_COLORS.put("Seashell".toLowerCase(), "0xFFF5EE");
		WEB_COLORS.put("Sienna".toLowerCase(), "0xA0522D");
		WEB_COLORS.put("Silver".toLowerCase(), "0xC0C0C0");
		WEB_COLORS.put("Skyblue".toLowerCase(), "0x87CEEB");
		WEB_COLORS.put("Slateblue".toLowerCase(), "0x6A5ACD");
		WEB_COLORS.put("Slategray".toLowerCase(), "0x708090");
		WEB_COLORS.put("Snow".toLowerCase(), "0xFFFAFA");
		WEB_COLORS.put("Springgreen".toLowerCase(), "0x00FF7F");
		WEB_COLORS.put("Steelblue".toLowerCase(), "0x4682B4");
		WEB_COLORS.put("Tan".toLowerCase(), "0xD2B48C");
		WEB_COLORS.put("Teal".toLowerCase(), "0x008080");
		WEB_COLORS.put("Thistle".toLowerCase(), "0xD8BFD8");
		WEB_COLORS.put("Tomato".toLowerCase(), "0xFF6347");
		WEB_COLORS.put("Turquoise".toLowerCase(), "0x40E0D0");
		WEB_COLORS.put("Violet".toLowerCase(), "0xEE82EE");
		WEB_COLORS.put("Wheat".toLowerCase(), "0xF5DEB3");
		WEB_COLORS.put("White".toLowerCase(), "0xFFFFFF");
		WEB_COLORS.put("Whitesmoke".toLowerCase(), "0xF5F5F5");
		WEB_COLORS.put("Yellow".toLowerCase(), "0xFFFF00");
		WEB_COLORS.put("YellowGreen".toLowerCase(), "0x9ACD32");
	}
}
