Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 /* ************************************************************************
 #
 #  DivConq
 #
 #  http://divconq.com/
 #
 #  Copyright:
 #    Copyright 2014 eTimeline, LLC. All rights reserved.
 #
#  License:
#    See the license.txt file in the project's top-level directory for details.
#  Authors:
#    * Andy White
************************************************************************ */
package divconq.script.inst;
public class Progress extends Instruction {
	public void run(final StackEntry stack) {
		String output = this..hasText() ? stack.resolveValue(this..getText()).toString() : null;
		long steps = stack.intFromSource("Steps", -1);
		long step = stack.intFromSource("Step", -1);
		long amount = stack.intFromSource("Amount", -1);
		long add = stack.intFromSource("Add", -1);
		String name = stack.stringFromSource("Name");
		if (amount >= 0)
			stack.log().setAmountCompleted((intamount);
		else if (add >= 0)
			stack.log().setAmountCompleted(stack.log().getAmountCompleted() + (intadd);
		if ((step >= 0) && StringUtil.isNotEmpty(name))
			stack.log().setCurrentStep((intstepname);
		if (steps >= 0)
			stack.log().setSteps((intsteps);
		if (StringUtil.isNotEmpty(output))
			stack.log().setProgressMessage(output);
		stack.resume();
	}
	public void cancel(StackEntry stack) {
		// do nothing, this isn't cancellable
	}
New to GrepCode? Check out our FAQ X