1 package jcryptoboard
.actions
.generator
;
3 import jcryptoboard
.api
.model
.AbstractAction
;
4 import jcryptoboard
.api
.model
.ActionResult
;
5 import org
.apache
.commons
.lang
.mutable
.MutableInt
;
7 public class IntegerGenerator
extends AbstractAction
{
10 public static final int DEFUALT_START
= 0;
11 public static final int DEFUALT_END
= 100;
12 public static final int DEFUALT_STEP
= 1;
14 protected MutableInt start
= new MutableInt(DEFUALT_START
);
15 protected MutableInt end
= new MutableInt(DEFUALT_END
);
16 protected MutableInt step
= new MutableInt(DEFUALT_STEP
);
18 protected MutableInt value
= new MutableInt(DEFUALT_START
);
20 public ActionResult
execute() throws Exception
{
22 final int startVal
= start
.intValue();
23 final int endVal
= end
.intValue();
24 final int stepVal
= step
.intValue();
27 while (value
.intValue() < endVal
) {
28 ActionResult ar
= nextAction
.execute();
29 if (ar
!= ActionResult
.OK
) {
35 else if (stepVal
< 0) {
36 while (value
.intValue() > endVal
) {
37 ActionResult ar
= nextAction
.execute();
38 if (ar
!= ActionResult
.OK
) {
44 return ActionResult
.OK
;