1 32 33 package com.jeantessier.dependency; 34 35 import java.util.*; 36 37 public class PackageNode extends Node { 38 private Collection classes = new HashSet(); 39 40 public PackageNode(String name, boolean concrete) { 41 super(name, concrete); 42 } 43 44 void setConfirmed(boolean confirmed) { 46 Iterator i = getClasses().iterator(); 47 while (!confirmed && i.hasNext()) { 48 confirmed = ((Node) i.next()).isConfirmed(); 49 } 50 51 super.setConfirmed(confirmed); 52 } 53 54 public void addClass(ClassNode node) { 55 classes.add(node); 56 } 57 58 public void removeClass(ClassNode node) { 59 classes.remove(node); 60 } 61 62 public Collection getClasses() { 63 return Collections.unmodifiableCollection(classes); 64 } 65 66 public void accept(Visitor visitor) { 67 visitor.visitPackageNode(this); 68 } 69 70 public void acceptInbound(Visitor visitor) { 71 visitor.visitInboundPackageNode(this); 72 } 73 74 public void acceptOutbound(Visitor visitor) { 75 visitor.visitOutboundPackageNode(this); 76 } 77 } 78 | Popular Tags |