View Javadoc

1   /*
2    * Copyright (c) 1998-2006 The Jgroup Team.
3    *
4    * This program is free software; you can redistribute it and/or modify
5    * it under the terms of the GNU Lesser General Public License version 2 as
6    * published by the Free Software Foundation.
7    *
8    * This program is distributed in the hope that it will be useful,
9    * but WITHOUT ANY WARRANTY; without even the implied warranty of
10   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11   * GNU Lesser General Public License for more details.
12   *
13   * You should have received a copy of the GNU Lesser General Public License
14   * along with this program; if not, write to the Free Software
15   * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
16   *
17   */
18  
19  package jgroup.util.log;
20  
21  /**
22   * ExperimentEvent 
23   *
24   * @author Hein Meling <hein.meling@uis.no>
25   */
26  public class ExperimentEvent
27    extends Event
28  {
29  
30    ////////////////////////////////////////////////////////////////////////////////////////////
31    // Constants
32    ////////////////////////////////////////////////////////////////////////////////////////////
33  
34    private static final long serialVersionUID = -4491709600445800676L;
35  
36    /**
37     * Supported experiment event types.
38     */
39    public enum Type implements EventType { Begin, End }
40  
41  
42    ////////////////////////////////////////////////////////////////////////////////////////////
43    // Fields
44    ////////////////////////////////////////////////////////////////////////////////////////////
45  
46    /**
47     * The round number for this experiment event
48     */
49    private int round;
50  
51    /**
52     * The rerun number for this experiment event
53     */
54    private int rerun;
55  
56  
57    ////////////////////////////////////////////////////////////////////////////////////////////
58    // Constructor
59    ////////////////////////////////////////////////////////////////////////////////////////////
60  
61    public ExperimentEvent(EventType type, int round, int rerun)
62    {
63      super(type, "Round: " + round + ((rerun == -1) ? "" : ", rerun=" + rerun));
64      this.round = round;
65      this.rerun = rerun;
66    }
67  
68  
69    ////////////////////////////////////////////////////////////////////////////////////////////
70    // Access Methods
71    ////////////////////////////////////////////////////////////////////////////////////////////
72  
73    /**
74     * @return Returns the round of this experiment event.
75     */
76    public int getRound()
77    {
78      return round;
79    }
80  
81    /**
82     * @return Returns the rerun number for this experiment event
83     */
84    public int getRerun()
85    {
86      return rerun;
87    }
88  
89    /**
90     * @return Returns true if the event type is <code>End</code>; otherwise false.
91     * 
92     * @see jgroup.util.log.Event#isLastEvent()
93     */
94    @Override
95    public boolean isLastEvent()
96    {
97      return type == Type.End;
98    }
99  
100 
101   ////////////////////////////////////////////////////////////////////////////////////////////
102   // Methods from Object
103   ////////////////////////////////////////////////////////////////////////////////////////////
104 
105   public String toString()
106   {
107     return commonToString(true).toString();
108   }
109 
110 } // END ExperimentEvent