/*
 * Copyright 2009 Lari Natri <lari.natri@gmail.com>
 *
 *  This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 * 
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 * 
 *  You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */


package compid.data.tuples;

import java.util.HashMap;

/**
 *
 * @author Lari Natri
 */
public final class ProtHitPeptHitJoin extends Tuple {
    
    public static final String TABLELABEL = "PROTPEPTHITSJOIN";

    private ProteinHit proteinHit = null;
    private PeptideHit peptideHit = null;
    
    public ProtHitPeptHitJoin(ProteinHit proteinHit, PeptideHit peptideHit) {
        this.proteinHit = proteinHit;
        this.peptideHit = peptideHit;
        if (this.proteinHit==null || this.peptideHit==null)
            throw new NullPointerException("ProteinHit and PeptideHit must be" +
                    "set.");
    }
    
    public ProteinHit getProteinHit() { return this.proteinHit; }
    
    public PeptideHit getPeptideHit() { return this.peptideHit; }
    
    public void setProteinHit(ProteinHit protHit) {
        if (protHit==null) return;
        this.proteinHit = protHit;
    }
    
    public void setPeptideHit(PeptideHit pepHit) {
        if (pepHit==null) return;
        this.peptideHit = pepHit;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final ProtHitPeptHitJoin other = (ProtHitPeptHitJoin) obj;
        if (this.proteinHit != other.proteinHit && (this.proteinHit == null || !this.proteinHit.equals(other.proteinHit))) {
            return false;
        }
        if (this.peptideHit != other.peptideHit && (this.peptideHit == null || !this.peptideHit.equals(other.peptideHit))) {
            return false;
        }
        return true;
    }

    @Override
    public int hashCode() {
        int hash = 3;
        hash = 37 * hash + (this.proteinHit != null ? this.proteinHit.hashCode() : 0);
        hash = 37 * hash + (this.peptideHit != null ? this.peptideHit.hashCode() : 0);
        return hash;
    }
    


    @Override
    public String getTableLabel() {
        return TABLELABEL;
    }

    @Override
    public HashMap<String,Object> getColsAndValues() {
        HashMap<String,Object> map = new HashMap<String,Object>(0);
        return map;
    }    
    
}
