All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.simpleflatmapper.converter.ConvertingScore Maven / Gradle / Ivy

Go to download

Java library to map flat record - ResultSet, csv - to java object with minimum configuration and low footprint.

There is a newer version: 9.0.2
Show newest version
package org.simpleflatmapper.converter;

public class ConvertingScore {
    public static final int MAX_SCORE = 256;
    public static final ConvertingScore NO_MATCH = new ConvertingScore(-1, -1);

    private final int fromScore;
    private final int toScore;

    public ConvertingScore(int fromScore, int toScore) {
        this.fromScore = fromScore;
        this.toScore = toScore;
    }

    public int getScore() {
        if (toScore == -1) return -1;

        // score on source
        if (fromScore == -1) return -1;

        return toScore * MAX_SCORE  + fromScore;
    }

    public int getFromScore() {
        return fromScore;
    }

    public int getToScore() {
        return toScore;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy