class IntSize {
  static final IntSize empty = IntSize();

  int _width = 0;
  int _height = 0;

  IntSize();

  factory IntSize.fill(int width, int height) {
    if (width < 0 || height < 0) {
      throw ArgumentError();
    }
    return IntSize()
      .._width = width
      .._height = height;
  }

  int get width => _width;
  set width(int value) {
    if (value < 0) {
      throw ArgumentError("Width");
    }
    _width = value;
  }

  int get height => _height;
  set height(int value) {
    if (value < 0) {
      throw ArgumentError("Height");
    }
    _height = value;
  }

  @override
  bool operator ==(Object other) {
    return other is IntSize &&
        _width == other._width &&
        _height == other._height;
  }

  @override
  int get hashCode => _width.hashCode ^ _height.hashCode;

  @override
  String toString() => 'w:$_width,h:$_height';
}
