~ubuntu-branches/ubuntu/utopic/libjaudiotagger-java/utopic

« back to all changes in this revision

Viewing changes to srctest/org/jaudiotagger/audio/asf/data/MetadataDescriptorComparator.java

  • Committer: Bazaar Package Importer
  • Author(s): Damien Raude-Morvan
  • Date: 2011-04-28 23:52:43 UTC
  • mfrom: (3.1.4 sid)
  • Revision ID: james.westby@ubuntu.com-20110428235243-pzalvw6lncis3ukf
Tags: 2.0.3-1
* d/control: Drop Depends on default-jre per Debian Java Policy as its
  a library package.
* d/watch: Fix to directly monitor SVN tags.
* Switch to 3.0 (quilt) format.
* Bump Standards-Version to 3.9.2 (no changes needed).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
package org.jaudiotagger.audio.asf.data;
2
 
 
3
 
import java.io.Serializable;
4
 
import java.util.Comparator;
5
 
 
6
 
/**
7
 
 * @author Christian Laireiter
8
 
 * 
9
 
 */
10
 
public class MetadataDescriptorComparator implements
11
 
        Comparator<MetadataDescriptor>, Serializable {
12
 
 
13
 
    /**
14
 
     * 
15
 
     */
16
 
    private static final long serialVersionUID = 4503738612948660496L;
17
 
 
18
 
    /**
19
 
     * {@inheritDoc}
20
 
     */
21
 
    public int compare(MetadataDescriptor o1, MetadataDescriptor o2) {
22
 
        assert o1 != o2;
23
 
        assert o1 != null && o2 != null;
24
 
        int result = o1.getContainerType().ordinal()
25
 
                - o2.getContainerType().ordinal();
26
 
        result = 0;
27
 
        if (result == 0) {
28
 
            result = o1.getName().compareTo(o2.getName());
29
 
        }
30
 
        if (result == 0) {
31
 
            result = o1.getType() - o2.getType();
32
 
        }
33
 
        if (result == 0) {
34
 
            result = o1.getLanguageIndex() - o2.getLanguageIndex();
35
 
        }
36
 
        if (result == 0) {
37
 
            result = o1.getStreamNumber() - o2.getStreamNumber();
38
 
        }
39
 
        return result;
40
 
    }
41
 
 
42
 
}
 
1
package org.jaudiotagger.audio.asf.data;
 
2
 
 
3
import java.io.Serializable;
 
4
import java.util.Comparator;
 
5
 
 
6
/**
 
7
 * @author Christian Laireiter
 
8
 * 
 
9
 */
 
10
public class MetadataDescriptorComparator implements
 
11
        Comparator<MetadataDescriptor>, Serializable {
 
12
 
 
13
    /**
 
14
     * 
 
15
     */
 
16
    private static final long serialVersionUID = 4503738612948660496L;
 
17
 
 
18
    /**
 
19
     * {@inheritDoc}
 
20
     */
 
21
    public int compare(MetadataDescriptor o1, MetadataDescriptor o2) {
 
22
        assert o1 != o2;
 
23
        assert o1 != null && o2 != null;
 
24
        int result = o1.getContainerType().ordinal()
 
25
                - o2.getContainerType().ordinal();
 
26
        result = 0;
 
27
        if (result == 0) {
 
28
            result = o1.getName().compareTo(o2.getName());
 
29
        }
 
30
        if (result == 0) {
 
31
            result = o1.getType() - o2.getType();
 
32
        }
 
33
        if (result == 0) {
 
34
            result = o1.getLanguageIndex() - o2.getLanguageIndex();
 
35
        }
 
36
        if (result == 0) {
 
37
            result = o1.getStreamNumber() - o2.getStreamNumber();
 
38
        }
 
39
        return result;
 
40
    }
 
41
 
 
42
}