]> gerrit.simantics Code Review - simantics/platform.git/blob - 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
1 /*******************************************************************************\r
2  * Copyright (c) 2007, 2010 Association for Decentralized Information Management\r
3  * in Industry THTH ry.\r
4  * All rights reserved. This program and the accompanying materials\r
5  * are made available under the terms of the Eclipse Public License v1.0\r
6  * which accompanies this distribution, and is available at\r
7  * http://www.eclipse.org/legal/epl-v10.html\r
8  *\r
9  * Contributors:\r
10  *     VTT Technical Research Centre of Finland - initial API and implementation\r
11  *******************************************************************************/\r
12 package org.simantics.db;\r
13 \r
14 import java.util.Collection;\r
15 \r
16 import org.simantics.db.event.ChangeEvent;\r
17 import org.simantics.db.event.ChangeListener;\r
18 import org.simantics.db.request.Write;\r
19 import org.simantics.db.request.WriteOnly;\r
20 import org.simantics.db.service.GraphChangeListenerSupport;\r
21 \r
22 /**\r
23  * A representation of a set of changes that have been performed into the graph\r
24  * database using a write request ({@link Write}, {@link WriteOnly}).\r
25  * \r
26  * <p>\r
27  * The change information is allowed to be inexact in the sense that these\r
28  * changes may represent what is attempted to commit into the database but some\r
29  * of the changes may turn out to be null operations in the end: a claimed\r
30  * statement may have already existed or a denied statement may not exist in the\r
31  * first place. Hence, a ChangeSet tells what statement changes have possibly\r
32  * been performed and what resource-bound values have possibly changed.\r
33  * \r
34  * @author Tuukka Lehtonen\r
35  * \r
36  * @see GraphChangeListenerSupport\r
37  * @see ChangeListener\r
38  * @see ChangeEvent\r
39  */\r
40 public interface ChangeSet {\r
41 \r
42     public interface StatementChange extends Statement {\r
43         /**\r
44          * @return <code>true</code> if the statement was claimed,\r
45          *         <code>false</code> if denied.\r
46          */\r
47         boolean isClaim();\r
48     }\r
49 \r
50     /**\r
51      * TODO: specify whether the collection is considered a set or a list\r
52      * (duplicate statements allowed or not)\r
53      * \r
54      * The returned collection may be shared internal state of the\r
55      * implementation and must not be modified by the client.\r
56      * \r
57      * @return the set of changed statements, each either claimed or denied\r
58      */\r
59     Collection<StatementChange> changedStatements();\r
60 \r
61     /**\r
62      * TODO: specify whether the collection is considered a set or a list\r
63      * (duplicate statements allowed or not)\r
64      * \r
65      * The returned collection may be shared internal state of the\r
66      * implementation and must not be modified by the client.\r
67      * \r
68      * @return the set of changed values, either claimed or denied\r
69      */\r
70     Collection<Resource> changedValues();\r
71     \r
72     Collection<Resource> changedResources();\r
73 \r
74     /**\r
75      * @return <code>true</code> if this change set contains 0 operations,\r
76      *         <code>false</code> otherwise\r
77      */\r
78     boolean isEmpty();\r
79 \r
80 }\r