]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.databoard/scratch/org/simantics/databoard/tests/Jotakin3.java
Migrated source code from Simantics SVN
[simantics/platform.git] / bundles / org.simantics.databoard / scratch / org / simantics / databoard / tests / Jotakin3.java
diff --git a/bundles/org.simantics.databoard/scratch/org/simantics/databoard/tests/Jotakin3.java b/bundles/org.simantics.databoard/scratch/org/simantics/databoard/tests/Jotakin3.java
new file mode 100644 (file)
index 0000000..2aa3c06
--- /dev/null
@@ -0,0 +1,64 @@
+/*******************************************************************************\r
+ * Copyright (c) 2010- Association for Decentralized Information Management in\r
+ * 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.databoard.tests;\r
+\r
+import org.simantics.databoard.accessor.reference.ChildReference;\r
+import org.simantics.databoard.accessor.reference.ComponentReference;\r
+import org.simantics.databoard.accessor.reference.KeyReference;\r
+import org.simantics.databoard.accessor.reference.LabelReference;\r
+import org.simantics.databoard.accessor.reference.NameReference;\r
+import org.simantics.databoard.binding.mutable.MutableVariant;\r
+\r
+public class Jotakin3 {\r
+\r
+       public static void main(String[] args) {\r
+               \r
+               ChildReference ref1 = ChildReference.compile(\r
+                               new NameReference("nodes"),\r
+                               new KeyReference( MutableVariant.ofInstance("SINE") ),\r
+                               new NameReference("value"),\r
+                               new ComponentReference(),\r
+                               new ComponentReference()\r
+                               ); \r
+\r
+               ChildReference ref4 = ChildReference.compile(\r
+                               new LabelReference("nodes"),\r
+                               new LabelReference("SSINE"),\r
+                               new LabelReference("value"),\r
+                               new LabelReference("o"),\r
+                               new LabelReference("v")\r
+                               ); \r
+               \r
+               System.out.println(ref1.toPath(true));  \r
+               System.out.println(ref1.toPath(false)); \r
+               \r
+               ChildReference ref2 = ChildReference.parsePath("n-nodes/m-SSINE/n-value/o/v");\r
+               System.out.println(ref2.toPath(true));  \r
+               System.out.println(ref2.toPath(false)); \r
+               \r
+               ChildReference ref3 = ChildReference.parsePath("nodes/SSINE/value/o/v");\r
+               System.out.println(ref3.toPath(true));  \r
+               System.out.println(ref3.toPath(false));\r
+               \r
+               System.out.println( ref1.equals( ref2 ) );\r
+               System.out.println( ref2.equals( ref1 ) );\r
+               \r
+               System.out.println( ref1.equals( ref3 ) );\r
+               System.out.println( ref3.equals( ref1 ) );\r
+\r
+               System.out.println( ref3.equals( ref4 ) );\r
+               System.out.println( ref4.equals( ref3 ) );\r
+\r
+       }\r
+       \r
+}\r
+\r