Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: alice/tuplemedium/TRSet.java


1   /*
2    * Tuple Centre media - Copyright (C) 2001 deis.unibo.it
3    *
4    * This library is free software; you can redistribute it and/or
5    * modify it under the terms of the GNU Lesser General Public
6    * License as published by the Free Software Foundation; either
7    * version 2.1 of the License, or (at your option) any later version.
8    *
9    * This library is distributed in the hope that it will be useful,
10   * but WITHOUT ANY WARRANTY; without even the implied warranty of
11   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12   * Lesser General Public License for more details.
13   *
14   * You should have received a copy of the GNU Lesser General Public
15   * License along with this library; if not, write to the Free Software
16   * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17   */
18  package alice.tuplemedium;
19  import java.util.*;
20  
21  /**
22   * Specifies the services which must be provided by the component
23   * inside the tuple centre virtual machine collecting and managing
24   * triggered reactions as a multiset
25   *
26   * An important aspect of the component implementing this interface
27   * is the ability to execute transactions, that is execute sequence
28   * of operations that could be commited or asked to be undone.
29   *
30   * @see TriggeredReaction
31   * @see Reaction
32   * @see Reactor
33   * @see TupleCentreVM
34   *
35   * @author <a href="mailto:aricci@deis.unibo.it">Alessandro Ricci</a>
36   * @version 1.0
37   */
38  public interface TRSet {
39  
40      /**
41       * Adds a triggered reaction to the multiset
42       *
43       * @param t the triggered reaction to be added
44       */
45      void add(TriggeredReaction t);
46  
47      /**
48       * Removes a triggered reaction from the multiset
49       *
50       * @param t the triggered reaction to be removed
51       */
52      void sub(TriggeredReaction t);
53  
54      /**
55       * Tests if the multiset is empty
56       */
57      boolean isEmpty();
58  
59      /**
60       * Empties the multiset
61       */
62      void empty();
63  
64      /**
65       * Begins a transaction section
66       *
67       * Every operation on multiset can be undone
68       */
69      void beginTransaction();
70  
71      /**
72       * Ends a transaction section specifying
73       * if operations must be committed or undone
74       *
75       * @param commit if <code>true</code> the operations are committed, else
76       *               they are undone and the multiset is rolled back to the
77       *               state before the <code>beginTransaction</code> invocation
78       */
79      void endTransaction(boolean commit);
80  
81      /**
82       * Gets not-deterministically (with removal) a triggered reaction from
83       * the multiset
84       *
85       * @return the triggered reaction removed
86       **/
87      TriggeredReaction get();
88  
89      /**
90       * Gets an iterator to navigate through triggered reactions
91       *
92       * @return the iterator
93       */
94      Iterator getIterator();
95  }
96