Java Code Examples for com.ibm.icu.text.UnicodeSet#isEmpty()
The following examples show how to use
com.ibm.icu.text.UnicodeSet#isEmpty() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CollationDataBuilder.java From fitnotifications with Apache License 2.0 | 6 votes |
void suppressContractions(UnicodeSet set) { if(set.isEmpty()) { return; } UnicodeSetIterator iter = new UnicodeSetIterator(set); while(iter.next() && iter.codepoint != UnicodeSetIterator.IS_STRING) { int c = iter.codepoint; int ce32 = trie.get(c); if(ce32 == Collation.FALLBACK_CE32) { ce32 = base.getFinalCE32(base.getCE32(c)); if(Collation.ce32HasContext(ce32)) { ce32 = copyFromBaseCE32(c, ce32, false /* without context */); trie.set(c, ce32); } } else if(isBuilderContextCE32(ce32)) { ce32 = getConditionalCE32ForCE32(ce32).ce32; // Simply abandon the list of ConditionalCE32. // The caller will copy this builder in the end, // eliminating unreachable data. trie.set(c, ce32); contextChars.remove(c); } } modified = true; }
Example 2
Source File: ICUTransformFilter.java From lucene-solr with Apache License 2.0 | 6 votes |
/** * Create a new ICUTransformFilter that transforms text on the given stream. * * @param input {@link TokenStream} to filter. * @param transform Transliterator to transform the text. */ @SuppressWarnings("deprecation") public ICUTransformFilter(TokenStream input, Transliterator transform) { super(input); this.transform = transform; /* * This is cheating, but speeds things up a lot. * If we wanted to use pkg-private APIs we could probably do better. */ if (transform.getFilter() == null && transform instanceof com.ibm.icu.text.RuleBasedTransliterator) { final UnicodeSet sourceSet = transform.getSourceSet(); if (sourceSet != null && !sourceSet.isEmpty()) transform.setFilter(sourceSet); } }
Example 3
Source File: ICUFoldingFilterFactory.java From lucene-solr with Apache License 2.0 | 6 votes |
/** Creates a new ICUFoldingFilterFactory */ public ICUFoldingFilterFactory(Map<String,String> args) { super(args); Normalizer2 normalizer = ICUFoldingFilter.NORMALIZER; String filter = get(args, "filter"); if (filter != null) { UnicodeSet set = new UnicodeSet(filter); if (!set.isEmpty()) { set.freeze(); normalizer = new FilteredNormalizer2(normalizer, set); } } if (!args.isEmpty()) { throw new IllegalArgumentException("Unknown parameters: " + args); } this.normalizer = normalizer; }
Example 4
Source File: ICUNormalizer2CharFilterFactory.java From lucene-solr with Apache License 2.0 | 6 votes |
/** Creates a new ICUNormalizer2CharFilterFactory */ public ICUNormalizer2CharFilterFactory(Map<String,String> args) { super(args); String form = get(args, "form", "nfkc_cf"); String mode = get(args, "mode", Arrays.asList("compose", "decompose"), "compose"); Normalizer2 normalizer = Normalizer2.getInstance (null, form, "compose".equals(mode) ? Normalizer2.Mode.COMPOSE : Normalizer2.Mode.DECOMPOSE); String filter = get(args, "filter"); if (filter != null) { UnicodeSet set = new UnicodeSet(filter); if (!set.isEmpty()) { set.freeze(); normalizer = new FilteredNormalizer2(normalizer, set); } } if (!args.isEmpty()) { throw new IllegalArgumentException("Unknown parameters: " + args); } this.normalizer = normalizer; }
Example 5
Source File: ICUNormalizer2FilterFactory.java From lucene-solr with Apache License 2.0 | 6 votes |
/** Creates a new ICUNormalizer2FilterFactory */ public ICUNormalizer2FilterFactory(Map<String,String> args) { super(args); String form = get(args, "form", "nfkc_cf"); String mode = get(args, "mode", Arrays.asList("compose", "decompose"), "compose"); Normalizer2 normalizer = Normalizer2.getInstance (null, form, "compose".equals(mode) ? Normalizer2.Mode.COMPOSE : Normalizer2.Mode.DECOMPOSE); String filter = get(args, "filter"); if (filter != null) { UnicodeSet set = new UnicodeSet(filter); if (!set.isEmpty()) { set.freeze(); normalizer = new FilteredNormalizer2(normalizer, set); } } if (!args.isEmpty()) { throw new IllegalArgumentException("Unknown parameters: " + args); } this.normalizer = normalizer; }
Example 6
Source File: CollationDataBuilder.java From fitnotifications with Apache License 2.0 | 5 votes |
void optimize(UnicodeSet set) { if(set.isEmpty()) { return; } UnicodeSetIterator iter = new UnicodeSetIterator(set); while(iter.next() && iter.codepoint != UnicodeSetIterator.IS_STRING) { int c = iter.codepoint; int ce32 = trie.get(c); if(ce32 == Collation.FALLBACK_CE32) { ce32 = base.getFinalCE32(base.getCE32(c)); ce32 = copyFromBaseCE32(c, ce32, true); trie.set(c, ce32); } } modified = true; }