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
7   54   5   1.4
0   25   0.71   5
5     1  
1    
 
  KeyStrokeMapCollection       Line # 28 7 0% 5 0 100% 1.0
 
No Tests
 
1    /*
2    * Created on May 21, 2009
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
5    * in compliance with 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
10    * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
11    * or implied. See the License for the specific language governing permissions and limitations under
12    * the License.
13    *
14    * Copyright @2009-2010 the original author or authors.
15    */
16    package org.fest.swing.keystroke;
17   
18    import java.util.HashMap;
19    import java.util.Map;
20   
21    import javax.swing.KeyStroke;
22   
23    /**
24    * Understands a mapping between characters and <code>{@link KeyStroke}</code>s.
25    *
26    * @author Alex Ruiz
27    */
 
28    class KeyStrokeMapCollection {
29   
30    private final Map<Character, KeyStroke> charToKeyStroke = new HashMap<Character, KeyStroke>();
31    private final Map<KeyStroke, Character> keyStrokeToChar = new HashMap<KeyStroke, Character>();
32   
 
33  2527 toggle void add(Character character, KeyStroke keyStroke) {
34  2527 charToKeyStroke.put(character, keyStroke);
35  2527 keyStrokeToChar.put(keyStroke, character);
36    }
37   
 
38  29 toggle void clear() {
39  29 charToKeyStroke.clear();
40  29 keyStrokeToChar.clear();
41    }
42   
 
43  4 toggle boolean isEmpty() {
44  4 return charToKeyStroke.isEmpty() && keyStrokeToChar.isEmpty();
45    }
46   
 
47  86 toggle KeyStroke keyStrokeFor(char character) {
48  86 return charToKeyStroke.get(character);
49    }
50   
 
51  1 toggle Character charFor(KeyStroke keyStroke) {
52  1 return keyStrokeToChar.get(keyStroke);
53    }
54    }