export class TreeCount {
  private constructor(public readonly value: number) {
    if (value <= 0 || !Number.isInteger(value)) {
      throw new Error('认种数量必须是正整数');
    }
  }

  static create(value: number): TreeCount {
    return new TreeCount(value);
  }

  multiply(factor: number): number {
    return this.value * factor;
  }

  add(other: TreeCount): TreeCount {
    return new TreeCount(this.value + other.value);
  }

  equals(other: TreeCount): boolean {
    return this.value === other.value;
  }
}
