001/**
002 * Copyright 2005-2017 The Kuali Foundation
003 *
004 * Licensed under the Educational Community License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.opensource.org/licenses/ecl2.php
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016/*
017 * To change this template, choose Tools | Templates
018 * and open the template in the editor.
019 */
020package org.kuali.rice.krms.impl.repository;
021
022import java.util.Comparator;
023import org.kuali.rice.krms.api.repository.typerelation.TypeTypeRelation;
024
025/**
026 *
027 * @author nwright
028 */
029public class TypeTypeRelationSequenceComparator implements Comparator<TypeTypeRelation> {
030
031    @Override
032    public int compare(TypeTypeRelation o1, TypeTypeRelation o2) {
033        Integer seq1 = o1.getSequenceNumber();
034        if (seq1 == null) {
035            seq1 = 0;
036        }
037        Integer seq2 = o2.getSequenceNumber();
038        if (seq2 == null) {
039            seq2 = 0;
040        }
041        return seq1.compareTo(seq2);
042    }
043}