Sha256: 0cf9573f53231fbc766c7500ccfc14957288ebbb08d74e95ce9980c66e52b21d

Contents?: true

Size: 1.27 KB

Versions: 284

Compression:

Stored size: 1.27 KB

Contents

import java.util.List;

import static java.util.Arrays.asList;
import static java.util.Arrays.stream;

enum Digit {

    ZERO(asList(" _ ",
                "| |",
                "|_|")),

    ONE(asList("   ",
               "  |",
               "  |")),

    TWO(asList(" _ ",
               " _|",
               "|_ ")),

    THREE(asList(" _ ",
                 " _|",
                 " _|")),

    FOUR(asList("   ",
                "|_|",
                "  |")),

    FIVE(asList(" _ ",
                "|_ ",
                " _|")),

    SIX(asList(" _ ",
               "|_ ",
               "|_|")),

    SEVEN(asList(" _ ",
                 "  |",
                 "  |")),

    EIGHT(asList(" _ ",
                 "|_|",
                 "|_|")),

    NINE(asList(" _ ",
                "|_|",
                " _|"));

    private final List<String> ssdRepresentation;

    Digit(List<String> ssd) {
        this.ssdRepresentation = ssd;
    }

    static String fromSsdConfiguration(final List<String> ssdConfiguration) {
        return stream(values())
                .filter(digit -> digit.ssdRepresentation.equals(ssdConfiguration))
                .map(Digit::ordinal)
                .map(Object::toString)
                .findFirst()
                .orElse("?");
    }

}

Version data entries

284 entries across 284 versions & 1 rubygems

Version Path
trackler-2.2.1.180 tracks/java/exercises/ocr-numbers/.meta/src/reference/java/Digit.java
trackler-2.2.1.179 tracks/java/exercises/ocr-numbers/.meta/src/reference/java/Digit.java
trackler-2.2.1.178 tracks/java/exercises/ocr-numbers/.meta/src/reference/java/Digit.java
trackler-2.2.1.177 tracks/java/exercises/ocr-numbers/.meta/src/reference/java/Digit.java
trackler-2.2.1.176 tracks/java/exercises/ocr-numbers/.meta/src/reference/java/Digit.java
trackler-2.2.1.175 tracks/java/exercises/ocr-numbers/.meta/src/reference/java/Digit.java
trackler-2.2.1.174 tracks/java/exercises/ocr-numbers/.meta/src/reference/java/Digit.java
trackler-2.2.1.173 tracks/java/exercises/ocr-numbers/.meta/src/reference/java/Digit.java
trackler-2.2.1.172 tracks/java/exercises/ocr-numbers/.meta/src/reference/java/Digit.java
trackler-2.2.1.171 tracks/java/exercises/ocr-numbers/.meta/src/reference/java/Digit.java
trackler-2.2.1.170 tracks/java/exercises/ocr-numbers/.meta/src/reference/java/Digit.java
trackler-2.2.1.169 tracks/java/exercises/ocr-numbers/.meta/src/reference/java/Digit.java
trackler-2.2.1.167 tracks/java/exercises/ocr-numbers/.meta/src/reference/java/Digit.java
trackler-2.2.1.166 tracks/java/exercises/ocr-numbers/.meta/src/reference/java/Digit.java
trackler-2.2.1.165 tracks/java/exercises/ocr-numbers/.meta/src/reference/java/Digit.java
trackler-2.2.1.164 tracks/java/exercises/ocr-numbers/.meta/src/reference/java/Digit.java
trackler-2.2.1.163 tracks/java/exercises/ocr-numbers/.meta/src/reference/java/Digit.java
trackler-2.2.1.162 tracks/java/exercises/ocr-numbers/.meta/src/reference/java/Digit.java
trackler-2.2.1.161 tracks/java/exercises/ocr-numbers/.meta/src/reference/java/Digit.java
trackler-2.2.1.160 tracks/java/exercises/ocr-numbers/.meta/src/reference/java/Digit.java