1 package org.simantics.scl.compiler.runtime;
3 import java.util.Collection;
5 import org.simantics.scl.compiler.environment.Environment;
7 import gnu.trove.map.hash.THashMap;
9 public class RuntimeEnvironmentImpl implements RuntimeEnvironment {
11 private final Environment environment;
12 private final THashMap<String, RuntimeModule> runtimeModuleMap;
13 private final ClassLoader parentClassLoader;
14 private MutableClassLoader classLoader;
16 public RuntimeEnvironmentImpl(Environment environment,
17 ClassLoader parentClassLoader,
18 THashMap<String, RuntimeModule> runtimeModuleMap) {
19 this.environment = environment;
20 this.parentClassLoader = parentClassLoader;
21 this.runtimeModuleMap = runtimeModuleMap;
25 public Environment getEnvironment() {
30 public RuntimeModule getRuntimeModule(String name) {
31 return runtimeModuleMap.get(name);
35 public synchronized MutableClassLoader getMutableClassLoader() {
36 if(classLoader == null)
37 classLoader = new ExpressionClassLoader(
38 parentClassLoader, runtimeModuleMap, "Expression");
43 public Collection<RuntimeModule> getRuntimeModules() {
44 return runtimeModuleMap.values();