diff options
author | 2013-05-13 00:29:27 -0700 | |
---|---|---|
committer | 2013-05-13 00:29:27 -0700 | |
commit | 6780e43d761b0cbe0ce54cfc017ac779509e1c61 (patch) | |
tree | d2f6c539aef91476a8839f0e5f457e722c0d0db5 /java/src/com/android/inputmethod/latin/ResourceUtils.java | |
parent | 6f6478422f8881e7692c99e3a3925266980099d0 (diff) | |
parent | 18184eacb149f1b12b859ff8631340a9f73bf8ac (diff) | |
download | latinime-6780e43d761b0cbe0ce54cfc017ac779509e1c61.tar.gz latinime-6780e43d761b0cbe0ce54cfc017ac779509e1c61.tar.xz latinime-6780e43d761b0cbe0ce54cfc017ac779509e1c61.zip |
am 18184eac: Support regular expression for condition pattern
* commit '18184eacb149f1b12b859ff8631340a9f73bf8ac':
Support regular expression for condition pattern
Diffstat (limited to 'java/src/com/android/inputmethod/latin/ResourceUtils.java')
-rw-r--r-- | java/src/com/android/inputmethod/latin/ResourceUtils.java | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/java/src/com/android/inputmethod/latin/ResourceUtils.java b/java/src/com/android/inputmethod/latin/ResourceUtils.java index 488a0e313..03b7efba9 100644 --- a/java/src/com/android/inputmethod/latin/ResourceUtils.java +++ b/java/src/com/android/inputmethod/latin/ResourceUtils.java @@ -103,12 +103,12 @@ public final class ResourceUtils { /** * Find the condition that fulfills specified key value pairs from an array of * "condition,constant", and return the corresponding string constant. A condition is - * "pattern1[:pattern2...] (or an empty string for the default). A pattern is "key=value" - * string. The condition matches only if all patterns of the condition are true for the - * specified key value pairs. + * "pattern1[:pattern2...] (or an empty string for the default). A pattern is + * "key=regexp_value" string. The condition matches only if all patterns of the condition + * are true for the specified key value pairs. * * For example, "condition,constant" has the following format. - * (See {@link ResourceUtilsTests#testFindConstantForKeyValuePairsCombined()}) + * (See {@link ResourceUtilsTests#testFindConstantForKeyValuePairsRegexp()}) * - HARDWARE=mako,constantForNexus4 * - MODEL=Nexus 4:MANUFACTURER=LGE,constantForNexus4 * - ,defaultConstant @@ -156,8 +156,8 @@ public final class ResourceUtils { if (value == null) { throw new RuntimeException("Found unknown key: " + condition); } - final String patternValue = pattern.substring(posEqual + 1); - if (!value.equals(patternValue)) { + final String patternRegexpValue = pattern.substring(posEqual + 1); + if (!value.matches(patternRegexpValue)) { return false; } } |