private int addExpansion(int anOrder,String expandChars){
  if (expandTable == null) {
    expandTable=new Vector<>(INITIALTABLESIZE);
  }
  int offset=(anOrder == RBCollationTables.UNMAPPED) ? 0 : 1;
  int[] valueList=new int[expandChars.length() + offset];
  if (offset == 1) {
    valueList[0]=anOrder;
  }
  int j=offset;
  for (int i=0; i < expandChars.length(); i++) {
    char ch0=expandChars.charAt(i);
    char ch1;
    int ch;
    if (Character.isHighSurrogate(ch0)) {
      if (++i == expandChars.length() || !Character.isLowSurrogate(ch1=expandChars.charAt(i))) {
        break;
      }
      ch=Character.toCodePoint(ch0,ch1);
    }
 else {
      ch=ch0;
    }
    int mapValue=getCharOrder(ch);
    if (mapValue != RBCollationTables.UNMAPPED) {
      valueList[j++]=mapValue;
    }
 else {
      valueList[j++]=CHARINDEX + ch;
    }
  }
  if (j < valueList.length) {
    int[] tmpBuf=new int[j];
    while (--j >= 0) {
      tmpBuf[j]=valueList[j];
    }
    valueList=tmpBuf;
  }
  int tableIndex=RBCollationTables.EXPANDCHARINDEX + expandTable.size();
  expandTable.addElement(valueList);
  return tableIndex;
}

private int addExpansion ( int anOrder , String expandChars ) { if ( expandTable == null ) { expandTable = new Vector < > ( INITIALTABLESIZE ) ; } int offset = ( anOrder == RBCollationTables . UNMAPPED ) ? 0 : 1 ; int [ ] valueList = new int [ expandChars . length ( ) + offset ] ; if ( offset == 1 ) { valueList [ 0 ] = anOrder ; } int j = offset ; for ( int i = 0 ; i < expandChars . length ( ) ; i ++ ) { char ch0 = expandChars . charAt ( i ) ; char ch1 ; int ch ; if ( Character . isHighSurrogate ( ch0 ) ) { if ( ++ i == expandChars . length ( ) || ! Character . isLowSurrogate ( ch1 = expandChars . charAt ( i ) ) ) { break ; } ch = Character . toCodePoint ( ch0 , ch1 ) ; } else { ch = ch0 ; } int mapValue = getCharOrder ( ch ) ; if ( mapValue != RBCollationTables . UNMAPPED ) { valueList [ j ++ ] = mapValue ; } else { valueList [ j ++ ] = CHARINDEX + ch ; } } if ( j < valueList . length ) { int [ ] tmpBuf = new int [ j ] ; while ( -- j >= 0 ) { tmpBuf [ j ] = valueList [ j ] ; } valueList = tmpBuf ; } int tableIndex = RBCollationTables . EXPANDCHARINDEX + expandTable . size ( ) ; expandTable . addElement ( valueList ) ; return tableIndex ; }
create a new entry in the expansion table that contains the orderings for the given characers . if anorder is valid , it is added to the beginning of the expanded list of orders .
