]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.db.impl/src/org/simantics/db/impl/graph/ArraySet.java
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.db.impl / src / org / simantics / db / impl / graph / ArraySet.java
index d7e0aa8bc979a00bb229f30ec2b56eded6337dd3..1360cef74eed4f747b8e610c5aef0d72fae04450 100644 (file)
-/*******************************************************************************\r
- * Copyright (c) 2007, 2010 Association for Decentralized Information Management\r
- * in Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.db.impl.graph;\r
-\r
-import java.util.Collection;\r
-import java.util.Iterator;\r
-import java.util.Set;\r
-\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.impl.query.IntSet;\r
-import org.simantics.db.impl.query.QuerySupport;\r
-\r
-public class ArraySet implements Set<Resource> {\r
-    \r
-    final Resource[] set;\r
-\r
-    ArraySet(IntSet intSet, QuerySupport support) {\r
-        \r
-        if(intSet.data == null) {\r
-            if(intSet.sizeOrData != IntSet.NO_DATA) {\r
-                set = new Resource[] { support.getResource(intSet.sizeOrData) };\r
-            } else {\r
-                set = Resource.NONE;\r
-            }\r
-        } else {\r
-            set = new Resource[intSet.sizeOrData];\r
-            for(int i=0;i<intSet.sizeOrData;i++) set[i] = support.getResource(intSet.data[i]);\r
-        }\r
-        \r
-    }\r
-    \r
-    @Override\r
-    public boolean add(Resource e) {\r
-        throw new UnsupportedOperationException();\r
-    }\r
-\r
-    @Override\r
-    public boolean addAll(Collection<? extends Resource> c) {\r
-        throw new UnsupportedOperationException();\r
-    }\r
-\r
-    @Override\r
-    public void clear() {\r
-        throw new UnsupportedOperationException();\r
-    }\r
-\r
-    @Override\r
-    public boolean contains(Object o) {\r
-        for(int i=0;i<set.length;i++) if(o.equals(set[i])) return true;\r
-        return false;\r
-    }\r
-\r
-    @Override\r
-    public boolean containsAll(Collection<?> c) {\r
-        throw new UnsupportedOperationException();\r
-    }\r
-\r
-    @Override\r
-    public boolean isEmpty() {\r
-        return set.length == 0;\r
-    }\r
-\r
-    @Override\r
-    public Iterator<Resource> iterator() {\r
-        \r
-        class ArraySetIterator implements Iterator<Resource> {\r
-            \r
-            int next = 0;\r
-\r
-            @Override\r
-            public boolean hasNext() {\r
-                return next < set.length;\r
-            }\r
-\r
-            @Override\r
-            public Resource next() {\r
-                return set[next++];\r
-            }\r
-\r
-            @Override\r
-            public void remove() {\r
-                throw new UnsupportedOperationException();\r
-            }\r
-            \r
-        }\r
-        \r
-        return new ArraySetIterator();\r
-        \r
-    }\r
-\r
-    @Override\r
-    public boolean remove(Object o) {\r
-        throw new UnsupportedOperationException();\r
-    }\r
-\r
-    @Override\r
-    public boolean removeAll(Collection<?> c) {\r
-        throw new UnsupportedOperationException();\r
-    }\r
-\r
-    @Override\r
-    public boolean retainAll(Collection<?> c) {\r
-        throw new UnsupportedOperationException();\r
-    }\r
-\r
-    @Override\r
-    public int size() {\r
-        return set.length;\r
-    }\r
-\r
-    @Override\r
-    public Object[] toArray() {\r
-        throw new UnsupportedOperationException();\r
-    }\r
-\r
-    @Override\r
-    public <T> T[] toArray(T[] a) {\r
-        throw new UnsupportedOperationException();\r
-    }\r
-\r
-}\r
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Association for Decentralized Information Management
+ * in Industry THTH ry.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     VTT Technical Research Centre of Finland - initial API and implementation
+ *******************************************************************************/
+package org.simantics.db.impl.graph;
+
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Set;
+
+import org.simantics.db.Resource;
+import org.simantics.db.impl.query.IntSet;
+import org.simantics.db.impl.query.QuerySupport;
+
+public class ArraySet implements Set<Resource> {
+    
+    final Resource[] set;
+
+    ArraySet(IntSet intSet, QuerySupport support) {
+        
+        if(intSet.data == null) {
+            if(intSet.sizeOrData != IntSet.NO_DATA) {
+                set = new Resource[] { support.getResource(intSet.sizeOrData) };
+            } else {
+                set = Resource.NONE;
+            }
+        } else {
+            set = new Resource[intSet.sizeOrData];
+            for(int i=0;i<intSet.sizeOrData;i++) set[i] = support.getResource(intSet.data[i]);
+        }
+        
+    }
+    
+    @Override
+    public boolean add(Resource e) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public boolean addAll(Collection<? extends Resource> c) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public void clear() {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public boolean contains(Object o) {
+        for(int i=0;i<set.length;i++) if(o.equals(set[i])) return true;
+        return false;
+    }
+
+    @Override
+    public boolean containsAll(Collection<?> c) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public boolean isEmpty() {
+        return set.length == 0;
+    }
+
+    @Override
+    public Iterator<Resource> iterator() {
+        
+        class ArraySetIterator implements Iterator<Resource> {
+            
+            int next = 0;
+
+            @Override
+            public boolean hasNext() {
+                return next < set.length;
+            }
+
+            @Override
+            public Resource next() {
+                return set[next++];
+            }
+
+            @Override
+            public void remove() {
+                throw new UnsupportedOperationException();
+            }
+            
+        }
+        
+        return new ArraySetIterator();
+        
+    }
+
+    @Override
+    public boolean remove(Object o) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public boolean removeAll(Collection<?> c) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public boolean retainAll(Collection<?> c) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public int size() {
+        return set.length;
+    }
+
+    @Override
+    public Object[] toArray() {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public <T> T[] toArray(T[] a) {
+        throw new UnsupportedOperationException();
+    }
+
+}