]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.db/src/org/simantics/db/ChangeSet.java
Migrated source code from Simantics SVN
[simantics/platform.git] / bundles / org.simantics.db / src / org / simantics / db / ChangeSet.java
diff --git a/bundles/org.simantics.db/src/org/simantics/db/ChangeSet.java b/bundles/org.simantics.db/src/org/simantics/db/ChangeSet.java
new file mode 100644 (file)
index 0000000..5f110c4
--- /dev/null
@@ -0,0 +1,80 @@
+/*******************************************************************************\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;\r
+\r
+import java.util.Collection;\r
+\r
+import org.simantics.db.event.ChangeEvent;\r
+import org.simantics.db.event.ChangeListener;\r
+import org.simantics.db.request.Write;\r
+import org.simantics.db.request.WriteOnly;\r
+import org.simantics.db.service.GraphChangeListenerSupport;\r
+\r
+/**\r
+ * A representation of a set of changes that have been performed into the graph\r
+ * database using a write request ({@link Write}, {@link WriteOnly}).\r
+ * \r
+ * <p>\r
+ * The change information is allowed to be inexact in the sense that these\r
+ * changes may represent what is attempted to commit into the database but some\r
+ * of the changes may turn out to be null operations in the end: a claimed\r
+ * statement may have already existed or a denied statement may not exist in the\r
+ * first place. Hence, a ChangeSet tells what statement changes have possibly\r
+ * been performed and what resource-bound values have possibly changed.\r
+ * \r
+ * @author Tuukka Lehtonen\r
+ * \r
+ * @see GraphChangeListenerSupport\r
+ * @see ChangeListener\r
+ * @see ChangeEvent\r
+ */\r
+public interface ChangeSet {\r
+\r
+    public interface StatementChange extends Statement {\r
+        /**\r
+         * @return <code>true</code> if the statement was claimed,\r
+         *         <code>false</code> if denied.\r
+         */\r
+        boolean isClaim();\r
+    }\r
+\r
+    /**\r
+     * TODO: specify whether the collection is considered a set or a list\r
+     * (duplicate statements allowed or not)\r
+     * \r
+     * The returned collection may be shared internal state of the\r
+     * implementation and must not be modified by the client.\r
+     * \r
+     * @return the set of changed statements, each either claimed or denied\r
+     */\r
+    Collection<StatementChange> changedStatements();\r
+\r
+    /**\r
+     * TODO: specify whether the collection is considered a set or a list\r
+     * (duplicate statements allowed or not)\r
+     * \r
+     * The returned collection may be shared internal state of the\r
+     * implementation and must not be modified by the client.\r
+     * \r
+     * @return the set of changed values, either claimed or denied\r
+     */\r
+    Collection<Resource> changedValues();\r
+    \r
+    Collection<Resource> changedResources();\r
+\r
+    /**\r
+     * @return <code>true</code> if this change set contains 0 operations,\r
+     *         <code>false</code> otherwise\r
+     */\r
+    boolean isEmpty();\r
+\r
+}\r