01: /*
02: * GNetWatch
03: * Copyright 2006, 2007 Alexandre Fenyo
04: * gnetwatch@fenyo.net
05: *
06: * This file is part of GNetWatch.
07: *
08: * GNetWatch is free software; you can redistribute it and/or modify
09: * it under the terms of the GNU General Public License as published by
10: * the Free Software Foundation; either version 2 of the License, or
11: * (at your option) any later version.
12: *
13: * GNetWatch is distributed in the hope that it will be useful,
14: * but WITHOUT ANY WARRANTY; without even the implied warranty of
15: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16: * GNU General Public License for more details.
17: *
18: * You should have received a copy of the GNU General Public License
19: * along with GNetWatch; if not, write to the Free Software
20: * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21: */
22:
23: package net.fenyo.gnetwatch.data;
24:
25: import net.fenyo.gnetwatch.*;
26: import net.fenyo.gnetwatch.targets.*;
27:
28: import java.util.*;
29:
30: import org.apache.commons.logging.Log;
31: import org.apache.commons.logging.LogFactory;
32:
33: /**
34: * This event stores the last RTT computed.
35: * @author Alexandre Fenyo
36: * @version $Id: EventReachable.java,v 1.9 2007/03/03 00:38:20 fenyo Exp $
37: */
38:
39: public class EventReachable extends EventGeneric {
40: private static Log log = LogFactory.getLog(EventReachable.class);
41:
42: private final boolean reachable;
43: private final int delay;
44:
45: /**
46: * Constructor.
47: * @param reachable true if RTT < +inft
48: * @param delay RTT if reachable is true
49: */
50: // Queue thread
51: public EventReachable(final boolean reachable, final int delay) {
52: this .reachable = reachable;
53: this .delay = delay;
54: }
55:
56: /**
57: * Constructor.
58: * @param reachable true if RTT < +inft
59: */
60: // Queue thread
61: public EventReachable(final boolean reachable) {
62: this .reachable = reachable;
63: this .delay = -1;
64: }
65:
66: /**
67: * Returns an integer representation of the performance counter associated whith this event.
68: * @param events every event.
69: * @param idx index of this event.
70: * @return int performance counter.
71: */
72: public int getIntValue(final java.util.List<EventGeneric> events,
73: 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: }
|