]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.browsing.ui.graph.impl/src/org/simantics/browsing/ui/graph/impl/LazyGraphQueryProcessor.java
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.browsing.ui.graph.impl / src / org / simantics / browsing / ui / graph / impl / LazyGraphQueryProcessor.java
index 00277d4fd3e36956e2854764744335f5f0112db2..98f0c9aecd267ea0c19731733f46c5b502e7fcdb 100644 (file)
@@ -1,67 +1,67 @@
-/*******************************************************************************\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.browsing.ui.graph.impl;\r
-\r
-import org.simantics.browsing.ui.NodeContext;\r
-import org.simantics.browsing.ui.PrimitiveQueryUpdater;\r
-import org.simantics.browsing.ui.NodeContext.PrimitiveQueryKey;\r
-import org.simantics.browsing.ui.common.processors.AbstractPrimitiveQueryProcessor;\r
-import org.simantics.db.ReadGraph;\r
-import org.simantics.db.exception.DatabaseException;\r
-import org.simantics.utils.Container;\r
-\r
-public abstract class LazyGraphQueryProcessor<Result> extends AbstractPrimitiveQueryProcessor<Container<Result>> {\r
-\r
-    /**\r
-     * Returns the value to be returned as the initial query result, before the\r
-     * real result has been calculated.\r
-     * \r
-     * @return the initial result value stored in the returned {@link Container}\r
-     */\r
-    protected abstract Result initial();\r
-\r
-    /**\r
-     * \r
-     * @param graph\r
-     * @param context\r
-     * @return\r
-     */\r
-    protected abstract Result compute(ReadGraph graph, NodeContext context, PrimitiveQueryKey<Container<Result>> key) throws DatabaseException;\r
-\r
-    final Result init = initial();\r
-\r
-    @Override\r
-    public Container<Result> query(PrimitiveQueryUpdater updater, NodeContext context,\r
-            final PrimitiveQueryKey<Container<Result>> key) {\r
-        assert(updater != null);\r
-        assert(context != null);\r
-        assert(key != null);\r
-\r
-        return new LazyResourceQueryContainer<Result>(updater, context, init) {\r
-            @Override\r
-            protected PrimitiveQueryKey<Container<Result>> getKey() {\r
-                return key;\r
-            }\r
-\r
-            @Override\r
-            protected Result compute(ReadGraph graph) throws DatabaseException {\r
-                return LazyGraphQueryProcessor.this.compute(graph, context, key);\r
-            }\r
-        };\r
-    }\r
-\r
-    @Override\r
-    public String toString() {\r
-        return "abstract LazyGraphQueryProcessor2";\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.browsing.ui.graph.impl;
+
+import org.simantics.browsing.ui.NodeContext;
+import org.simantics.browsing.ui.PrimitiveQueryUpdater;
+import org.simantics.browsing.ui.NodeContext.PrimitiveQueryKey;
+import org.simantics.browsing.ui.common.processors.AbstractPrimitiveQueryProcessor;
+import org.simantics.db.ReadGraph;
+import org.simantics.db.exception.DatabaseException;
+import org.simantics.utils.Container;
+
+public abstract class LazyGraphQueryProcessor<Result> extends AbstractPrimitiveQueryProcessor<Container<Result>> {
+
+    /**
+     * Returns the value to be returned as the initial query result, before the
+     * real result has been calculated.
+     * 
+     * @return the initial result value stored in the returned {@link Container}
+     */
+    protected abstract Result initial();
+
+    /**
+     * 
+     * @param graph
+     * @param context
+     * @return
+     */
+    protected abstract Result compute(ReadGraph graph, NodeContext context, PrimitiveQueryKey<Container<Result>> key) throws DatabaseException;
+
+    final Result init = initial();
+
+    @Override
+    public Container<Result> query(PrimitiveQueryUpdater updater, NodeContext context,
+            final PrimitiveQueryKey<Container<Result>> key) {
+        assert(updater != null);
+        assert(context != null);
+        assert(key != null);
+
+        return new LazyResourceQueryContainer<Result>(updater, context, init) {
+            @Override
+            protected PrimitiveQueryKey<Container<Result>> getKey() {
+                return key;
+            }
+
+            @Override
+            protected Result compute(ReadGraph graph) throws DatabaseException {
+                return LazyGraphQueryProcessor.this.compute(graph, context, key);
+            }
+        };
+    }
+
+    @Override
+    public String toString() {
+        return "abstract LazyGraphQueryProcessor2";
+    }
+
+}