You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
766 B
28 lines
766 B
package mock.model.commandFactory;
|
|
|
|
import java.util.Observable;
|
|
|
|
/**
|
|
* Used to track the current active observer command. This is to ensure two commands that do similar things do not overlap.
|
|
*/
|
|
public class ActiveObserverCommand {
|
|
private ObserverCommand currentVelocityCommand;
|
|
private ObserverCommand currentAngularCommand;
|
|
|
|
public ActiveObserverCommand() {
|
|
|
|
}
|
|
|
|
public void changeVelocityCommand(Observable o, ObserverCommand c) {
|
|
o.deleteObserver(currentVelocityCommand);
|
|
o.addObserver(c);
|
|
currentVelocityCommand = c;
|
|
}
|
|
|
|
public void changeAngularCommand(Observable o, ObserverCommand c) {
|
|
o.deleteObserver(currentAngularCommand);
|
|
o.addObserver(c);
|
|
currentAngularCommand = c;
|
|
}
|
|
}
|