KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > fenyo > gnetwatch > data > EventReachable


1
2 /*
3  * GNetWatch
4  * Copyright 2006, 2007 Alexandre Fenyo
5  * gnetwatch@fenyo.net
6  *
7  * This file is part of GNetWatch.
8  *
9  * GNetWatch is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * GNetWatch is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with GNetWatch; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22  */

23
24 package net.fenyo.gnetwatch.data;
25
26 import net.fenyo.gnetwatch.*;
27 import net.fenyo.gnetwatch.targets.*;
28
29 import java.util.*;
30
31 import org.apache.commons.logging.Log;
32 import org.apache.commons.logging.LogFactory;
33
34 /**
35  * This event stores the last RTT computed.
36  * @author Alexandre Fenyo
37  * @version $Id: EventReachable.java,v 1.9 2007/03/03 00:38:20 fenyo Exp $
38  */

39
40 public class EventReachable extends EventGeneric {
41   private static Log log = LogFactory.getLog(EventReachable.class);
42
43   private final boolean reachable;
44   private final int delay;
45
46   /**
47    * Constructor.
48    * @param reachable true if RTT < +inft
49    * @param delay RTT if reachable is true
50    */

51   // Queue thread
52
public EventReachable(final boolean reachable, final int delay) {
53     this.reachable = reachable;
54     this.delay = delay;
55   }
56
57   /**
58    * Constructor.
59    * @param reachable true if RTT < +inft
60    */

61   // Queue thread
62
public EventReachable(final boolean reachable) {
63     this.reachable = reachable;
64     this.delay = -1;
65   }
66
67   /**
68    * Returns an integer representation of the performance counter associated whith this event.
69    * @param events every event.
70    * @param idx index of this event.
71    * @return int performance counter.
72    */

73   public int getIntValue(final java.util.List JavaDoc<EventGeneric> events, final int idx) {
74     return getDelay();
75   }
76
77   /**
78    * Returns the RTT associated to this event.
79    * @param none.
80    * @return int RTT.
81    */

82   // Queue & AWT thread
83
public int getDelay() {
84     return delay;
85   }
86 }
87
Popular Tags