else
{
long n_start = System.currentTimeMillis();
for ( int n = 0; n < num; n++ )
{
IElementAttributes attrp = cache_control.getDefaultElementAttributes();
ElementEventHandlerMockImpl hand = new ElementEventHandlerMockImpl();
attrp.addElementEventHandler( hand );
cache_control.put( "key" + n, "data" + n + " put from ta = junk", attrp );
}
long n_end = System.currentTimeMillis();
p( "---put " + num + " in " + String.valueOf( n_end - n_start ) + " millis ---" );
}
}
else if ( message.startsWith( "put" ) )
{
String key = null;
String val = null;
StringTokenizer toke = new StringTokenizer( message );
int tcnt = 0;
while ( toke.hasMoreElements() )
{
tcnt++;
String t = (String) toke.nextElement();
if ( tcnt == 2 )
{
key = t.trim();
}
else if ( tcnt == 3 )
{
val = t.trim();
}
}
if ( tcnt < 3 )
{
p( "usage: put key val" );
}
else
{
long n_start = System.currentTimeMillis();
cache_control.put( key, val );
long n_end = System.currentTimeMillis();
p( "---put " + key + " | " + val + " in " + String.valueOf( n_end - n_start )
+ " millis ---" );
}
}
/////////////////////////////////////////////////////////////////////
if ( message.startsWith( "removem" ) )
{
String numS = message.substring( message.indexOf( " " ) + 1, message.length() );
int num = Integer.parseInt( numS.trim() );
if ( numS == null )
{
p( "usage: removem numbertoremove" );
}
else
{
removeMultiple( num );
}
}
else if ( message.startsWith( "removeall" ) )
{
cache_control.clear();
p( "removed all" );
}
else if ( message.startsWith( "remove" ) )
{
String key = message.substring( message.indexOf( " " ) + 1, message.length() );
cache_control.remove( key );
p( "removed " + key );
}
else if ( message.startsWith( "deattr" ) )
{
IElementAttributes ae = cache_control.getDefaultElementAttributes();
p( "Default IElementAttributes " + ae );
}
else if ( message.startsWith( "cloneattr" ) )
{
String numS = message.substring( message.indexOf( " " ) + 1, message.length() );
int num = Integer.parseInt( numS.trim() );
if ( numS == null )
{
p( "usage: put numbertoput" );
}
else
{
IElementAttributes attrp = new ElementAttributes();
long n_start = System.currentTimeMillis();
for ( int n = 0; n < num; n++ )
{
attrp.copy();
}
long n_end = System.currentTimeMillis();
p( "---cloned attr " + num + " in " + String.valueOf( n_end - n_start ) + " millis ---" );
}
}