Java Code Examples for java.text.Collator#PRIMARY

The following examples show how to use java.text.Collator#PRIMARY . 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 vote down vote up
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 vote down vote up
private static final int getMask(final int strength) {
    switch (strength) {
        case Collator.PRIMARY:
            return 0xFFFF0000;
        case Collator.SECONDARY:
            return 0xFFFFFF00;
        default:
            return 0xFFFFFFFF;
    }
}
 
Example 3
Source File: StringComparable.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
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 4
Source File: StringComparable.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
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 5
Source File: StringComparable.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
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 6
Source File: StringComparable.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private static final int getMask(final int strength) {
    switch (strength) {
        case Collator.PRIMARY:
            return 0xFFFF0000;
        case Collator.SECONDARY:
            return 0xFFFFFF00;
        default:
            return 0xFFFFFFFF;
    }
}
 
Example 7
Source File: StringComparable.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
private static final int getMask(final int strength) {
    switch (strength) {
        case Collator.PRIMARY:
            return 0xFFFF0000;
        case Collator.SECONDARY:
            return 0xFFFFFF00;
        default:
            return 0xFFFFFFFF;
    }
}
 
Example 8
Source File: StringComparable.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
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 9
Source File: StringComparable.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
private static final int getMask(final int strength) {
    switch (strength) {
        case Collator.PRIMARY:
            return 0xFFFF0000;
        case Collator.SECONDARY:
            return 0xFFFFFF00;
        default:
            return 0xFFFFFFFF;
    }
}
 
Example 10
Source File: StringComparable.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
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 11
Source File: StringComparable.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
private static final int getMask(final int strength) {
    switch (strength) {
        case Collator.PRIMARY:
            return 0xFFFF0000;
        case Collator.SECONDARY:
            return 0xFFFFFF00;
        default:
            return 0xFFFFFFFF;
    }
}
 
Example 12
Source File: StringComparable.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
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 13
Source File: StringComparable.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
private static final int getMask(final int strength) {
    switch (strength) {
        case Collator.PRIMARY:
            return 0xFFFF0000;
        case Collator.SECONDARY:
            return 0xFFFFFF00;
        default:
            return 0xFFFFFFFF;
    }
}
 
Example 14
Source File: StringComparable.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
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 15
Source File: StringComparable.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
private static final int getMask(final int strength) {
    switch (strength) {
        case Collator.PRIMARY:
            return 0xFFFF0000;
        case Collator.SECONDARY:
            return 0xFFFFFF00;
        default:
            return 0xFFFFFFFF;
    }
}
 
Example 16
Source File: StringComparable.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
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 TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
private static final int getMask(final int strength) {
    switch (strength) {
        case Collator.PRIMARY:
            return 0xFFFF0000;
        case Collator.SECONDARY:
            return 0xFFFFFF00;
        default:
            return 0xFFFFFFFF;
    }
}
 
Example 18
Source File: StringComparable.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
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 19
Source File: StringComparable.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
private static final int getMask(final int strength) {
    switch (strength) {
        case Collator.PRIMARY:
            return 0xFFFF0000;
        case Collator.SECONDARY:
            return 0xFFFFFF00;
        default:
            return 0xFFFFFFFF;
    }
}
 
Example 20
Source File: BasicEvaluator.java    From jclic with GNU General Public License v2.0 4 votes vote down vote up
@Override
protected void init() {
  super.init();
  strength = checkAccents ? checkCase ? Collator.TERTIARY : Collator.SECONDARY : Collator.PRIMARY;
  collator.setStrength(strength);
}