/**
 * A phone
 */
public class Phone {
  
  private String number;
  private Phone to;
  private Phone from;
  
  /**
   * Constructor
   * @param number the phone number
   */
  public Phone( String number ) {
    
    this.number = number;
  }
  
  /**
   * Return the phone that called this phone
   * @return the phone that called this phone
   */
  public Phone fromPhone( ) {
    
    return from;
  }
  
  /**
   * Set the phone that called this phone
   * @param the phone that called this phone
   */
  public void setFromPhone( Phone fromPhone ) {
    
    from = fromPhone;
  }
  
  /**
   * Return whether a phone is equal to this phone
   * Whether the two phones have the same number
   * @return whether a phone is equal to this phone
   */
  public boolean equals( Phone phone ) {
    
    return number.equals( phone.number );
  }
  
  /** 
   * Return a string representation of this phone
   * @return a string representation of this phone
   */
  public String toString() {
    
    return number;
  }
}