package example;

public class Main {
  public static void main( String[] args ) {
    Employee e1 = new Employee("Pedro");
    Employee e2 = new Employee("Joao");
    Employee e3 = new Employee("Maria");
    
    EmployeeObserver o1 = new EmployeeObserver("Observer1");
    EmployeeObserver o2 = new EmployeeObserver("Observer2");

    // Registry observables to observer and vice-versa
    // o1 observa e1 e e2
    e1.addObserver(o1);  
    e2.addObserver(o1);  
    o1.addObservable(e1);
    o1.addObservable(e2);
    
    // Registry observables to observer and vice-versa
    // o2 observa e1 e e3 
    e1.addObserver(o2); 
    e3.addObserver(o2); 
    o2.addObservable(e1);
    o2.addObservable(e3);
    
    // Change observable object -> observer
    e1.setSalary(5000.00);
    e2.setSalary(3000.00);    
    e3.setSalary(1000.00);    
  }
}
