Methods Summary |
---|
public int | getMaxColumnNameLength()
return myNameLength;
|
public int | getMaxConstraintNameLength()
return myNameLength;
|
public int | getMaxTableNameLength()
return myNameLength;
|
public boolean | isCaseSensitiveNames()
return myCaseSensitive;
|
private static boolean | isDigit(char ch)
return Character.isDigit(ch);
|
public boolean | isReservedWord(java.lang.String word)
for(int i=0; i<myReservedWords.length; ++i ){
if(myReservedWords[i].equalsIgnoreCase(word)){
return true;
}
}
return false;
|
private static boolean | isVowel(char ch)
for( int i=0; i<vowels.length; ++i ){
if(ch == vowels[i]){
return true;
}
}
return false;
|
public java.lang.String | shorten(java.lang.String name, int length)
int originalLength = name.length();
if(originalLength <= length){
return name;
}
int vowelCount = 0;
for(int i=0; i<name.length(); ++i){
if(isVowel(name.charAt(i))){
++vowelCount;
}
}
int needRemoveNotVowels = originalLength-vowelCount-length;
int removedNotVowels = 0;
int removedVowels = 0;
StringBuffer result = new StringBuffer();
for(int i=name.length()-1; i>=0; --i ){
if( isDigit(name.charAt(i)) ){
result.append(name.charAt(i));
}
else if(needRemoveNotVowels > removedNotVowels){
if(isVowel(name.charAt(i))){
++removedVowels;
}
else{
++removedNotVowels;
}
}
else if(originalLength-removedNotVowels-removedVowels > length && isVowel(name.charAt(i))){
++removedVowels;
}
else{
result.append(name.charAt(i));
}
}
return result.reverse().toString();
|