package com.capgemini.reports.definition.r07report.data.filter.comparators.part;

import com.capgemini.reports.bomlineholder.BOMLineHolder;
import com.capgemini.reports.snecmaobjects.ISnecmaObject;
import com.capgemini.reports.snecmaobjects.part.PartMatRevision;

/**
 * Compares two {@link PartMatRevision}'s {@link BOMLineHolder}s.
 */
public class PartMatComparator extends PartComparator {
    private static final long serialVersionUID = 4148977376229148277L;

    @Override
    public int compare(final ISnecmaObject thisPart, final ISnecmaObject otherPart) {
        int cmp = super.compare(thisPart, otherPart);
        if (cmp != 0) {
            return cmp;
        }
        PartMatRevision thisPartMat = (PartMatRevision) thisPart;
        PartMatRevision otherPartMat = (PartMatRevision) otherPart;
        cmp = thisPartMat.getClassementMat().compareTo(otherPartMat.getClassementMat());
        return cmp;
    }

}
