All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.scudata.thread.SortJob Maven / Gradle / Ivy

Go to download

SPL(Structured Process Language) A programming language specially for structured data computing.

The newest version!
package com.scudata.thread;

import java.util.Comparator;


/**
 * ????ִ???????????
 * @author RunQian
 *
 */
class SortJob extends Job {
	private Object []src;
	private Object[] dest;
	
	private int fromIndex; // ??ʼλ?ã?????
	private int toIndex; // ????λ?ã???????
	private int off; // ?????????ƫ????
	
	private Comparator c; // ?Ƚ???
	private int threadCount; // ?????߳???
	
	public SortJob(Object []src, Object[] dest, int fromIndex, int toIndex, int off, Comparator c, int threadCount) {
		this.src = src;
		this.dest = dest;
		this.fromIndex = fromIndex;
		this.toIndex = toIndex;
		this.c = c;
		this.off = off;
		this.threadCount = threadCount;
	}
	
	public SortJob(Object []src, Object[] dest, int fromIndex, int toIndex, int off, int threadCount) {
		this.src = src;
		this.dest = dest;
		this.fromIndex = fromIndex;
		this.toIndex = toIndex;
		this.off = off;
		this.threadCount = threadCount;
	}
	
	public void run() {
		if (c == null) {
			MultithreadUtil.mergeSort(src, dest, fromIndex, toIndex, off, threadCount);
		} else {
			MultithreadUtil.mergeSort(src, dest, fromIndex, toIndex, off, c, threadCount);
		}
	}
}