Clover Coverage Report - FEST Swing 1.2
Coverage timestamp: Tue Jun 1 2010 15:19:25 PDT
../../../../img/srcFileCovDistChart10.png 0% of files have more coverage
22   67   15   3.14
14   37   0.68   7
7     2.14  
1    
2.3% of code in this file is excluded from these metrics.
 
  InputModifiers       Line # 26 22 2.3% 15 0 100% 1.0
 
No Tests
 
1    /*
2    * Created on Jul 19, 2008
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
5    * the License. You may obtain a copy of the License at
6    *
7    * http://www.apache.org/licenses/LICENSE-2.0
8    *
9    * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
10    * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
11    * specific language governing permissions and limitations under the License.
12    *
13    * Copyright @2008-2010 the original author or authors.
14    */
15    package org.fest.swing.core;
16   
17    import static java.awt.event.InputEvent.*;
18   
19    import java.awt.event.InputEvent;
20   
21    /**
22    * Understands input modifiers.
23    *
24    * @author Alex Ruiz
25    */
 
26    final class InputModifiers {
27   
 
28  136 toggle static int unify(int...modifiers) {
29  136 int unified = 0;
30  136 if (modifiers != null && modifiers.length > 0) {
31  134 unified = modifiers[0];
32  22 for(int i = 1; i < modifiers.length; i++) unified |= modifiers[i];
33    }
34  136 return unified;
35    }
36   
 
37  11 toggle static boolean isShiftDown(int modifiers) {
38  11 return (modifiers & SHIFT_MASK) != 0;
39    }
40   
 
41  14 toggle static boolean isControlDown(int modifiers) {
42  14 return (modifiers & CTRL_MASK) != 0;
43    }
44   
 
45  12 toggle static boolean isMetaDown(int modifiers) {
46  12 return (modifiers & META_MASK) != 0;
47    }
48   
 
49  16 toggle static boolean isAltDown(int modifiers) {
50  16 return (modifiers & ALT_MASK) != 0;
51    }
52   
 
53  15 toggle static boolean isAltGraphDown(int modifiers) {
54  15 return (modifiers & ALT_GRAPH_MASK) != 0;
55    }
56   
 
57  12 toggle static boolean modifiersMatch(InputEvent e, int modifiers) {
58  1 if (e.isAltDown() != isAltDown(modifiers)) return false;
59  1 if (e.isAltGraphDown() != isAltGraphDown(modifiers)) return false;
60  2 if (e.isControlDown() != isControlDown(modifiers)) return false;
61  1 if (e.isMetaDown() != isMetaDown(modifiers)) return false;
62  1 if (e.isShiftDown() != isShiftDown(modifiers)) return false;
63  6 return true;
64    }
65   
 
66    toggle private InputModifiers() {}
67    }