P
__PPS__
Hello, I'm a c++ programmer and I have a qestion about a simple code
implementation in Java.
Basicly, I have a set of EventHandlers (just some class). Handlers
could be added/removed/suspended/active...
EventHandler is a class written by someone else and it must not be
modified; this class knows nothing about suspended/active state.
The way I'd do this in c++: make a set of std:
air<EventHandler,
State> or something like this.
here's how I did this in Java and it doesn't work.
class EventHandlerWrapper extends EventHandler {
public enum State {
SUSPENDED,
ACTIVE
}
protected State _state = State.ACTIVE;
public void Suspend(){
_state = State.SUSPENDED;
}
public void Resume(){
_state = State.ACTIVE;
}
}
Now I want to be able to add EventHandler's into the
Set<EventHandlerWrapper>, but it doesn't work. I' messed up with
casting etc.
what's the right way to do this kind of stuff in Java
thanks!!
implementation in Java.
Basicly, I have a set of EventHandlers (just some class). Handlers
could be added/removed/suspended/active...
EventHandler is a class written by someone else and it must not be
modified; this class knows nothing about suspended/active state.
The way I'd do this in c++: make a set of std:
State> or something like this.
here's how I did this in Java and it doesn't work.
class EventHandlerWrapper extends EventHandler {
public enum State {
SUSPENDED,
ACTIVE
}
protected State _state = State.ACTIVE;
public void Suspend(){
_state = State.SUSPENDED;
}
public void Resume(){
_state = State.ACTIVE;
}
}
Now I want to be able to add EventHandler's into the
Set<EventHandlerWrapper>, but it doesn't work. I' messed up with
casting etc.
what's the right way to do this kind of stuff in Java
thanks!!