~ubuntu-branches/ubuntu/wily/opencollada/wily-proposed

« back to all changes in this revision

Viewing changes to xsd2cppsax/src/de/netallied/xsd2cppsax/XSElementComparator.java

  • Committer: Package Import Robot
  • Author(s): Matteo F. Vescovi
  • Date: 2015-05-14 17:23:27 UTC
  • Revision ID: package-import@ubuntu.com-20150514172327-f862u8envms01fra
Tags: upstream-0.1.0~20140703.ddf8f47+dfsg1
ImportĀ upstreamĀ versionĀ 0.1.0~20140703.ddf8f47+dfsg1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/**
 
2
 *   Copyright © 2008-2012 NetAllied Systems GmbH, Ravensburg, Germany. 
 
3
 *       
 
4
 *   Licensed under the MIT Open Source License, 
 
5
 *   for details please see LICENSE file or the website
 
6
 *   http://www.opensource.org/licenses/mit-license.php
 
7
*/
 
8
package de.netallied.xsd2cppsax;
 
9
 
 
10
import java.util.Comparator;
 
11
import java.util.SortedMap;
 
12
 
 
13
import org.apache.xerces.xs.XSElementDeclaration;
 
14
 
 
15
/**
 
16
 * Allows comparison of {@link XSElementDeclaration}s. That way they can be used
 
17
 * as keys in a {@link SortedMap}.
 
18
 * 
 
19
 */
 
20
public class XSElementComparator implements Comparator<XSElementDeclaration> {
 
21
 
 
22
    /**
 
23
     * {@inheritDoc}
 
24
     * 
 
25
     * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
 
26
     */
 
27
    public int compare(XSElementDeclaration o1, XSElementDeclaration o2) {
 
28
        if (o1.equals(o2))
 
29
            return 0;
 
30
 
 
31
        String str01 = o1.toString();
 
32
        String str02 = o2.toString();
 
33
        return str01.compareTo(str02);
 
34
    }
 
35
 
 
36
}