view flys-backend/src/main/java/de/intevation/flys/importer/WstColumnValueKey.java @ 493:b35c5dc0f8b7

Importer: Make import of historical discharge tables work. flys-backend/trunk@1842 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Fri, 06 May 2011 10:27:32 +0000
parents db430bd9e0e0
children
line wrap: on
line source
package de.intevation.flys.importer;

import de.intevation.flys.model.WstColumnValue;


public class WstColumnValueKey {

    protected int    wstColumnId;
    protected double position;
    protected double w;


    public WstColumnValueKey(WstColumnValue value) {
        this.wstColumnId = value.getWstColumn().getId();
        this.position    = value.getPosition().doubleValue();
        this.w           = value.getW().doubleValue();
    }


    public WstColumnValueKey(int wstColumnId, double position, double w) {
        this.wstColumnId = wstColumnId;
        this.position    = position;
        this.w           = w;
    }


    public int hashCode() {
        int a = new Integer(wstColumnId).hashCode();
        int b = new Double(position).hashCode();
        int c = new Double(w).hashCode();

        return (a ^ (b << 3) ^ (c << 6));
    }


    public boolean equals(Object obj) {
        if (!(obj instanceof WstColumnValueKey)) {
            return false;
        }

        WstColumnValueKey other = (WstColumnValueKey) obj;

        if (this.wstColumnId != other.wstColumnId) {
            return false;
        }
        else if (this.position != other.position) {
            return false;
        }
        else if (this.w != other.w) {
            return false;
        }

        return true;
    }
}
// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org