]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.db/src/org/simantics/db/service/ResourceUID.java
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.db / src / org / simantics / db / service / ResourceUID.java
index 8ee9037e1df523a92bc348df6b7b732ba92b1540..e4214be5bb75522642a9be212226f6f28cb02906 100644 (file)
@@ -1,68 +1,68 @@
-package org.simantics.db.service;\r
-\r
-\r
-\r
-public final class ResourceUID {\r
-    public static final ResourceUID Null = new ResourceUID(null);\r
-    private final ClusterUID clusterUID;\r
-    private final short index;\r
-    private ResourceUID(ResourceUID a) {\r
-        assert(null == a);\r
-        clusterUID = ClusterUID.Null;\r
-        index = 0;\r
-    }\r
-    public ResourceUID(long first, long second, long index) {\r
-        this.clusterUID = ClusterUID.make(first, second);\r
-        if (index < 1 || index > 1<<14) // TODO: use ClusterTraits.RESOURCE_USED_BITS\r
-            throw new IllegalArgumentException("Trying to create illegal resource. index=" + index + " cluster=" + clusterUID);\r
-        this.index = (short)index;\r
-    }\r
-    public ResourceUID(long[] longs, int offset) {\r
-        if (longs.length < offset + 3)\r
-            throw new IllegalArgumentException("Not enough data to create resource uid. length=" + longs.length + " offset=" + offset); \r
-        this.clusterUID = ClusterUID.make(longs[offset+0], longs[offset+1]);\r
-        index = (short)longs[offset+2];\r
-        if (index < 1 || index > 1<<14) // TODO: use ClusterTraits.RESOURCE_USED_BITS\r
-            throw new IllegalArgumentException("Trying to create illegal resource. index=" + index + " cluster=" + clusterUID);\r
-    }\r
-    public int getIndex() {\r
-        return index;\r
-    }\r
-    public ClusterUID asCID() {\r
-        return clusterUID;\r
-    }\r
-    public static ResourceUID parse(String s) {\r
-       String[] ss = s.split("#");\r
-       if(ss.length != 3) throw new IllegalArgumentException("'" + s + "' is not a valid serialized ResourceUID");\r
-       long first = Long.parseLong(ss[0]);\r
-       long second = Long.parseLong(ss[1]);\r
-       short index = Short.parseShort(ss[2]);\r
-       return new ResourceUID(first, second, index);\r
-    }\r
-    public String serialized() {\r
-       return /*clusterUID.first +*/ "0#" + clusterUID.second + "#" + index;\r
-    }\r
-    public void toLong(long[] longs, int offset) {\r
-        int i = clusterUID.toLong(longs, offset);\r
-        longs[i] = index;\r
-    }\r
-    @Override\r
-    public String toString() {\r
-        return clusterUID.toString() + "." + index;\r
-    }\r
-    @Override\r
-    public boolean equals(Object o) {\r
-        if (this == o)\r
-            return true;\r
-        else if (!(o instanceof ResourceUID))\r
-            return false;\r
-        ResourceUID x = (ResourceUID)o;\r
-        return clusterUID.equals(x.clusterUID) && index == x.index;\r
-    }\r
-    @Override\r
-    public int hashCode() {\r
-        int result = clusterUID.hashCode();\r
-        result = 31 * result + index;\r
-        return result;\r
-    }\r
-}\r
+package org.simantics.db.service;
+
+
+
+public final class ResourceUID {
+    public static final ResourceUID Null = new ResourceUID(null);
+    private final ClusterUID clusterUID;
+    private final short index;
+    private ResourceUID(ResourceUID a) {
+        assert(null == a);
+        clusterUID = ClusterUID.Null;
+        index = 0;
+    }
+    public ResourceUID(long first, long second, long index) {
+        this.clusterUID = ClusterUID.make(first, second);
+        if (index < 1 || index > 1<<14) // TODO: use ClusterTraits.RESOURCE_USED_BITS
+            throw new IllegalArgumentException("Trying to create illegal resource. index=" + index + " cluster=" + clusterUID);
+        this.index = (short)index;
+    }
+    public ResourceUID(long[] longs, int offset) {
+        if (longs.length < offset + 3)
+            throw new IllegalArgumentException("Not enough data to create resource uid. length=" + longs.length + " offset=" + offset); 
+        this.clusterUID = ClusterUID.make(longs[offset+0], longs[offset+1]);
+        index = (short)longs[offset+2];
+        if (index < 1 || index > 1<<14) // TODO: use ClusterTraits.RESOURCE_USED_BITS
+            throw new IllegalArgumentException("Trying to create illegal resource. index=" + index + " cluster=" + clusterUID);
+    }
+    public int getIndex() {
+        return index;
+    }
+    public ClusterUID asCID() {
+        return clusterUID;
+    }
+    public static ResourceUID parse(String s) {
+       String[] ss = s.split("#");
+       if(ss.length != 3) throw new IllegalArgumentException("'" + s + "' is not a valid serialized ResourceUID");
+       long first = Long.parseLong(ss[0]);
+       long second = Long.parseLong(ss[1]);
+       short index = Short.parseShort(ss[2]);
+       return new ResourceUID(first, second, index);
+    }
+    public String serialized() {
+       return /*clusterUID.first +*/ "0#" + clusterUID.second + "#" + index;
+    }
+    public void toLong(long[] longs, int offset) {
+        int i = clusterUID.toLong(longs, offset);
+        longs[i] = index;
+    }
+    @Override
+    public String toString() {
+        return clusterUID.toString() + "." + index;
+    }
+    @Override
+    public boolean equals(Object o) {
+        if (this == o)
+            return true;
+        else if (!(o instanceof ResourceUID))
+            return false;
+        ResourceUID x = (ResourceUID)o;
+        return clusterUID.equals(x.clusterUID) && index == x.index;
+    }
+    @Override
+    public int hashCode() {
+        int result = clusterUID.hashCode();
+        result = 31 * result + index;
+        return result;
+    }
+}