]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/module/ImportDeclaration.java
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.scl.compiler / src / org / simantics / scl / compiler / module / ImportDeclaration.java
index 54afa3c3c42e21e8bae140842e948780ff975512..21d7104051b133957c17b813a1a2a778ac2334f3 100644 (file)
-package org.simantics.scl.compiler.module;\r
-\r
-import org.simantics.scl.compiler.elaboration.expressions.EVar;\r
-import org.simantics.scl.compiler.internal.parsing.Symbol;\r
-import org.simantics.scl.compiler.internal.parsing.declarations.DeclarationAst;\r
-\r
-\r
-public class ImportDeclaration extends DeclarationAst {\r
-    public static final ImportSpec DEFAULT_SPEC = new ImportSpec(true, new EVar[0]);\r
-    \r
-    public static final ImportDeclaration[] EMPTY_ARRAY = new ImportDeclaration[0];\r
-\r
-    public static final ImportDeclaration[] ONLY_BUILTINS =\r
-            new ImportDeclaration[] { new ImportDeclaration("Builtin", "") };\r
-\r
-    \r
-    public final String moduleName;\r
-    public final String localName;\r
-    public final boolean reexport;\r
-    public final ImportSpec spec;\r
-    \r
-    public static class ImportSpec extends Symbol {\r
-        public final boolean hiding;\r
-        public final EVar[] values;\r
-        \r
-        public ImportSpec(boolean hiding, EVar[] values) {\r
-            this.hiding = hiding;\r
-            this.values = values;\r
-        }\r
-        \r
-        @Override\r
-        public String toString() {\r
-            if(hiding && values.length == 0)\r
-                return "";\r
-            StringBuilder b = new StringBuilder();\r
-            if(hiding)\r
-                b.append("hiding ");\r
-            b.append('(');\r
-            for(int i=0;i<values.length;++i) {\r
-                if(i > 0)\r
-                    b.append(',');\r
-                b.append(values[i].name);\r
-            }\r
-            b.append(')');\r
-            return b.toString();\r
-        }\r
-    }\r
-    \r
-    public ImportDeclaration(String moduleName, String localName, boolean reexport) {\r
-        this.moduleName = moduleName;\r
-        this.localName = localName;\r
-        this.reexport = reexport;\r
-        this.spec = DEFAULT_SPEC;\r
-    }\r
-    \r
-    public ImportDeclaration(String moduleName, String localName, boolean reexport, ImportSpec spec) {\r
-        if(spec == null)\r
-            throw new NullPointerException();\r
-        this.moduleName = moduleName;\r
-        this.localName = localName;\r
-        this.reexport = reexport;\r
-        this.spec = spec;\r
-    }\r
-    \r
-    public ImportDeclaration(String moduleName, String localName) {\r
-        this(moduleName, localName, false);\r
-    }\r
-\r
-    @Override\r
-    public void toString(int indentation, StringBuilder b) {\r
-        for(int i=0;i<indentation;++i) b.append("    ");\r
-        if (reexport)\r
-            b.append("include \"");\r
-        else\r
-            b.append("import \"");\r
-        b.append(moduleName);\r
-        b.append("\" as ");\r
-        b.append(localName);\r
-        \r
-    }\r
-\r
-    public String getSpecString() {\r
-        return spec.toString();\r
-    }\r
-    \r
-    @Override\r
-    public int hashCode() {\r
-        final int prime = 31;\r
-        int result = 1;\r
-        result = prime * result\r
-                + ((localName == null) ? 0 : localName.hashCode());\r
-        result = prime * result\r
-                + ((moduleName == null) ? 0 : moduleName.hashCode());\r
-        result = prime * result + (reexport ? 1231 : 1237);\r
-        return result;\r
-    }\r
-\r
-    @Override\r
-    public boolean equals(Object obj) {\r
-        if (this == obj)\r
-            return true;\r
-        if (obj == null)\r
-            return false;\r
-        if (getClass() != obj.getClass())\r
-            return false;\r
-        ImportDeclaration other = (ImportDeclaration) obj;\r
-        if (localName == null) {\r
-            if (other.localName != null)\r
-                return false;\r
-        } else if (!localName.equals(other.localName))\r
-            return false;\r
-        if (moduleName == null) {\r
-            if (other.moduleName != null)\r
-                return false;\r
-        } else if (!moduleName.equals(other.moduleName))\r
-            return false;\r
-        if (reexport != other.reexport)\r
-            return false;\r
-        return true;\r
-    }    \r
-    \r
-}\r
+package org.simantics.scl.compiler.module;
+
+import org.simantics.scl.compiler.elaboration.expressions.EVar;
+import org.simantics.scl.compiler.internal.parsing.Symbol;
+import org.simantics.scl.compiler.internal.parsing.declarations.DeclarationAst;
+
+
+public class ImportDeclaration extends DeclarationAst {
+    public static final ImportSpec DEFAULT_SPEC = new ImportSpec(true, new EVar[0]);
+    
+    public static final ImportDeclaration[] EMPTY_ARRAY = new ImportDeclaration[0];
+
+    public static final ImportDeclaration[] ONLY_BUILTINS =
+            new ImportDeclaration[] { new ImportDeclaration("Builtin", "") };
+
+    
+    public final String moduleName;
+    public final String localName;
+    public final boolean reexport;
+    public final ImportSpec spec;
+    
+    public static class ImportSpec extends Symbol {
+        public final boolean hiding;
+        public final EVar[] values;
+        
+        public ImportSpec(boolean hiding, EVar[] values) {
+            this.hiding = hiding;
+            this.values = values;
+        }
+        
+        @Override
+        public String toString() {
+            if(hiding && values.length == 0)
+                return "";
+            StringBuilder b = new StringBuilder();
+            if(hiding)
+                b.append("hiding ");
+            b.append('(');
+            for(int i=0;i<values.length;++i) {
+                if(i > 0)
+                    b.append(',');
+                b.append(values[i].name);
+            }
+            b.append(')');
+            return b.toString();
+        }
+    }
+    
+    public ImportDeclaration(String moduleName, String localName, boolean reexport) {
+        this.moduleName = moduleName;
+        this.localName = localName;
+        this.reexport = reexport;
+        this.spec = DEFAULT_SPEC;
+    }
+    
+    public ImportDeclaration(String moduleName, String localName, boolean reexport, ImportSpec spec) {
+        if(spec == null)
+            throw new NullPointerException();
+        this.moduleName = moduleName;
+        this.localName = localName;
+        this.reexport = reexport;
+        this.spec = spec;
+    }
+    
+    public ImportDeclaration(String moduleName, String localName) {
+        this(moduleName, localName, false);
+    }
+
+    @Override
+    public void toString(int indentation, StringBuilder b) {
+        for(int i=0;i<indentation;++i) b.append("    ");
+        if (reexport)
+            b.append("include \"");
+        else
+            b.append("import \"");
+        b.append(moduleName);
+        b.append("\" as ");
+        b.append(localName);
+        
+    }
+
+    public String getSpecString() {
+        return spec.toString();
+    }
+    
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result
+                + ((localName == null) ? 0 : localName.hashCode());
+        result = prime * result
+                + ((moduleName == null) ? 0 : moduleName.hashCode());
+        result = prime * result + (reexport ? 1231 : 1237);
+        return result;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj)
+            return true;
+        if (obj == null)
+            return false;
+        if (getClass() != obj.getClass())
+            return false;
+        ImportDeclaration other = (ImportDeclaration) obj;
+        if (localName == null) {
+            if (other.localName != null)
+                return false;
+        } else if (!localName.equals(other.localName))
+            return false;
+        if (moduleName == null) {
+            if (other.moduleName != null)
+                return false;
+        } else if (!moduleName.equals(other.moduleName))
+            return false;
+        if (reexport != other.reexport)
+            return false;
+        return true;
+    }    
+    
+}