]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.browsing.ui.graph/src/org/simantics/browsing/ui/graph/tester/GraphTesters.java
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.browsing.ui.graph / src / org / simantics / browsing / ui / graph / tester / GraphTesters.java
index 2990b2913cd6e2c75ecf4c91d36981fe70520131..05693aeafebe053e3a80a839455c329d558ed95c 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.browsing.ui.graph.tester;\r
-\r
-import org.simantics.Simantics;\r
-import org.simantics.browsing.ui.Tester;\r
-import org.simantics.browsing.ui.common.Testers;\r
-import org.simantics.db.RequestProcessor;\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.Session;\r
-import org.simantics.db.exception.DatabaseException;\r
-import org.simantics.layer0.Layer0;\r
-import org.simantics.simulation.ontology.SimulationResource;\r
-\r
-/**\r
- * A facade class for constructing new {@link Tester} instances for standard\r
- * graph based testing activities. Please use this class instead of directly\r
- * referring to <code>org.simantics.browsing.ui.graph.tester</code> package\r
- * classes.\r
- * \r
- * @author Tuukka Lehtonen\r
- */\r
-public final class GraphTesters {\r
-\r
-    public static Tester pass() {\r
-        return Testers.PASS;\r
-    }\r
-\r
-    public static Tester fail() {\r
-        return Testers.FAIL;\r
-    }\r
-\r
-    /**\r
-     * @param clazz\r
-     * @return\r
-     * \r
-     * TODO: throw exceptions, don't catch.\r
-     */\r
-    public static Tester type(final String uri) {\r
-        try {\r
-            return type(Simantics.getSession(), uri);\r
-        } catch (DatabaseException e) {\r
-            e.printStackTrace();\r
-            return fail();\r
-        }\r
-    }\r
-\r
-    public static Tester standardContextType(final String uri) {\r
-        try {\r
-            return standardContextType(Simantics.getSession(), uri);\r
-        } catch (DatabaseException e) {\r
-            e.printStackTrace();\r
-            return fail();\r
-        }\r
-    }\r
-\r
-    public static Tester standardContextType(Session s, final String uri) throws DatabaseException {\r
-        return new StandardContextHasSomeTypeTester(s, uri);\r
-    }\r
-\r
-    public static Tester type(Session s, final String uri) throws DatabaseException {\r
-        return new HasSomeTypeTester(s, uri);\r
-    }\r
-\r
-    public static Tester type(Resource resource) {\r
-        return new HasSomeTypeTester(resource);\r
-    }\r
-\r
-    /**\r
-     * @param uri\r
-     * @return\r
-     * \r
-     * TODO: throw exceptions, don't catch.\r
-     */\r
-    public static Tester resource(final String uri) {\r
-        try {\r
-            return resource(Simantics.getSession(), uri);\r
-        } catch (DatabaseException e) {\r
-            e.printStackTrace();\r
-            return fail();\r
-        }\r
-    }\r
-\r
-    public static Tester resource(Session s, final String uri) throws DatabaseException {\r
-        return new EqualsResourceTester(s, uri);\r
-    }\r
-\r
-    public static Tester resource(Resource resource) {\r
-        return new EqualsResourceTester(resource);\r
-    }\r
-\r
-    public static Tester inherits(Resource resource) {\r
-        return new InheritsSomeTypeTester(resource);\r
-    }\r
-\r
-    public static Tester model() throws DatabaseException {\r
-        Session s = Simantics.getSession();\r
-        SimulationResource SIMU = SimulationResource.getInstance(s);\r
-        return new HasSomeTypeTester(SIMU.Model);\r
-    }\r
-\r
-    public static Tester type() {\r
-        return new HasSomeTypeTester(Simantics.getSession().getService(Layer0.class).Type);\r
-    }\r
-\r
-    public static Tester orderedSet() {\r
-        return new OrderedSetTester(Simantics.getSession());\r
-    }\r
-\r
-    public static Tester orderedSet(Session s) {\r
-        return new OrderedSetTester(s);\r
-    }\r
-\r
-    public static Tester hasRelatedObjects(Resource relation) {\r
-        return new HasRelatedObjectsTester(relation);\r
-    }\r
-\r
-    public static Tester hasRelatedObjects(RequestProcessor processor, String relationUri) throws DatabaseException {\r
-        return new HasRelatedObjectsTester(processor, relationUri);\r
-    }\r
-\r
-    public static Tester hasRelatedObjects(String relationUri) {\r
-        try {\r
-            return hasRelatedObjects(Simantics.getSession(), relationUri);\r
-        } catch (DatabaseException e) {\r
-            e.printStackTrace();\r
-            return fail();\r
-        }\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.tester;
+
+import org.simantics.Simantics;
+import org.simantics.browsing.ui.Tester;
+import org.simantics.browsing.ui.common.Testers;
+import org.simantics.db.RequestProcessor;
+import org.simantics.db.Resource;
+import org.simantics.db.Session;
+import org.simantics.db.exception.DatabaseException;
+import org.simantics.layer0.Layer0;
+import org.simantics.simulation.ontology.SimulationResource;
+
+/**
+ * A facade class for constructing new {@link Tester} instances for standard
+ * graph based testing activities. Please use this class instead of directly
+ * referring to <code>org.simantics.browsing.ui.graph.tester</code> package
+ * classes.
+ * 
+ * @author Tuukka Lehtonen
+ */
+public final class GraphTesters {
+
+    public static Tester pass() {
+        return Testers.PASS;
+    }
+
+    public static Tester fail() {
+        return Testers.FAIL;
+    }
+
+    /**
+     * @param clazz
+     * @return
+     * 
+     * TODO: throw exceptions, don't catch.
+     */
+    public static Tester type(final String uri) {
+        try {
+            return type(Simantics.getSession(), uri);
+        } catch (DatabaseException e) {
+            e.printStackTrace();
+            return fail();
+        }
+    }
+
+    public static Tester standardContextType(final String uri) {
+        try {
+            return standardContextType(Simantics.getSession(), uri);
+        } catch (DatabaseException e) {
+            e.printStackTrace();
+            return fail();
+        }
+    }
+
+    public static Tester standardContextType(Session s, final String uri) throws DatabaseException {
+        return new StandardContextHasSomeTypeTester(s, uri);
+    }
+
+    public static Tester type(Session s, final String uri) throws DatabaseException {
+        return new HasSomeTypeTester(s, uri);
+    }
+
+    public static Tester type(Resource resource) {
+        return new HasSomeTypeTester(resource);
+    }
+
+    /**
+     * @param uri
+     * @return
+     * 
+     * TODO: throw exceptions, don't catch.
+     */
+    public static Tester resource(final String uri) {
+        try {
+            return resource(Simantics.getSession(), uri);
+        } catch (DatabaseException e) {
+            e.printStackTrace();
+            return fail();
+        }
+    }
+
+    public static Tester resource(Session s, final String uri) throws DatabaseException {
+        return new EqualsResourceTester(s, uri);
+    }
+
+    public static Tester resource(Resource resource) {
+        return new EqualsResourceTester(resource);
+    }
+
+    public static Tester inherits(Resource resource) {
+        return new InheritsSomeTypeTester(resource);
+    }
+
+    public static Tester model() throws DatabaseException {
+        Session s = Simantics.getSession();
+        SimulationResource SIMU = SimulationResource.getInstance(s);
+        return new HasSomeTypeTester(SIMU.Model);
+    }
+
+    public static Tester type() {
+        return new HasSomeTypeTester(Simantics.getSession().getService(Layer0.class).Type);
+    }
+
+    public static Tester orderedSet() {
+        return new OrderedSetTester(Simantics.getSession());
+    }
+
+    public static Tester orderedSet(Session s) {
+        return new OrderedSetTester(s);
+    }
+
+    public static Tester hasRelatedObjects(Resource relation) {
+        return new HasRelatedObjectsTester(relation);
+    }
+
+    public static Tester hasRelatedObjects(RequestProcessor processor, String relationUri) throws DatabaseException {
+        return new HasRelatedObjectsTester(processor, relationUri);
+    }
+
+    public static Tester hasRelatedObjects(String relationUri) {
+        try {
+            return hasRelatedObjects(Simantics.getSession(), relationUri);
+        } catch (DatabaseException e) {
+            e.printStackTrace();
+            return fail();
+        }
+    }
+
+}