Sha256: 05648b8a9949ef6e769b46fa24a2799600e80a1c1abe3a73904d71e35a542f52

Contents?: true

Size: 518 Bytes

Versions: 188

Compression:

Stored size: 518 Bytes

Contents

class Coordinate {

    private final int x;

    private final int y;

    Coordinate(int x, int y) {
        this.x = x;
        this.y = y;
    }

    int getX() {
        return x;
    }

    int getY() {
        return y;
    }

    Coordinate step(Direction direction) {
        return new Coordinate(x + direction.getDx(), y + direction.getDy());
    }

    boolean isWithinGridOfSize(int size) {
        return x >= 0
                && x < size
                && y >= 0
                && y < size;
    }

}

Version data entries

188 entries across 188 versions & 1 rubygems

Version Path
trackler-2.2.1.159 tracks/java/exercises/spiral-matrix/.meta/src/reference/java/Coordinate.java
trackler-2.2.1.158 tracks/java/exercises/spiral-matrix/.meta/src/reference/java/Coordinate.java
trackler-2.2.1.157 tracks/java/exercises/spiral-matrix/.meta/src/reference/java/Coordinate.java
trackler-2.2.1.156 tracks/java/exercises/spiral-matrix/.meta/src/reference/java/Coordinate.java
trackler-2.2.1.155 tracks/java/exercises/spiral-matrix/.meta/src/reference/java/Coordinate.java
trackler-2.2.1.154 tracks/java/exercises/spiral-matrix/.meta/src/reference/java/Coordinate.java
trackler-2.2.1.153 tracks/java/exercises/spiral-matrix/.meta/src/reference/java/Coordinate.java
trackler-2.2.1.152 tracks/java/exercises/spiral-matrix/.meta/src/reference/java/Coordinate.java
trackler-2.2.1.151 tracks/java/exercises/spiral-matrix/.meta/src/reference/java/Coordinate.java
trackler-2.2.1.150 tracks/java/exercises/spiral-matrix/.meta/src/reference/java/Coordinate.java
trackler-2.2.1.149 tracks/java/exercises/spiral-matrix/.meta/src/reference/java/Coordinate.java
trackler-2.2.1.148 tracks/java/exercises/spiral-matrix/.meta/src/reference/java/Coordinate.java
trackler-2.2.1.147 tracks/java/exercises/spiral-matrix/.meta/src/reference/java/Coordinate.java
trackler-2.2.1.146 tracks/java/exercises/spiral-matrix/.meta/src/reference/java/Coordinate.java
trackler-2.2.1.145 tracks/java/exercises/spiral-matrix/.meta/src/reference/java/Coordinate.java
trackler-2.2.1.144 tracks/java/exercises/spiral-matrix/.meta/src/reference/java/Coordinate.java
trackler-2.2.1.143 tracks/java/exercises/spiral-matrix/.meta/src/reference/java/Coordinate.java
trackler-2.2.1.142 tracks/java/exercises/spiral-matrix/.meta/src/reference/java/Coordinate.java
trackler-2.2.1.141 tracks/java/exercises/spiral-matrix/.meta/src/reference/java/Coordinate.java
trackler-2.2.1.140 tracks/java/exercises/spiral-matrix/.meta/src/reference/java/Coordinate.java