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

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

/**
 * Compares two {@link DETRevision}'s contents.
 */
public class DetComparator extends PartComparator {

    private static final long serialVersionUID = 3412387355420636670L;

    @Override
    public int compare(final ISnecmaObject thisPart, final ISnecmaObject otherPart) {
        int cmp = super.compare(thisPart, otherPart);
        if (cmp != 0) {
            return cmp;
        }
        DETRevision thisDET = (DETRevision) thisPart;
        DETRevision otherDET = (DETRevision) otherPart;
        cmp = thisDET.getTypeDet1().compareTo(otherDET.getTypeDet1());
        if (cmp != 0) {
            return cmp;
        }
        cmp = thisDET.getTypeDet2().compareTo(otherDET.getTypeDet2());
        return cmp;
    }

}
