| /******************************************************************************* |
| * Copyright (c) 2018 Agence spatiale canadienne / Canadian Space Agency |
| * All rights reserved. This program and the accompanying materials |
| * are made available under the terms of the Eclipse Public License v1.0 |
| * which accompanies this distribution, and is available at |
| * http://www.eclipse.org/legal/epl-v10.html |
| * |
| * Contributors: |
| * Pierre Allard, |
| * Regent L'Archeveque, |
| * Olivier L. Larouche - initial API and implementation |
| * SPDX-License-Identifier: EPL-1.0 |
| * |
| *******************************************************************************/ |
| package org.eclipse.apogy.common.emf.impl; |
| |
| import org.eclipse.apogy.common.emf.ApogyCommonEMFFacade; |
| import org.eclipse.emf.ecore.EObject; |
| |
| public class EIdComparatorCustomImpl<T extends EObject> extends EIdComparatorImpl<T> { |
| @Override |
| public int compare(EObject o1, EObject o2) { |
| String o1Id = ApogyCommonEMFFacade.INSTANCE.getID(o1); |
| String o2Id = ApogyCommonEMFFacade.INSTANCE.getID(o2); |
| |
| if (o1Id == null) { |
| return -1; |
| } |
| |
| if (o2Id == null) { |
| return 1; |
| } |
| |
| return o1Id.compareTo(o2Id); |
| } |
| } // EIdComparatorImpl |