public abstract class PrecisProfile
extends java.lang.Object
implements java.util.Comparator<java.lang.CharSequence>, java.io.Serializable
There are three basic use cases you can do with this class:
PrecisProfiles,
Serialized Form| Modifier | Constructor and Description |
|---|---|
protected |
PrecisProfile(boolean identifierClass) |
| Modifier and Type | Method and Description |
|---|---|
protected abstract java.lang.CharSequence |
applyAdditionalMappingRule(java.lang.CharSequence input)
The additional mapping rule of a profile specifies whether additional
mappings are performed on the characters of a string, such as:
Mapping of delimiter characters (such as '@', ':', '/', '+',
and '-')
Mapping of special characters (e.g., non-ASCII space characters to
ASCII space or control characters to nothing).
|
protected abstract java.lang.CharSequence |
applyCaseMappingRule(java.lang.CharSequence input)
The case mapping rule of a profile specifies whether case mapping
(instead of case preservation) is performed on a string and how the
mapping is applied (e.g., mapping uppercase and titlecase code points
to their lowercase equivalents).
|
protected abstract java.lang.CharSequence |
applyDirectionalityRule(java.lang.CharSequence input)
The directionality rule of a profile specifies how to treat strings
containing what are often called "right-to-left" (RTL) characters
(see Unicode Standard Annex #9 [UAX9]).
|
protected abstract java.lang.CharSequence |
applyNormalizationRule(java.lang.CharSequence input)
The normalization rule of a profile specifies which Unicode
normalization form (D, KD, C, or KC) is to be applied.
|
protected abstract java.lang.CharSequence |
applyWidthMappingRule(java.lang.CharSequence input)
The width mapping rule of a profile specifies whether width mapping
is performed on the characters of a string, and how the mapping is
done.
|
protected static java.lang.CharSequence |
caseMap(java.lang.CharSequence input)
Applies the default case folding to a string.
|
protected static void |
checkBidiRule(java.lang.CharSequence label)
Checks the Bidi Rule.
|
int |
compare(java.lang.CharSequence o1,
java.lang.CharSequence o2)
Compares two strings with each other.
|
java.lang.String |
enforce(java.lang.CharSequence input)
Enforcement entails applying all of the rules specified for a
particular string class or profile thereof to an individual
string, for the purpose of determining if the string can be used
in a given protocol slot.
|
java.lang.String |
prepare(java.lang.CharSequence input)
Preparation entails only ensuring that the characters in an
individual string are allowed by the underlying PRECIS string
class.
|
protected java.lang.String |
stabilize(java.lang.CharSequence input,
java.util.function.Function<java.lang.CharSequence,java.lang.String> rules)
Applying the rules for any given PRECIS profile is not necessarily an idempotent
procedure (e.g., under certain circumstances, such as when Unicode
Normalization Form KC is used, performing Unicode normalization after
case mapping can still yield uppercase characters for certain code
points).
|
java.lang.String |
toComparableString(java.lang.CharSequence input)
Converts a string to a comparable string.
|
protected static java.lang.CharSequence |
widthMap(java.lang.CharSequence input)
Maps full-width and half-width characters to their decomposition mappings.
|
protected PrecisProfile(boolean identifierClass)
identifierClass - True, if the base class for this profile is the "IdentifierClass"; false if it's the "FreeFormClass".protected static java.lang.CharSequence widthMap(java.lang.CharSequence input)
input - The input string.protected static java.lang.CharSequence caseMap(java.lang.CharSequence input)
input - The input string.protected static void checkBidiRule(java.lang.CharSequence label)
label - The label to check.InvalidDirectionalityException - If the label violates the Bidi Rule.public java.lang.String prepare(java.lang.CharSequence input)
input - The input string.InvalidCodePointException - If the input contains invalid code points (which are disallowed by the underlying Precis String class).public java.lang.String enforce(java.lang.CharSequence input)
This base method first applies the profile rules, then the behavioral rules as per RFC 7564 ยง7.
input - The input string.InvalidCodePointException - If the input contains invalid code points (which are disallowed by the underlying Precis String class).public final int compare(java.lang.CharSequence o1,
java.lang.CharSequence o2)
compare in interface java.util.Comparator<java.lang.CharSequence>o1 - The first string.o2 - The second string.InvalidCodePointException - If the input contains invalid code points (which are disallowed by the underlying Precis String class).toComparableString(CharSequence)public java.lang.String toComparableString(java.lang.CharSequence input)
input - The input string.compare(CharSequence, CharSequence)protected abstract java.lang.CharSequence applyWidthMappingRule(java.lang.CharSequence input)
input - The input string.protected abstract java.lang.CharSequence applyAdditionalMappingRule(java.lang.CharSequence input)
Mapping of delimiter characters (such as '@', ':', '/', '+', and '-')
Mapping of special characters (e.g., non-ASCII space characters to ASCII space or control characters to nothing).
input - The input string.protected abstract java.lang.CharSequence applyCaseMappingRule(java.lang.CharSequence input)
If case mapping is desired (instead of case preservation), it is RECOMMENDED to use the Unicode toLowerCase() operation defined in the Unicode Standard [Unicode]. In contrast to the Unicode toCaseFold() operation, the toLowerCase() operation is less likely to violate the "Principle of Least Astonishment", especially when an application merely wishes to convert uppercase and titlecase code points to their lowercase equivalents while preserving lowercase code points.
input - The input string.protected abstract java.lang.CharSequence applyNormalizationRule(java.lang.CharSequence input)
In accordance with [RFC5198], normalization form C (NFC) is RECOMMENDED.
input - The input string.protected abstract java.lang.CharSequence applyDirectionalityRule(java.lang.CharSequence input)
input - The input string.protected final java.lang.String stabilize(java.lang.CharSequence input,
java.util.function.Function<java.lang.CharSequence,java.lang.String> rules)
This method applies the rules once (the first time) and then maximum three additional times.
input - The input string.rules - The function which applies the rules.Copyright © 2015–2019 XMPP.rocks. All rights reserved.