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.StandardRevision;

/**
 * Compares two {@link StandardRevision}'s {@link BOMLineHolder}s.
 */
public class StandardComparator extends PartComparator {
    private static final long serialVersionUID = -3007235542630939436L;

    @Override
    public int compare(final ISnecmaObject thisPart, final ISnecmaObject otherPart) {
        int cmp = super.compare(thisPart, otherPart);
        if (cmp != 0) {
            return cmp;
        }
        StandardRevision thisStandard = (StandardRevision) thisPart;
        StandardRevision otherStandard = (StandardRevision) otherPart;
        cmp = thisStandard.getTypeStandard().compareTo(otherStandard.getTypeStandard());
        return cmp;
    }
}
