01: /*
02: * The contents of this file are subject to the terms of the Common Development
03: * and Distribution License (the License). You may not use this file except in
04: * compliance with the License.
05: *
06: * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
07: * or http://www.netbeans.org/cddl.txt.
08: *
09: * When distributing Covered Code, include this CDDL Header Notice in each file
10: * and include the License file at http://www.netbeans.org/cddl.txt.
11: * If applicable, add the following below the CDDL Header, with the fields
12: * enclosed by brackets [] replaced by your own identifying information:
13: * "Portions Copyrighted [year] [name of copyright owner]"
14: *
15: * The Original Software is NetBeans. The Initial Developer of the Original
16: * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
17: * Microsystems, Inc. All Rights Reserved.
18: */
19:
20: package org.netbeans.modules.bpel.debugger.pem;
21:
22: import java.util.HashMap;
23: import java.util.Map;
24: import org.netbeans.modules.bpel.debugger.api.pem.PemEntity;
25: import org.netbeans.modules.bpel.debugger.api.psm.PsmEntity;
26:
27: /**
28: *
29: * @author Alexander Zgursky
30: */
31: public class PemNonLoopEntityImpl extends PemEntityImpl {
32: private Map<PsmEntity, PemEntityImpl> myChildren;
33:
34: /** Creates a new instance of PemNonLoopEntityImpl */
35: protected PemNonLoopEntityImpl(ProcessExecutionModelImpl model,
36: PsmEntity psmEntity, String branchId,
37: boolean isReceivingEvents) {
38: super (model, psmEntity, branchId, isReceivingEvents);
39: }
40:
41: public PemEntityImpl[] getChildren() {
42: if (myChildren != null) {
43: return myChildren.values().toArray(
44: new PemEntityImpl[myChildren.size()]);
45: } else {
46: return new PemEntityImpl[0];
47: }
48: }
49:
50: public int getChildrenCount() {
51: if (myChildren != null) {
52: return myChildren.size();
53: } else {
54: return 0;
55: }
56: }
57:
58: public boolean hasChildren() {
59: return myChildren != null;
60: }
61:
62: public PemEntityImpl[] getChildren(PsmEntity psmEntity) {
63: if (myChildren != null) {
64: PemEntityImpl child = myChildren.get(psmEntity);
65: if (child != null) {
66: return new PemEntityImpl[] { child };
67: }
68: }
69: return new PemEntityImpl[0];
70: }
71:
72: public int getChildrenCount(PsmEntity psmEntity) {
73: if (myChildren != null) {
74: return myChildren.containsKey(psmEntity) ? 1 : 0;
75: } else {
76: return 0;
77: }
78: }
79:
80: public boolean hasChildren(PsmEntity psmEntity) {
81: if (myChildren != null) {
82: return myChildren.containsKey(psmEntity);
83: } else {
84: return false;
85: }
86: }
87:
88: protected void addChild(PemEntityImpl child) {
89: if (myChildren == null) {
90: myChildren = new HashMap<PsmEntity, PemEntityImpl>();
91: }
92:
93: myChildren.put(child.getPsmEntity(), child);
94: child.setParent(this);
95: }
96: }
|