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

date.iterator.count.util.Distance Maven / Gradle / Ivy

There is a newer version: 1.1.5
Show newest version
package date.iterator.count.util;

import java.util.HashMap;
import java.util.Map;

public class Distance {
    private int[] keys;
    private double value;
    private final Map keyIndexes = new HashMap<>();

    public Distance(int[] keys, double value) {
        this.keys = keys;
        this.value = value;
    }

    public int[] getKeys() {
        return keys;
    }

    public double getValue() {
        return value;
    }

    public void setKeys(final int key1, final int key2) {
        keys[0] = key1;
        keys[1] = key2;
    }

    public int getAnotherKey(final int key1) {
        if (keys[0] == key1) {
            return keys[1];
        } else if (keys[1] == key1) {
            return keys[0];
        } else {
            return -1;
        }
    }

    public void setValue(double value) {
        this.value = value;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy