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

Quick Search    Search Deep

Source code: alice/tuplemedium/Event.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  
20  /**
21   * Represents internal events of the tuple centre virtual machine
22   *
23   * According to the tuple centre model, an event is characterised by
24   * the operation which caused the event, the tuple or the tuple template
25   * as information content of the operation, the direction of the
26   * event (from agent to the tuple centre, or viceversa),
27   * the identification of the agent  responsible of the operation,
28   * the identification of the tuple centre where the event has happened.
29   *
30   * @see EventOperation
31   * @see EventDirection
32   * @see TupleCentreVM
33   *
34   * @author <a href="mailto:aricci@deis.unibo.it">Alessandro Ricci</a>
35   * @version 1.0
36   */
37  public class Event implements java.io.Serializable {
38  
39      /** the identifier of the agent involved in the event */
40      public AgentId          idAgent;
41      /** the identifier of the tuple centre where the event took place*/
42      public TupleCentreId        idTupleCentre;
43      /** the direction of the event (from tuple centre to agent or viceversa)*/
44      public int              direction;
45      /** if specified, the information content of the operation*/
46      public Tuple            tuple;
47      /** if speficied, the information template content of the operation*/
48      public TupleTemplate    template;
49      /** the type of the operation which caused the event*/
50      public EventOperation   operation;
51      /** a unique id identifying the event */
52      public Long             id;
53  
54      public Event(){
55      }
56  
57      public Event(Long myid,AgentId aid,EventOperation op,TupleCentreId tid,int evd,Tuple t,TupleTemplate templ){
58          id=myid;
59          idAgent=aid;
60          idTupleCentre=tid;
61          direction=evd;
62          tuple=t;
63          template=templ;
64          operation=op;
65      }
66  
67      public String toString(){
68          return "event( id("+id+"), agent-id("+idAgent+"), op("+operation+"), tuple("+tuple+"), template("+template+"), dir("+direction+"))";
69      }
70  }
71