Search in sources :

Example 11 with CollationSettings

use of android.icu.impl.coll.CollationSettings in project j2objc by google.

the class RuleBasedCollator method setCaseLevel.

/**
 * <p>
 * When case level is set to true, an additional weight is formed between the SECONDARY and TERTIARY weight, known
 * as the case level. The case level is used to distinguish large and small Japanese Kana characters. Case level
 * could also be used in other situations. For example to distinguish certain Pinyin characters. The default value
 * is false, which means the case level is not generated. The contents of the case level are affected by the case
 * first mode. A simple way to ignore accent differences in a string is to set the strength to PRIMARY and enable
 * case level.
 * <p>
 * See the section on <a href="http://userguide.icu-project.org/collation/architecture">case
 * level</a> for more information.
 *
 * @param flag
 *            true if case level sorting is required, false otherwise
 * @see #setCaseLevelDefault
 * @see #isCaseLevel
 */
public void setCaseLevel(boolean flag) {
    checkNotFrozen();
    if (flag == isCaseLevel()) {
        return;
    }
    CollationSettings ownedSettings = getOwnedSettings();
    ownedSettings.setFlag(CollationSettings.CASE_LEVEL, flag);
    setFastLatinOptions(ownedSettings);
}
Also used : CollationSettings(android.icu.impl.coll.CollationSettings)

Example 12 with CollationSettings

use of android.icu.impl.coll.CollationSettings in project j2objc by google.

the class RuleBasedCollator method setDecompositionDefault.

/**
 * Sets the decomposition mode to the initial mode set during construction of the RuleBasedCollator. See
 * setDecomposition(int) for more details.
 *
 * @see #getDecomposition
 * @see #setDecomposition(int)
 */
public void setDecompositionDefault() {
    checkNotFrozen();
    CollationSettings defaultSettings = getDefaultSettings();
    if (settings.readOnly() == defaultSettings) {
        return;
    }
    CollationSettings ownedSettings = getOwnedSettings();
    ownedSettings.setFlagDefault(CollationSettings.CHECK_FCD, defaultSettings.options);
    setFastLatinOptions(ownedSettings);
}
Also used : CollationSettings(android.icu.impl.coll.CollationSettings)

Example 13 with CollationSettings

use of android.icu.impl.coll.CollationSettings in project j2objc by google.

the class RuleBasedCollator method setFrenchCollationDefault.

/**
 * Sets the French collation mode to the initial mode set during construction of the RuleBasedCollator. See
 * setFrenchCollation(boolean) for more details.
 *
 * @see #isFrenchCollation
 * @see #setFrenchCollation(boolean)
 */
public void setFrenchCollationDefault() {
    checkNotFrozen();
    CollationSettings defaultSettings = getDefaultSettings();
    if (settings.readOnly() == defaultSettings) {
        return;
    }
    CollationSettings ownedSettings = getOwnedSettings();
    ownedSettings.setFlagDefault(CollationSettings.BACKWARD_SECONDARY, defaultSettings.options);
    setFastLatinOptions(ownedSettings);
}
Also used : CollationSettings(android.icu.impl.coll.CollationSettings)

Example 14 with CollationSettings

use of android.icu.impl.coll.CollationSettings in project j2objc by google.

the class RuleBasedCollator method setCaseLevelDefault.

/**
 * Sets the case level mode to the initial mode set during construction of the RuleBasedCollator. See
 * setCaseLevel(boolean) for more details.
 *
 * @see #setCaseLevel(boolean)
 * @see #isCaseLevel
 */
public void setCaseLevelDefault() {
    checkNotFrozen();
    CollationSettings defaultSettings = getDefaultSettings();
    if (settings.readOnly() == defaultSettings) {
        return;
    }
    CollationSettings ownedSettings = getOwnedSettings();
    ownedSettings.setFlagDefault(CollationSettings.CASE_LEVEL, defaultSettings.options);
    setFastLatinOptions(ownedSettings);
}
Also used : CollationSettings(android.icu.impl.coll.CollationSettings)

Example 15 with CollationSettings

use of android.icu.impl.coll.CollationSettings in project j2objc by google.

the class RuleBasedCollator method setReorderCodes.

/**
 * {@inheritDoc}
 *
 * @param order the reordering codes to apply to this collator; if this is null or an empty array
 * then this clears any existing reordering
 * @throws IllegalArgumentException if the reordering codes are malformed in any way (e.g. duplicates, multiple reset codes, overlapping equivalent scripts)
 * @see #getReorderCodes
 * @see Collator#getEquivalentReorderCodes
 * @see Collator.ReorderCodes
 * @see UScript
 */
@Override
public void setReorderCodes(int... order) {
    checkNotFrozen();
    int length = (order != null) ? order.length : 0;
    if (length == 1 && order[0] == ReorderCodes.NONE) {
        length = 0;
    }
    if (length == 0 ? settings.readOnly().reorderCodes.length == 0 : Arrays.equals(order, settings.readOnly().reorderCodes)) {
        return;
    }
    CollationSettings defaultSettings = getDefaultSettings();
    if (length == 1 && order[0] == Collator.ReorderCodes.DEFAULT) {
        if (settings.readOnly() != defaultSettings) {
            CollationSettings ownedSettings = getOwnedSettings();
            ownedSettings.copyReorderingFrom(defaultSettings);
            setFastLatinOptions(ownedSettings);
        }
        return;
    }
    CollationSettings ownedSettings = getOwnedSettings();
    if (length == 0) {
        ownedSettings.resetReordering();
    } else {
        ownedSettings.setReordering(data, order.clone());
    }
    setFastLatinOptions(ownedSettings);
}
Also used : CollationSettings(android.icu.impl.coll.CollationSettings)

Aggregations

CollationSettings (android.icu.impl.coll.CollationSettings)19 Normalizer2Impl (android.icu.impl.Normalizer2Impl)1