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

util.parallel.ParallelRangeOp Maven / Gradle / Ivy

There is a newer version: 11.4.6-RELEASE
Show newest version
package util.parallel;


/** 
 * Copyright (c) 2012-present Holger Schneider
 * All rights reserved.
 *
 * This source code is licensed under the MIT License (MIT) found in the
 * LICENSE file in the root directory of this source tree.
 *
 * 
 * @author hschneid
 *
 * @param 
 */
public abstract class ParallelRangeOp implements Runnable, Cloneable {

	private E start, end;
	
	public ParallelRangeOp() {}
	
	public abstract void run(E start, E end);

	/*  
	 * (non-Javadoc)
	 * @see java.lang.Runnable#run()
	 */
	@Override
	public void run() {
		try {
			if(start != null && end != null)
				run(start, end);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	/**
	 * 
	 * @param start
	 * @param end
	 */
	void set(E start, E end) {
		this.start = start;
		this.end = end;
	}

	/**
	 * 
	 * @return
	 * @throws CloneNotSupportedException
	 */
	@SuppressWarnings("unchecked")
	public ParallelRangeOp copy() throws CloneNotSupportedException {
		return (ParallelRangeOp) super.clone();
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy