クラス Point

java.lang.Object
xyz.hotchpotch.reversi.core.Point

public class Point extends Object
リバーシ盤上の位置を表す不変クラスです。
同じ位置を表す Point インスタンスは同一であることが保証されます。
  • フィールドの概要

    フィールド
    修飾子とタイプ
    フィールド
    説明
    static final int
    座標平面(リバーシ盤)の高さ
    static final int
    座標平面(リバーシ盤)の幅
  • メソッドの概要

    修飾子とタイプ
    メソッド
    説明
    boolean
    hasNext(Direction direction)
    指定された方向に次の Point が存在するかを返します。
    int
    i()
    縦座標を返します。
    int
    j()
    横座標を返します。
    next(Direction direction)
    指定された方向の次の Point を返します。
    static Point
    of(int i, int j)
    指定された位置を表す Point インスタンスを返します。
    static Point
    of(String pos)
    指定された位置を表す Point インスタンスを返します。
    pos()
    "a1""h8" 形式の座標を返します。
    static Stream<Point>
    全ての Point オブジェクトを含む直列ストリームを返します。
     
    static Point[]
    全ての Point オブジェクトを含む配列を返します。

    クラスから継承されたメソッド java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • フィールド詳細

    • HEIGHT

      public static final int HEIGHT
      座標平面(リバーシ盤)の高さ
      関連項目:
    • WIDTH

      public static final int WIDTH
      座標平面(リバーシ盤)の幅
      関連項目:
  • メソッドの詳細

    • values

      public static Point[] values()
      全ての Point オブジェクトを含む配列を返します。
      戻り値:
      全ての Point オブジェクトが格納された配列
    • stream

      public static Stream<Point> stream()
      全ての Point オブジェクトを含む直列ストリームを返します。
      戻り値:
      全ての Point オブジェクトを含む直列ストリーム
    • of

      public static Point of(int i, int j)
      指定された位置を表す Point インスタンスを返します。
      パラメータ:
      i - 縦座標
      j - 横座標
      戻り値:
      指定された位置を表す Point インスタンス
      例外:
      IndexOutOfBoundsException - 指定された座標が範囲外の場合
    • of

      public static Point of(String pos)
      指定された位置を表す Point インスタンスを返します。
      パラメータ:
      pos - "a1""h8" 形式の座標
      戻り値:
      指定された位置を表す Point インスタンス
      例外:
      NullPointerException - pos"null" の場合
      IllegalArgumentException - pos の形式が不正な場合 または 範囲外の場合
    • i

      public int i()
      縦座標を返します。
      戻り値:
      縦座標
    • j

      public int j()
      横座標を返します。
      戻り値:
      横座標
    • pos

      public String pos()
      "a1""h8" 形式の座標を返します。
      戻り値:
      "a1""h8" 形式の座標
    • hasNext

      public boolean hasNext(Direction direction)
      指定された方向に次の Point が存在するかを返します。
      パラメータ:
      direction - 方向
      戻り値:
      指定された方向に次の Point が存在する場合は true
      例外:
      NullPointerException - directionnull の場合
    • next

      public Point next(Direction direction)
      指定された方向の次の Point を返します。
      パラメータ:
      direction - 方向
      戻り値:
      指定された方向の次の Point
      例外:
      NullPointerException - directionnull の場合
      NoSuchElementException - 指定された方向に次の Point が存在しない場合
    • toString

      public String toString()
      オーバーライド:
      toString クラス内 Object