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

com.ajjpj.afoundation.collection.graph.ASimpleEdge Maven / Gradle / Ivy

There is a newer version: 1.0-pre19
Show newest version
package com.ajjpj.afoundation.collection.graph;

import java.io.Serializable;


/**
 * @author arno
 */
public class ASimpleEdge implements AEdge, Serializable {
    private final N from;
    private final N to;

    public ASimpleEdge (N from, N to) {
        this.from = from;
        this.to = to;
    }

    @Override public N getFrom () {
        return from;
    }
    @Override public N getTo () {
        return to;
    }

    @Override
    public boolean equals (Object o) {
        if (this == o) return true;
        if (o == null || getClass () != o.getClass ()) return false;

        ASimpleEdge that = (ASimpleEdge) o;

        if (from != null ? !from.equals (that.from) : that.from != null) return false;
        if (to != null ? !to.equals (that.to) : that.to != null) return false;

        return true;
    }
    @Override
    public int hashCode () {
        int result = from != null ? from.hashCode () : 0;
        result = 31 * result + (to != null ? to.hashCode () : 0);
        return result;
    }

    @Override public String toString () {
        return "ASimpleEdge{" +
                "from=" + from +
                ", to=" + to +
                '}';
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy