Integer lowSample = ((AggRemoteName) arguments[0]).getIndex();
Integer highSample = ((AggRemoteName) arguments[1]).getIndex();
if (lowSample.intValue() > highSample.intValue())
throw new CommandFailedException("Invalid Range");
ContextReadableSample targ = getTarget();
int num = highSample.intValue() - lowSample.intValue() + 1;
Integer[] destIndexes = ZUtilities.fillIncrementally(new Integer[num], lowSample.intValue());
Integer[] srcIndexes = new Integer[destIndexes.length];
Arrays.fill(srcIndexes, targ.getSampleNumber());
try {
SampleContextMacros.copySamples(targ.getSampleContext(), srcIndexes, destIndexes, false, true, "Sample Copy to Range");
} catch (NoSuchSampleException e) {
throw new CommandFailedException("No sample: " + e.getAggName());
} catch (com.pcmsolutions.device.EMU.E4.preset.NoSuchContextException e) {
throw new CommandFailedException("No sample context");
} catch (IsolatedSampleUnavailableException e) {
throw new CommandFailedException("Could not copy samples: " + e.getMessage());
}
}