/*******************************************************************************
 * Copyright (c) 2009 ,2018 STMicroelectronics and others.
 * 
 * This program and the accompanying materials are made
 * available under the terms of the Eclipse Public License 2.0
 * which is available at https://www.eclipse.org/legal/epl-2.0/
 *
 * SPDX-License-Identifier: EPL-2.0
 *
 * Contributors:
 *    Xavier Raynaud <xavier.raynaud@st.com> - initial API and implementation
 *******************************************************************************/
package org.eclipse.linuxtools.internal.gcov.view.annotatedsource;

import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.IPath;
import org.eclipse.linuxtools.binutils.link2source.STCSourceNotFoundEditorInput;
import org.eclipse.linuxtools.internal.gcov.parser.SourceFile;


public class STAnnotatedSourceNotFoundEditorInput extends STCSourceNotFoundEditorInput {

    private final SourceFile sourceFile;

    public STAnnotatedSourceNotFoundEditorInput(IProject project,
            SourceFile sourceFile,
            IPath sourcePath, int lineNumber) {
        super(project, sourcePath, lineNumber);
        this.sourceFile = sourceFile;
    }

    /**
     * @return the sourceFile
     */
    public SourceFile getSourceFile() {
        return sourceFile;
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = super.hashCode();
        result = prime * result
                + ((sourceFile == null) ? 0 : sourceFile.hashCode());
        return result;
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (!super.equals(obj))
            return false;
        if (getClass() != obj.getClass())
            return false;
        final STAnnotatedSourceNotFoundEditorInput other = (STAnnotatedSourceNotFoundEditorInput) obj;
        if (sourceFile == null) {
            if (other.sourceFile != null) {
                return false;
            }
        } else if (!sourceFile.equals(other.sourceFile))
            return false;
        return true;
    }

}
