@Test public void testToId() { final Move mvt1 = new Move(BLACK_PAWN, Square.valueOf("a2"), Square.valueOf("a4")); final Move mvt2 = new Move(BLACK_PAWN, Square.valueOf(8), Square.valueOf(24)); final Move mvt3 = new Move(WHITE_BISHOP, Square.valueOf("a3"), Square.valueOf("d6"), BLACK_PAWN); assertTrue(mvt1.toId() == mvt2.toId()); assertTrue(mvt1.toId() != mvt3.toId()); assertEquals(mvt1, Move.valueOf(mvt1.toId())); assertEquals(mvt1, Move.valueOf(mvt2.toId())); assertFalse(mvt1.equals(Move.valueOf(mvt3.toId()))); }
public int toId() { if (_id == null) { int id = (_piece.ordinal() << 20) + (_from.getIndex() << 14) + (_to.getIndex() << 8); if (_captured != null) { id += (_captured.ordinal() + 1) << 4; } _id = Integer.valueOf(id); } return _id.intValue(); }
Move implements Serializable { public int toId() { if (_id == null) { int id = (_piece.ordinal() << 20) + (_from.getIndex() << 14) + (_to.getIndex() << 8); if (_captured != null) { id += (_captured.ordinal() + 1) << 4; } _id = Integer.valueOf(id); } return _id.intValue(); } }
Move implements Serializable { public int toId() { if (_id == null) { int id = (_piece.ordinal() << 20) + (_from.getIndex() << 14) + (_to.getIndex() << 8); if (_captured != null) { id += (_captured.ordinal() + 1) << 4; } _id = Integer.valueOf(id); } return _id.intValue(); } Move(final Piece pPiece, final Square pOrigine, final Square pDestination);  Move(final Piece pPiece, final Square pOrigine, final Square pDestination,
      final Piece pPrise); }
Move implements Serializable { public int toId() { if (_id == null) { int id = (_piece.ordinal() << 20) + (_from.getIndex() << 14) + (_to.getIndex() << 8); if (_captured != null) { id += (_captured.ordinal() + 1) << 4; } _id = Integer.valueOf(id); } return _id.intValue(); } Move(final Piece pPiece, final Square pOrigine, final Square pDestination);  Move(final Piece pPiece, final Square pOrigine, final Square pDestination,
      final Piece pPrise); @Override boolean equals(final Object pObjet); Piece getCaptured(); Square getFrom(); Piece getPiece(); Square getTo(); @Override int hashCode(); int toId(); @Override String toString(); static Move valueOf(final int pId); }
Move implements Serializable { public int toId() { if (_id == null) { int id = (_piece.ordinal() << 20) + (_from.getIndex() << 14) + (_to.getIndex() << 8); if (_captured != null) { id += (_captured.ordinal() + 1) << 4; } _id = Integer.valueOf(id); } return _id.intValue(); } Move(final Piece pPiece, final Square pOrigine, final Square pDestination);  Move(final Piece pPiece, final Square pOrigine, final Square pDestination,
      final Piece pPrise); @Override boolean equals(final Object pObjet); Piece getCaptured(); Square getFrom(); Piece getPiece(); Square getTo(); @Override int hashCode(); int toId(); @Override String toString(); static Move valueOf(final int pId);  }