01: package org.drools;
02:
03: import java.beans.PropertyChangeListener;
04: import java.beans.PropertyChangeSupport;
05:
06: public class State {
07: private final PropertyChangeSupport changes = new PropertyChangeSupport(
08: this );
09:
10: private String state;
11: private boolean flag;
12:
13: public State() {
14:
15: }
16:
17: public State(final String state) {
18: this .state = state;
19: }
20:
21: public String getState() {
22: return this .state;
23: }
24:
25: public void setState(final String newState) {
26: final String oldState = this .state;
27: this .state = newState;
28: this .changes.firePropertyChange("state", oldState, newState);
29: }
30:
31: public void addPropertyChangeListener(final PropertyChangeListener l) {
32: this .changes.addPropertyChangeListener(l);
33: }
34:
35: public void removePropertyChangeListener(
36: final PropertyChangeListener l) {
37: this .changes.removePropertyChangeListener(l);
38: }
39:
40: public boolean isFlag() {
41: return this .flag;
42: }
43:
44: public void setFlag(final boolean flag) {
45: final boolean old = this .flag;
46: this .flag = flag;
47: this .changes.firePropertyChange("flag", old, flag);
48: }
49: }
|