package Observe;
import java.util.Observable;
public class PhoneNumber extends Observable {
private Long phoneNumber;
private double bill;
/**
* @return the phoneNumber
*/
public Long getPhoneNumber() {
return phoneNumber;
}
/**
* @param phoneNumber the phoneNumber to set
*/
public void setPhoneNumber(Long phoneNumber) {
this.phoneNumber = phoneNumber;
}
/**
* @return the bill
*/
public double getBill() {
return bill;
}
/**
* @param bill the bill to set
*/
public void setBill(double bill) {
this.bill = bill;
this.setChanged();
this.notifyObservers(bill);
}
public PhoneNumber(){
this.addFriend(new Friend("Tom"));
this.addFriend(new Friend("Jack"));
this.addFriend(new Friend("Mike"));
}
public void addFriend(Friend f){
super.addObserver(f);
}
public void setNumber(Long phoneNumber){
this.phoneNumber=phoneNumber;
this.setChanged();//设置监控点
this.notifyObservers(phoneNumber);
}
}