1 package org.andromda.utils.beans.comparators;
2
3 import java.io.Serializable;
4 import java.util.Comparator;
5
6
7
8
9
10
11
12 class BooleanComparator
13 implements Comparator,
14 Serializable
15 {
16 private static final long serialVersionUID = 34L;
17
18
19
20
21
22
23
24
25 public int compare(
26 Object objectA,
27 Object objectB)
28 {
29 Boolean aAsBoolean = (Boolean)objectA;
30 Boolean bAsBoolean = (Boolean)objectB;
31 int result = 0;
32 if (aAsBoolean.booleanValue() && !bAsBoolean.booleanValue())
33 {
34 result = 1;
35 }
36 else if (!aAsBoolean.booleanValue() && bAsBoolean.booleanValue())
37 {
38 result = -1;
39 }
40 return result;
41 }
42 }