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.180 tracks/java/exercises/spiral-matrix/.meta/src/reference/java/Coordinate.java
trackler-2.2.1.179 tracks/java/exercises/spiral-matrix/.meta/src/reference/java/Coordinate.java
trackler-2.2.1.178 tracks/java/exercises/spiral-matrix/.meta/src/reference/java/Coordinate.java
trackler-2.2.1.177 tracks/java/exercises/spiral-matrix/.meta/src/reference/java/Coordinate.java
trackler-2.2.1.176 tracks/java/exercises/spiral-matrix/.meta/src/reference/java/Coordinate.java
trackler-2.2.1.175 tracks/java/exercises/spiral-matrix/.meta/src/reference/java/Coordinate.java
trackler-2.2.1.174 tracks/java/exercises/spiral-matrix/.meta/src/reference/java/Coordinate.java
trackler-2.2.1.173 tracks/java/exercises/spiral-matrix/.meta/src/reference/java/Coordinate.java
trackler-2.2.1.172 tracks/java/exercises/spiral-matrix/.meta/src/reference/java/Coordinate.java
trackler-2.2.1.171 tracks/java/exercises/spiral-matrix/.meta/src/reference/java/Coordinate.java
trackler-2.2.1.170 tracks/java/exercises/spiral-matrix/.meta/src/reference/java/Coordinate.java
trackler-2.2.1.169 tracks/java/exercises/spiral-matrix/.meta/src/reference/java/Coordinate.java
trackler-2.2.1.167 tracks/java/exercises/spiral-matrix/.meta/src/reference/java/Coordinate.java
trackler-2.2.1.166 tracks/java/exercises/spiral-matrix/.meta/src/reference/java/Coordinate.java
trackler-2.2.1.165 tracks/java/exercises/spiral-matrix/.meta/src/reference/java/Coordinate.java
trackler-2.2.1.164 tracks/java/exercises/spiral-matrix/.meta/src/reference/java/Coordinate.java
trackler-2.2.1.163 tracks/java/exercises/spiral-matrix/.meta/src/reference/java/Coordinate.java
trackler-2.2.1.162 tracks/java/exercises/spiral-matrix/.meta/src/reference/java/Coordinate.java
trackler-2.2.1.161 tracks/java/exercises/spiral-matrix/.meta/src/reference/java/Coordinate.java
trackler-2.2.1.160 tracks/java/exercises/spiral-matrix/.meta/src/reference/java/Coordinate.java