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

import com.capgemini.reports.snecmaobjects.ISnecmaObject;
import com.capgemini.reports.snecmaobjects.part.PartAeroRevision;

/**
 * Compares two {@link PartAeroRevision}'s contents.
 */
public class PartAeroComparator extends PartComparator {
    private static final long serialVersionUID = 5813446144969040585L;

    @Override
    public int compare(final ISnecmaObject thisPart, final ISnecmaObject otherPart) {
        int cmp = super.compare(thisPart, otherPart);
        if (cmp == 0) {
            PartAeroRevision thisPartAero = (PartAeroRevision) thisPart;
            PartAeroRevision otherPartAero = (PartAeroRevision) otherPart;
            cmp = thisPartAero.getTypeAero1().compareTo(otherPartAero.getTypeAero1());
            if (cmp == 0) {
                cmp = thisPartAero.getTypeAero2().compareTo(otherPartAero.getTypeAero2());
                if (cmp == 0) {
                    cmp = thisPartAero.getTypeAero3().compareTo(otherPartAero.getTypeAero3());
                }
            }
        }
        return cmp;
    }
}
