1 package org.simantics.scl.compiler.environment.specification;
3 import java.util.ArrayList;
5 import org.simantics.scl.compiler.module.ImportDeclaration;
7 public class EnvironmentSpecification {
8 public final ArrayList<ImportDeclaration> imports = new ArrayList<ImportDeclaration>();
10 public void importModule(String moduleName, String localName) {
11 imports.add(new ImportDeclaration(moduleName, localName));
14 public static EnvironmentSpecification of(String ... strings) {
15 if(strings.length % 2 != 0)
16 throw new IllegalArgumentException("Expected even number of parameters.");
17 EnvironmentSpecification spec = new EnvironmentSpecification();
18 for(int i=0;i<strings.length;i+=2)
19 spec.importModule(strings[i], strings[i+1]);
24 public int hashCode() {
27 result = prime * result + ((imports == null) ? 0 : imports.hashCode());
32 public boolean equals(Object obj) {
37 if (getClass() != obj.getClass())
39 EnvironmentSpecification other = (EnvironmentSpecification) obj;
40 if (imports == null) {
41 if (other.imports != null)
43 } else if (!imports.equals(other.imports))