1 23 package org.objectweb.clif.scenario.util.isac.engine.behavior.node; 24 25 import java.util.Vector ; 26 27 35 public class ExecutableNode { 36 private String type ; 38 private Object description ; 39 private ExecutableNode parent ; 40 private Vector children ; 41 42 46 public ExecutableNode(String type) { 47 this.type = type ; 48 this.description = null ; 49 this.children = new Vector () ; 50 } 51 52 57 public ExecutableNode(String type, Object description) { 58 this.type = type ; 59 this.description = description ; 60 this.children = new Vector () ; 61 } 62 63 67 71 public void addChild(ExecutableNode child) { 72 child.setParent(this) ; 74 this.children.add(child) ; 77 } 78 79 83 86 public ExecutableNode getParent() { 87 return parent; 88 } 89 92 public void setParent(ExecutableNode parent) { 93 this.parent = parent; 94 } 95 98 public Vector getChildren() { 99 return children; 100 } 101 104 public String getType() { 105 return type; 106 } 107 110 public Object getDescription() { 111 return description; 112 } 113 116 public void setDescription(Object description) { 117 this.description = description; 118 } 119 120 124 public void printNode() { 125 printNode(this,0) ; 126 } 127 128 public void printWithoutChildrenNode() { 129 System.out.println("type="+this.getType()) ; 130 System.out.println("desc="+this.getDescription()) ; 131 } 132 133 public void printNode(ExecutableNode node, int indent) { 134 System.out.println("") ; 135 printIndent(indent) ;System.out.println("type="+node.getType()) ; 136 printIndent(indent) ;System.out.println("desc="+node.getDescription()) ; 137 for (int i=0;i<node.getChildren().size();i++) { 138 printNode((ExecutableNode)node.getChildren().elementAt(i), indent+4) ; 139 } 140 } 141 142 public void printIndent(int indent) { 143 for (int i=0;i<indent;i++) { 144 System.out.print(" ") ; 145 } 146 } 147 } 148 | Popular Tags |