package ex.core;

/**
 * This class represents an integer number.
 **/

public class Number {
  private int _number;
  private int _count;
  
  Number(int n) {
    _number = n;
    _count = 1;
  }

  public int number() {
    return _number;
  }

  void incCount() {
    _count++;
  }

  void decCount() {
    _count--;
  }

  int count() {
    return _count;
  }
  
  public String toString() {
    String times = _count > 1 ? " times" : " time";
    return "" + _number + " : " + _count + times;
  }

  public final boolean equals(Object obj) {
    return obj instanceof Number && ((Number)obj)._number == _number;
  }
}