26 lines
717 B
Java
26 lines
717 B
Java
package bridge;
|
|
|
|
/**
|
|
* Refined Abstraction — extends RemoteControl with extra features.
|
|
* This is how you vary the "abstraction" side independently of the
|
|
* "implementation" side. Both TV and Radio work with this remote,
|
|
* even though they know nothing about it.
|
|
*/
|
|
public class AdvancedRemote extends RemoteControl {
|
|
|
|
public AdvancedRemote(Device device) {
|
|
super(device);
|
|
}
|
|
|
|
// Extra feature not in the basic remote
|
|
public void mute() {
|
|
System.out.println(" Muting " + device.getName());
|
|
device.setVolume(0);
|
|
}
|
|
|
|
public void jumpToChannel(int channel) {
|
|
System.out.println(" Jumping to channel " + channel);
|
|
device.setChannel(channel);
|
|
}
|
|
}
|