Sha256: f6172b4e427d29c548fff1262f128fb577438c8846dc54b51977bde0eb4d846a
Contents?: true
Size: 983 Bytes
Versions: 253
Compression:
Stored size: 983 Bytes
Contents
public final class BoardCoordinate { private final int rank; private final int file; public BoardCoordinate(final int rank, final int file) throws IllegalArgumentException { this.rank = rank; this.file = file; validateInputs(); } public int getRank() { return rank; } public int getFile() { return file; } private void validateInputs() throws IllegalArgumentException { validateCoordinateComponent(rank, "rank"); validateCoordinateComponent(file, "file"); } private void validateCoordinateComponent(final int value, final String componentName) throws IllegalArgumentException { if (value < 0) { throw new IllegalArgumentException("Coordinate must have positive " + componentName + "."); } if (value > 7) { throw new IllegalArgumentException("Coordinate must have " + componentName + " <= 7."); } } }
Version data entries
253 entries across 253 versions & 1 rubygems