EMlab-generation Documentation
1.0
Documentation of the EMLab-Generation model.
Main Page
Classes
Files
File List
emlab-generation
src
main
java
emlab
gen
util
MapValueComparator.java
1
/*******************************************************************************
2
* Copyright 2012 the original author or authors.
3
*
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
* you may not use this file except in compliance with the License.
6
* You may obtain a copy of the License at
7
*
8
* http://www.apache.org/licenses/LICENSE-2.0
9
*
10
* Unless required by applicable law or agreed to in writing, software
11
* distributed under the License is distributed on an "AS IS" BASIS,
12
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
* See the License for the specific language governing permissions and
14
* limitations under the License.
15
******************************************************************************/
16
package
emlab.gen.util;
17
18
import
java.util.Comparator;
19
import
java.util.Map;
20
21
public
class
MapValueComparator
implements
Comparator<Object> {
22
23
Map<?, ?> base;
24
25
public
MapValueComparator
(Map<?, ?> base) {
26
this.base = base;
27
}
28
29
public
int
compare(Object a, Object b) {
30
31
if
(((Double) base.get(a)).doubleValue() > ((Double) base.get(b)).doubleValue()) {
32
return
1;
33
}
else
if
(((Double) base.get(a)).doubleValue() == ((Double) base.get(b)).doubleValue()) {
34
return
1;
35
}
else
{
36
return
-1;
37
}
38
}
39
}
emlab.gen.util.MapValueComparator
Definition:
MapValueComparator.java:21
Generated on Thu Feb 19 2015 13:10:29 for EMlab-generation Documentation by
1.8.6