Merge "Package names for enclosed Types of TOs were changed to fully qualified. Fully...
[controller.git] / opendaylight / sal / yang-prototype / yang / yang-model-parser-impl / src / main / java / org / opendaylight / controller / yang / parser / util / Comparators.java
1 /*
2  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
3  *
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
7  */
8 package org.opendaylight.controller.yang.parser.util;
9
10 import java.util.Comparator;
11
12 import org.opendaylight.controller.yang.common.QName;
13 import org.opendaylight.controller.yang.model.api.SchemaNode;
14
15 public class Comparators {
16
17     public static final QNameComparator QNAME_COMP = new QNameComparator();
18     public static final SchemaNodeComparator SCHEMA_NODE_COMP = new SchemaNodeComparator();
19
20     private Comparators() {
21     }
22
23     private static final class QNameComparator implements Comparator<QName> {
24         @Override
25         public int compare(QName o1, QName o2) {
26             return o1.getLocalName().compareTo(o2.getLocalName());
27         }
28     }
29
30     private static final class SchemaNodeComparator implements Comparator<SchemaNode> {
31         @Override
32         public int compare(SchemaNode o1, SchemaNode o2) {
33             return o1.getQName().getLocalName().compareTo(o2.getQName().getLocalName());
34         }
35     }
36
37 }