/// <summary> /// Implements the "Before_Dot" condition /// /// Specification: C is followed by <code>U+0307 COMBINING DOT ABOVE</code>. /// Any sequence of characters with a combining class that is /// neither 0 nor 230 may intervene between the current character /// and the combining dot above. /// /// Regular Expression: /// After C: ([{cc!=230}&{cc!=0}])*[\u0307] /// </summary> private static bool IsBeforeDot(String src, int index) { int ch; int cc; int len = src.Length(); // Look for a following COMBINING DOT ABOVE for (int i = index + Character.CharCount(src.CodePointAt(index)); i < len; i += Character.CharCount(ch)) { ch = src.CodePointAt(i); if (ch == '\u0307') { return(true); } else { cc = Normalizer.getCombiningClass(ch); if ((cc == 0) || (cc == COMBINING_CLASS_ABOVE)) { return(false); } } } return(false); }
/// <summary> /// Implements the "After_Soft_Dotted" condition /// /// Specification: The last preceding character with combining class /// of zero before C was Soft_Dotted, and there is no intervening /// combining character class 230 (ABOVE). /// /// Regular Expression: /// Before C: [{Soft_Dotted==true}]([{cc!=230}&{cc!=0}])* /// </summary> private static bool IsAfterSoftDotted(String src, int index) { int ch; int cc; // Look for the last preceding character for (int i = index; i > 0; i -= Character.CharCount(ch)) { ch = src.CodePointBefore(i); if (IsSoftDotted(ch)) { return(true); } else { cc = Normalizer.getCombiningClass(ch); if ((cc == 0) || (cc == COMBINING_CLASS_ABOVE)) { return(false); } } } return(false); }
/// <summary> /// Implements the "Final_Cased" condition /// /// Specification: Within the closest word boundaries containing C, there is a cased /// letter before C, and there is no cased letter after C. /// /// Regular Expression: /// Before C: [{cased==true}][{wordBoundary!=true}]* /// After C: !([{wordBoundary!=true}]*[{cased}]) /// </summary> private static bool IsFinalCased(String src, int index, Locale locale) { BreakIterator wordBoundary = BreakIterator.GetWordInstance(locale); wordBoundary.SetText(src); int ch; // Look for a preceding 'cased' letter for (int i = index; (i >= 0) && !wordBoundary.IsBoundary(i); i -= Character.CharCount(ch)) { ch = src.CodePointBefore(i); if (IsCased(ch)) { int len = src.Length(); // Check that there is no 'cased' letter after the index for (i = index + Character.CharCount(src.CodePointAt(index)); (i < len) && !wordBoundary.IsBoundary(i); i += Character.CharCount(ch)) { ch = src.CodePointAt(i); if (IsCased(ch)) { return(false); } } return(true); } } return(false); }
/// <summary> /// Implements the "More_Above" condition /// /// Specification: C is followed by one or more characters of combining /// class 230 (ABOVE) in the combining character sequence. /// /// Regular Expression: /// After C: [{cc!=0}]*[{cc==230}] /// </summary> private static bool IsMoreAbove(String src, int index) { int ch; int cc; int len = src.Length(); // Look for a following ABOVE combining class character for (int i = index + Character.CharCount(src.CodePointAt(index)); i < len; i += Character.CharCount(ch)) { ch = src.CodePointAt(i); cc = Normalizer.getCombiningClass(ch); if (cc == COMBINING_CLASS_ABOVE) { return(true); } else if (cc == 0) { return(false); } } return(false); }