EMMA Coverage Report (generated Wed Jun 27 17:43:42 CEST 2012)
[all classes][aarddict]

COVERAGE SUMMARY FOR SOURCE FILE [PreferredDictionaryComparator.java]

nameclass, %method, %block, %line, %
PreferredDictionaryComparator.java100% (1/1)50%  (1/2)13%  (6/45)23%  (3/13)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class PreferredDictionaryComparator100% (1/1)50%  (1/2)13%  (6/45)23%  (3/13)
compare (Volume, Volume): int 0%   (0/1)0%   (0/39)0%   (0/10)
PreferredDictionaryComparator (UUID): void 100% (1/1)100% (6/6)100% (3/3)

1/* This file is part of Aard Dictionary for Android <http://aarddict.org>.
2 * 
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 3
5 * as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10 * GNU General Public License <http://www.gnu.org/licenses/gpl-3.0.txt>
11 * for more details.
12 * 
13 * Copyright (C) 2010 Igor Tkach
14*/
15 
16package aarddict;
17 
18import java.util.Comparator;
19import java.util.UUID;
20 
21final class PreferredDictionaryComparator implements Comparator<Volume> {
22        
23        private final UUID preferred;
24        
25        PreferredDictionaryComparator(UUID preferred) {
26                this.preferred = preferred;
27        }
28        
29        public int compare(Volume d1, Volume d2) {
30                UUID id1 = d1.getDictionaryId();
31                UUID id2 = d2.getDictionaryId();
32                if (id1.equals(id2)) {
33                        if (id1.equals(preferred)) {
34                                return d1.header.volume - d2.header.volume; 
35                        }
36                }
37                else if (id1.equals(preferred)) {
38                        return -1;
39                }
40                if (id2.equals(preferred)) {
41                        return 1;
42                }                                                
43                return 0;
44        }            
45}

[all classes][aarddict]
EMMA 0.0.0 (unsupported private build) (C) Vladimir Roubtsov