* [ <address>, "remove", "at", [ <(int) idx> ] * N ]
* </pre>
*/
public void oscCmd_remove( RoutedOSCMessage rom )
{
final BasicCompoundEdit ce;
final List coll;
final long n1, n2;
int i1, i2;
int argIdx = 1;
try {
if( rom.msg.getArg( argIdx ).equals( "span" )) {
argIdx++;
n1 = ((Number) rom.msg.getArg( argIdx )).longValue();
argIdx++;
n2 = ((Number) rom.msg.getArg( argIdx )).longValue();
coll = trail.getRange( new Span( n1, n2 ), true );
} else if( rom.msg.getArg( argIdx ).equals( "range" )) {
argIdx++;
i1 = Math.max( 0, ((Number) rom.msg.getArg( argIdx )).intValue() );
argIdx++;
i2 = Math.min( trail.getNumStakes(), ((Number) rom.msg.getArg( argIdx )).intValue() );
coll = new ArrayList( Math.max( 1, i2 - i1 ));
while( i1 < i2 ) {
coll.add( trail.get( i1++ ));
}
} else if( rom.msg.getArg( argIdx ).equals( "at" )) {
argIdx++;
coll = new ArrayList( rom.msg.getArgCount() - argIdx );
for( ; argIdx < rom.msg.getArgCount(); argIdx++ ) {
i1 = ((Number) rom.msg.getArg( argIdx )).intValue();
if( (i1 >= 0) && (i1 < trail.getNumStakes()) ) {
coll.add( trail.get( i1 ));
}
}
} else {
OSCRoot.failedArgValue( rom, argIdx );
return;
}
if( coll.isEmpty() ) return;
ce = new BasicCompoundEdit( getResourceString( coll.size() > 1 ? "editDeleteMarkers" : "editDeleteMarker" ));
trail.editBegin( ce );
try {
trail.editRemoveAll( this, coll, ce );
}
finally {
trail.editEnd( ce );
}
ce.perform();
ce.end();
doc.getUndoManager().addEdit( ce );
}
catch( IndexOutOfBoundsException e1 ) {
OSCRoot.failedArgCount( rom );
}