summaryrefslogtreecommitdiff
path: root/java/src/com/android/inputmethod/keyboard/internal/KeysCache.java
diff options
context:
space:
mode:
authorTadashi G. Takaoka <takaoka@google.com>2014-11-27 15:40:35 +0900
committerTadashi G. Takaoka <takaoka@google.com>2014-11-27 15:44:22 +0900
commit01d54002b3b2fdd8a63b652eecf9ef31988a0bf2 (patch)
tree153efd36feeb97954962f736c25e074ca2dafdf8 /java/src/com/android/inputmethod/keyboard/internal/KeysCache.java
parent9d5d01a54319797db17fa8ac4b612f8836c83b9a (diff)
Refactor KeysCache to UniqueKeysCache
Change-Id: I8e3c4705c705a1c6e05e9112211d7012912d7e41
Diffstat (limited to 'java/src/com/android/inputmethod/keyboard/internal/KeysCache.java')
-rw-r--r--java/src/com/android/inputmethod/keyboard/internal/KeysCache.java50
1 files changed, 0 insertions, 50 deletions
diff --git a/java/src/com/android/inputmethod/keyboard/internal/KeysCache.java b/java/src/com/android/inputmethod/keyboard/internal/KeysCache.java
deleted file mode 100644
index 6ad450c29..000000000
--- a/java/src/com/android/inputmethod/keyboard/internal/KeysCache.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.inputmethod.keyboard.internal;
-
-import com.android.inputmethod.keyboard.Key;
-
-import java.util.HashMap;
-
-// TODO: Rename more appropriate name.
-public final class KeysCache {
- private final HashMap<Key, Key> mMap = new HashMap<>();
-
- public void clear() {
- mMap.clear();
- }
-
- // TODO: Rename more descriptive name.
- public Key get(final Key key) {
- final Key existingKey = mMap.get(key);
- if (existingKey != null) {
- // Reuse the existing element that equals to "key" without adding "key" to the map.
- return existingKey;
- }
- mMap.put(key, key);
- return key;
- }
-
- // TODO: Rename more descriptive name.
- public Key replace(final Key oldKey, final Key newKey) {
- if (oldKey.equals(newKey)) {
- return oldKey;
- }
- mMap.remove(oldKey);
- return get(newKey);
- }
-}