-
Notifications
You must be signed in to change notification settings - Fork 388
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CLDR-17561 Utility for visiting DtdData elements (#3646)
- Loading branch information
Showing
4 changed files
with
158 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
tools/cldr-code/src/main/java/com/ibm/icu/util/MatchElementAttribute.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package com.ibm.icu.util; | ||
|
||
import com.google.common.collect.HashMultimap; | ||
import com.google.common.collect.Multimap; | ||
|
||
public class MatchElementAttribute { | ||
private Multimap<String, String> matchElementAttribute = | ||
HashMultimap.create(); // "" is a wildcard | ||
|
||
public MatchElementAttribute add(String... elementAttributePairs) { | ||
for (int i = 0; i < elementAttributePairs.length; i += 2) { | ||
matchElementAttribute.put(elementAttributePairs[i], elementAttributePairs[i + 1]); | ||
} | ||
return this; | ||
} | ||
|
||
public boolean matches(String element, String attribute) { | ||
return matchElementAttribute.containsEntry(element, attribute) | ||
|| matchElementAttribute.containsEntry("", attribute) | ||
|| matchElementAttribute.containsEntry(element, ""); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters