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 base class for every events stores the date of the event.
35: * @author Alexandre Fenyo
36: * @version $Id: EventGeneric.java,v 1.9 2007/03/09 22:44:20 fenyo Exp $
37: */
38:
39: public abstract class EventGeneric {
40: private static Log log = LogFactory.getLog(EventGeneric.class);
41:
42: private final Date date;
43:
44: /**
45: * Constructor.
46: * @param date date of creation.
47: */
48: protected EventGeneric(final Date date) {
49: this .date = date;
50: }
51:
52: /**
53: * Constructor.
54: * @param none.
55: */
56: // Queue thread
57: public EventGeneric() {
58: this .date = new Date(System.currentTimeMillis());
59: }
60:
61: /**
62: * Returns an integer representation of the performance counter associated whith this event.
63: * @param events every event.
64: * @param idx index of this event.
65: * @return int performance counter.
66: */
67: public int getIntValue(final java.util.List<EventGeneric> events,
68: final int idx) {
69: return -1;
70: }
71:
72: /**
73: * Returns the date of creation of this event.
74: * @param none.
75: * @return Date date of creation.
76: */
77: // AWT & Queue thread
78: public Date getDate() {
79: return date;
80: }
81: }
|