Methods Summary |
---|
private java.lang.String | getLowerCaseSequence(java.text.StringCharacterIterator iter)
final StringBuffer buf = new StringBuffer();
char c;
while ( (c=iter.current()) != CharacterIterator.DONE )
{
if ( Character.isUpperCase( c ) )
{
break;
}
iter.next();
buf.append( c );
}
return( buf.toString() );
|
private java.lang.String | getUpperCaseSequence(java.text.CharacterIterator iter)
final StringBuffer buf = new StringBuffer();
char c;
while ( (c=iter.current()) != CharacterIterator.DONE )
{
if ( Character.isLowerCase( c ) )
{
break;
}
iter.next();
buf.append( c );
}
return( buf.toString() );
|
public java.lang.String | mangleAttributeName(java.lang.String newName)Convert an Attribute name from the new one to the old one.
Any special casing should override this.
String result = (String)mMappings.get( newName );
if ( result == null )
{
// use algorithmic conversion
result = newToOld( newName );
// cache for later
mMappings.put( newName, result );
}
return( result );
|
private java.lang.String | newToOld(java.lang.String newName)
final StringCharacterIterator iter = new StringCharacterIterator( newName );
final StringBuffer buf = new StringBuffer();
while ( iter.current() != CharacterIterator.DONE )
{
final String uppercase = getUpperCaseSequence( iter );
if ( uppercase.length() <= 1 ||
iter.current() == CharacterIterator.DONE )
{
buf.append( uppercase.toLowerCase() );
}
else
{
// a run of an uppercase acronym of length N. The first N-1 characters
// are the acronym and the last character is actually the first letter of
// the next word.
final int acronymLength = uppercase.length() - 1;
final String acronym = uppercase.substring( 0, acronymLength );
final char firstOfNext = uppercase.charAt( acronymLength );
buf.append( acronym.toLowerCase() );
buf.append( mWordDelim );
buf.append( Character.toLowerCase( firstOfNext ) );
}
buf.append( getLowerCaseSequence( iter ) );
if ( iter.current() != CharacterIterator.DONE )
{
buf.append( mWordDelim );
}
}
return( buf.toString() );
|
public java.lang.String | toString()
final StringBuffer buf = new StringBuffer();
final Iterator iter = mMappings.keySet().iterator();
while ( iter.hasNext() )
{
final String newName = (String)iter.next();
buf.append( newName + "=" + mMappings.get( newName ) + "\n");
}
return( buf.toString() );
|