summaryrefslogtreecommitdiff
path: root/Shenanigans/src/org/archphantom/shenanigans/elements/Program.java
blob: 51fca6245ea41fdc606921121b5460ae288d6550 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package org.archphantom.shenanigans.elements;
import java.io.Serializable;
import java.util.Hashtable;
import org.archphantom.shenanigans.elements.values.Namespace;
import org.archphantom.shenanigans.elements.variables.VarTable;

public class Program implements Runnable, Serializable {
	private static final long serialVersionUID = 4309390632410676282L;
	private VarTable globalVars;
	private Hashtable<String, Namespace> namespaces;
	
	public Program (Hashtable<String, Namespace> namespaces) {
		this.globalVars = new VarTable();
		this.namespaces = namespaces;
	}
	
	public Namespace getNamespace (String name) {
		return namespaces.get(name.toLowerCase());
	}
	
	public void run () {
		Namespace ns;
		if ((ns = namespaces.get("main")) != null) {
			ns.getValue(globalVars, this);
		}
	}
	
}