01: /*
02: * Copyright (C) 1999-2004 <A href="http://www-ist.massey.ac.nz/JBDietrich" target="_top">Jens Dietrich</a>
03: *
04: * This library is free software; you can redistribute it and/or
05: * modify it under the terms of the GNU Lesser General Public
06: * License as published by the Free Software Foundation; either
07: * version 2 of the License, or (at your option) any later version.
08: *
09: * 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 org.mandarax.kernel;
19:
20: /**
21: * Event fired to notify listeners that a clause set has changed.
22: * @see org.mandarax.kernel.ClauseSetChangeListener
23: * @author <A href="http://www-ist.massey.ac.nz/JBDietrich" target="_top">Jens Dietrich</A>
24: * @version 3.4 <7 March 05>
25: * @since 1.1
26: */
27: public class ClauseSetChangeEvent extends java.util.EventObject {
28:
29: public static int OTHER = -1;
30: public static int KEY_CHANGED = 0;
31: public static int TERM_CHANGED = 1;
32: private int type = OTHER;
33: private Object oldValue = null;
34: private Object newValue = null;
35:
36: /**
37: * Constructor.
38: * @param source the source of the event
39: * @param oldVal the old value (e.g., the old key or the old terms)
40: * @param newVal the new value
41: * @param aType the type (one of the constants defined in this class)(
42: */
43: public ClauseSetChangeEvent(Object source, Object oldVal,
44: Object newVal, int aType) {
45: super (source);
46: type = aType;
47: oldValue = oldVal;
48: newValue = newVal;
49: }
50:
51: /**
52: * Get the new value.
53: * @return the new value
54: */
55: public Object getNewValue() {
56: return newValue;
57: }
58:
59: /**
60: * Get the old value.
61: * @return the old value
62: */
63: public Object getOldValue() {
64: return oldValue;
65: }
66:
67: /**
68: * Get the event type. Value should be one of the constants listet below.
69: * @see ClauseSetChangeEvent#KEY_CHANGED
70: * @see ClauseSetChangeEvent#TERM_CHANGED
71: * @see ClauseSetChangeEvent#OTHER
72: * @return the type of the event
73: */
74: public int getType() {
75: return type;
76: }
77: }
|