testSortedFileMerge( 100000, 501 );
}
public void testSortedFileMerge(int count, int splitAfter) throws IOException
{
IntTupleReaderWriter itrw = new IntTupleReaderWriter();
Random random = new Random();
File dataFile = File.createTempFile( "tuple", ".data" );
dataFile.deleteOnExit();
DataOutputStream out = new DataOutputStream( new FileOutputStream( dataFile ) );
Tuple<Integer, Integer>[] arr = (Tuple<Integer, Integer>[]) Array.newInstance( Tuple.class, count );
int randUpper = count;
if(count < 100)
{
randUpper = 100;
}
for ( int i = 0; i < count; i++ )
{
int x = random.nextInt(randUpper);
//System.out.println(x);
Tuple<Integer, Integer> t = new Tuple<Integer, Integer>( x, x );
arr[i] = t;
itrw.writeTuple( t, out );
}
out.close();
BulkDataSorter<Integer, Integer> bds = new BulkDataSorter<Integer, Integer>( itrw, tupleComp, splitAfter );