2 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.yangtools.yang.parser.util;
10 import java.util.Comparator;
12 import org.opendaylight.yangtools.yang.common.QName;
13 import org.opendaylight.yangtools.yang.model.api.SchemaNode;
15 public final class Comparators {
17 public static final QNameComparator QNAME_COMP = new QNameComparator();
18 public static final SchemaNodeComparator SCHEMA_NODE_COMP = new SchemaNodeComparator();
20 private Comparators() {
23 private static final class QNameComparator implements Comparator<QName> {
25 public int compare(QName o1, QName o2) {
26 return o1.getLocalName().compareTo(o2.getLocalName());
30 private static final class SchemaNodeComparator implements Comparator<SchemaNode> {
32 public int compare(SchemaNode o1, SchemaNode o2) {
33 return o1.getQName().getLocalName().compareTo(o2.getQName().getLocalName());