blob: 77ee64d74b71ba3b8ab1cf06277ae909eb9a8747 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
package juloo.keyboard2;
import java.lang.reflect.Array;
import java.util.Map;
import java.util.TreeMap;
/** Stores key combinations that are applied by [KeyModifier]. */
public final class Modmap
{
public enum M { Shift, Fn, Ctrl }
Map<KeyValue, KeyValue>[] _map;
public Modmap()
{
_map = (Map<KeyValue, KeyValue>[])Array.newInstance(TreeMap.class,
M.values().length);
}
public void add(M m, KeyValue a, KeyValue b)
{
int i = m.ordinal();
if (_map[i] == null)
_map[i] = new TreeMap<KeyValue, KeyValue>();
_map[i].put(a, b);
}
public KeyValue get(M m, KeyValue a)
{
Map<KeyValue, KeyValue> mm = _map[m.ordinal()];
return (mm == null) ? null : mm.get(a);
}
}
|