1 /* 2 * Copyright 1999-2001,2004 The Apache Software Foundation. 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package org.apache.commons.workflow; 18 19 20 /** 21 * <p><strong>BlockState</strong> represents the current dynamic execution 22 * state of a <code>Block</code> that is executing nested <code>Steps</code>. 23 * This class will serve for most <code>Block</code> implementations, but 24 * may be subclassed for <code>Blocks</code> with a requirement to maintain 25 * additional state information (such as a "for" loop that needs to keep 26 * track of the starting and ending indexes, and the iteration counter).</p> 27 * 28 * @author Craig R. McClanahan 29 * @version $Revision: 155475 $ $Date: 2005-02-26 13:31:11 +0000 (Sat, 26 Feb 2005) $ 30 */ 31 32 public class BlockState { 33 34 35 // ----------------------------------------------------------- Constructors 36 37 38 /** 39 * Construct a new <code>BlockState</code> instance, associated with the 40 * specified <code>block</code>, and with the specified initial value 41 * for the <code>nest</code> property. 42 * 43 * @param block The <code>block</code> whose state this object represents 44 * @param nest The initial state of the <code>nest</code> property 45 */ 46 public BlockState(Block block, boolean nest) { 47 48 super(); 49 this.block = block; 50 this.nest = nest; 51 52 } 53 54 55 // ------------------------------------------------------------- Properties 56 57 58 /** 59 * The <code>Block</code> whose state is represented by this object. 60 */ 61 protected Block block = null; 62 63 public Block getBlock() { 64 return (this.block); 65 } 66 67 68 /** 69 * Should we execute the nested <code>Steps</code> of this 70 * <code>Block</code> again when the current execution finishes? 71 */ 72 protected boolean nest = false; 73 74 public boolean getNest() { 75 return (this.nest); 76 } 77 78 public void setNest(boolean nest) { 79 this.nest = nest; 80 } 81 82 83 // --------------------------------------------------------- Public Methods 84 85 86 /** 87 * Render a String version of this object. 88 */ 89 public String toString() { 90 91 StringBuffer sb = new StringBuffer("BlockState[block="); 92 sb.append(block); 93 sb.append(", nest="); 94 sb.append(nest); 95 sb.append("]"); 96 return (sb.toString()); 97 98 } 99 100 }