Java Code Examples for java.text.Collator#SECONDARY
The following examples show how to use
java.text.Collator#SECONDARY .
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: StringComparable.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
public int compareTo(Object o) { final String pattern = ((StringComparable)o).toString(); if(m_text.equals(pattern)){//Code-point equals return 0; } final int savedStrength = m_collator.getStrength(); int comp = 0; // Is there difference more significant than case-order? if(((savedStrength == Collator.PRIMARY) || (savedStrength == Collator.SECONDARY))){ comp = m_collator.compare(m_text, pattern ); }else{// more than SECONDARY m_collator.setStrength(Collator.SECONDARY); comp = m_collator.compare(m_text, pattern ); m_collator.setStrength(savedStrength); } if(comp != 0){//Difference more significant than case-order return comp ; } // No difference more significant than case-order. // Find case difference comp = getCaseDiff(m_text, pattern); if(comp != 0){ return comp; }else{// No case differences. Less significant difference could exist return m_collator.compare(m_text, pattern ); } }
Example 2
Source File: StringComparable.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
public int compareTo(Object o) { final String pattern = ((StringComparable)o).toString(); if(m_text.equals(pattern)){//Code-point equals return 0; } final int savedStrength = m_collator.getStrength(); int comp = 0; // Is there difference more significant than case-order? if(((savedStrength == Collator.PRIMARY) || (savedStrength == Collator.SECONDARY))){ comp = m_collator.compare(m_text, pattern ); }else{// more than SECONDARY m_collator.setStrength(Collator.SECONDARY); comp = m_collator.compare(m_text, pattern ); m_collator.setStrength(savedStrength); } if(comp != 0){//Difference more significant than case-order return comp ; } // No difference more significant than case-order. // Find case difference comp = getCaseDiff(m_text, pattern); if(comp != 0){ return comp; }else{// No case differences. Less significant difference could exist return m_collator.compare(m_text, pattern ); } }
Example 3
Source File: StringComparable.java From hottub with GNU General Public License v2.0 | 5 votes |
private static final int getMask(final int strength) { switch (strength) { case Collator.PRIMARY: return 0xFFFF0000; case Collator.SECONDARY: return 0xFFFFFF00; default: return 0xFFFFFFFF; } }
Example 4
Source File: JavaCollation.java From calcite with Apache License 2.0 | 5 votes |
private static String getStrengthString(int strengthValue) { switch (strengthValue) { case Collator.PRIMARY: return STRENGTH_PRIMARY; case Collator.SECONDARY: return STRENGTH_SECONDARY; case Collator.TERTIARY: return STRENGTH_TERTIARY; case Collator.IDENTICAL: return STRENGTH_IDENTICAL; default: throw new IllegalArgumentException("Incorrect strength value."); } }
Example 5
Source File: StringComparable.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
private static final int getMask(final int strength) { switch (strength) { case Collator.PRIMARY: return 0xFFFF0000; case Collator.SECONDARY: return 0xFFFFFF00; default: return 0xFFFFFFFF; } }
Example 6
Source File: StringComparable.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
public int compareTo(Object o) { final String pattern = ((StringComparable)o).toString(); if(m_text.equals(pattern)){//Code-point equals return 0; } final int savedStrength = m_collator.getStrength(); int comp = 0; // Is there difference more significant than case-order? if(((savedStrength == Collator.PRIMARY) || (savedStrength == Collator.SECONDARY))){ comp = m_collator.compare(m_text, pattern ); }else{// more than SECONDARY m_collator.setStrength(Collator.SECONDARY); comp = m_collator.compare(m_text, pattern ); m_collator.setStrength(savedStrength); } if(comp != 0){//Difference more significant than case-order return comp ; } // No difference more significant than case-order. // Find case difference comp = getCaseDiff(m_text, pattern); if(comp != 0){ return comp; }else{// No case differences. Less significant difference could exist return m_collator.compare(m_text, pattern ); } }
Example 7
Source File: Utils.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
private int compareStrings(boolean caseSensitive, String s1, String s2) { if (caseSensitive) { if (tertiaryCollator == null) { tertiaryCollator = new DocCollator(configuration.locale, Collator.TERTIARY); } return tertiaryCollator.compare(s1, s2); } if (secondaryCollator == null) { secondaryCollator = new DocCollator(configuration.locale, Collator.SECONDARY); } return secondaryCollator.compare(s1, s2); }
Example 8
Source File: StringComparable.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
private static final int getMask(final int strength) { switch (strength) { case Collator.PRIMARY: return 0xFFFF0000; case Collator.SECONDARY: return 0xFFFFFF00; default: return 0xFFFFFFFF; } }
Example 9
Source File: StringComparable.java From Bytecoder with Apache License 2.0 | 5 votes |
public int compareTo(StringComparable o) { final String pattern = o.toString(); if(m_text.equals(pattern)){//Code-point equals return 0; } final int savedStrength = m_collator.getStrength(); int comp = 0; // Is there difference more significant than case-order? if(((savedStrength == Collator.PRIMARY) || (savedStrength == Collator.SECONDARY))){ comp = m_collator.compare(m_text, pattern ); }else{// more than SECONDARY m_collator.setStrength(Collator.SECONDARY); comp = m_collator.compare(m_text, pattern ); m_collator.setStrength(savedStrength); } if(comp != 0){//Difference more significant than case-order return comp ; } // No difference more significant than case-order. // Find case difference comp = getCaseDiff(m_text, pattern); if(comp != 0){ return comp; }else{// No case differences. Less significant difference could exist return m_collator.compare(m_text, pattern ); } }
Example 10
Source File: StringComparable.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
private static final int getMask(final int strength) { switch (strength) { case Collator.PRIMARY: return 0xFFFF0000; case Collator.SECONDARY: return 0xFFFFFF00; default: return 0xFFFFFFFF; } }
Example 11
Source File: StringComparable.java From jdk1.8-source-analysis with Apache License 2.0 | 5 votes |
public int compareTo(Object o) { final String pattern = ((StringComparable)o).toString(); if(m_text.equals(pattern)){//Code-point equals return 0; } final int savedStrength = m_collator.getStrength(); int comp = 0; // Is there difference more significant than case-order? if(((savedStrength == Collator.PRIMARY) || (savedStrength == Collator.SECONDARY))){ comp = m_collator.compare(m_text, pattern ); }else{// more than SECONDARY m_collator.setStrength(Collator.SECONDARY); comp = m_collator.compare(m_text, pattern ); m_collator.setStrength(savedStrength); } if(comp != 0){//Difference more significant than case-order return comp ; } // No difference more significant than case-order. // Find case difference comp = getCaseDiff(m_text, pattern); if(comp != 0){ return comp; }else{// No case differences. Less significant difference could exist return m_collator.compare(m_text, pattern ); } }
Example 12
Source File: StringComparable.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
private static final int getMask(final int strength) { switch (strength) { case Collator.PRIMARY: return 0xFFFF0000; case Collator.SECONDARY: return 0xFFFFFF00; default: return 0xFFFFFFFF; } }
Example 13
Source File: StringComparable.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
public int compareTo(Object o) { final String pattern = ((StringComparable)o).toString(); if(m_text.equals(pattern)){//Code-point equals return 0; } final int savedStrength = m_collator.getStrength(); int comp = 0; // Is there difference more significant than case-order? if(((savedStrength == Collator.PRIMARY) || (savedStrength == Collator.SECONDARY))){ comp = m_collator.compare(m_text, pattern ); }else{// more than SECONDARY m_collator.setStrength(Collator.SECONDARY); comp = m_collator.compare(m_text, pattern ); m_collator.setStrength(savedStrength); } if(comp != 0){//Difference more significant than case-order return comp ; } // No difference more significant than case-order. // Find case difference comp = getCaseDiff(m_text, pattern); if(comp != 0){ return comp; }else{// No case differences. Less significant difference could exist return m_collator.compare(m_text, pattern ); } }
Example 14
Source File: StringComparable.java From JDKSourceCode1.8 with MIT License | 5 votes |
private static final int getMask(final int strength) { switch (strength) { case Collator.PRIMARY: return 0xFFFF0000; case Collator.SECONDARY: return 0xFFFFFF00; default: return 0xFFFFFFFF; } }
Example 15
Source File: StringComparable.java From JDKSourceCode1.8 with MIT License | 5 votes |
public int compareTo(Object o) { final String pattern = ((StringComparable)o).toString(); if(m_text.equals(pattern)){//Code-point equals return 0; } final int savedStrength = m_collator.getStrength(); int comp = 0; // Is there difference more significant than case-order? if(((savedStrength == Collator.PRIMARY) || (savedStrength == Collator.SECONDARY))){ comp = m_collator.compare(m_text, pattern ); }else{// more than SECONDARY m_collator.setStrength(Collator.SECONDARY); comp = m_collator.compare(m_text, pattern ); m_collator.setStrength(savedStrength); } if(comp != 0){//Difference more significant than case-order return comp ; } // No difference more significant than case-order. // Find case difference comp = getCaseDiff(m_text, pattern); if(comp != 0){ return comp; }else{// No case differences. Less significant difference could exist return m_collator.compare(m_text, pattern ); } }
Example 16
Source File: StringComparable.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
public int compareTo(Object o) { final String pattern = ((StringComparable)o).toString(); if(m_text.equals(pattern)){//Code-point equals return 0; } final int savedStrength = m_collator.getStrength(); int comp = 0; // Is there difference more significant than case-order? if(((savedStrength == Collator.PRIMARY) || (savedStrength == Collator.SECONDARY))){ comp = m_collator.compare(m_text, pattern ); }else{// more than SECONDARY m_collator.setStrength(Collator.SECONDARY); comp = m_collator.compare(m_text, pattern ); m_collator.setStrength(savedStrength); } if(comp != 0){//Difference more significant than case-order return comp ; } // No difference more significant than case-order. // Find case difference comp = getCaseDiff(m_text, pattern); if(comp != 0){ return comp; }else{// No case differences. Less significant difference could exist return m_collator.compare(m_text, pattern ); } }
Example 17
Source File: StringComparable.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
public int compareTo(Object o) { final String pattern = ((StringComparable)o).toString(); if(m_text.equals(pattern)){//Code-point equals return 0; } final int savedStrength = m_collator.getStrength(); int comp = 0; // Is there difference more significant than case-order? if(((savedStrength == Collator.PRIMARY) || (savedStrength == Collator.SECONDARY))){ comp = m_collator.compare(m_text, pattern ); }else{// more than SECONDARY m_collator.setStrength(Collator.SECONDARY); comp = m_collator.compare(m_text, pattern ); m_collator.setStrength(savedStrength); } if(comp != 0){//Difference more significant than case-order return comp ; } // No difference more significant than case-order. // Find case difference comp = getCaseDiff(m_text, pattern); if(comp != 0){ return comp; }else{// No case differences. Less significant difference could exist return m_collator.compare(m_text, pattern ); } }
Example 18
Source File: StringComparable.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
private static final int getMask(final int strength) { switch (strength) { case Collator.PRIMARY: return 0xFFFF0000; case Collator.SECONDARY: return 0xFFFFFF00; default: return 0xFFFFFFFF; } }
Example 19
Source File: StringComparable.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
public int compareTo(Object o) { final String pattern = ((StringComparable)o).toString(); if(m_text.equals(pattern)){//Code-point equals return 0; } final int savedStrength = m_collator.getStrength(); int comp = 0; // Is there difference more significant than case-order? if(((savedStrength == Collator.PRIMARY) || (savedStrength == Collator.SECONDARY))){ comp = m_collator.compare(m_text, pattern ); }else{// more than SECONDARY m_collator.setStrength(Collator.SECONDARY); comp = m_collator.compare(m_text, pattern ); m_collator.setStrength(savedStrength); } if(comp != 0){//Difference more significant than case-order return comp ; } // No difference more significant than case-order. // Find case difference comp = getCaseDiff(m_text, pattern); if(comp != 0){ return comp; }else{// No case differences. Less significant difference could exist return m_collator.compare(m_text, pattern ); } }
Example 20
Source File: StringComparable.java From jdk1.8-source-analysis with Apache License 2.0 | 5 votes |
private static final int getMask(final int strength) { switch (strength) { case Collator.PRIMARY: return 0xFFFF0000; case Collator.SECONDARY: return 0xFFFFFF00; default: return 0xFFFFFFFF; } }