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