1 32 33 package com.jeantessier.dependency; 34 35 import java.util.*; 36 37 public class ClosureStopSelector implements Visitor { 38 private boolean done = false; 39 40 private SelectionCriteria criteria; 41 42 public ClosureStopSelector(SelectionCriteria criteria) { 43 this.criteria = criteria; 44 } 45 46 public boolean isDone() { 47 return done; 48 } 49 50 public void traverseNodes(Collection nodes) { 51 if (nodes.isEmpty()) { 52 done = true; 53 } else { 54 Iterator i = nodes.iterator(); 55 while (i.hasNext()) { 56 ((Node) i.next()).accept(this); 57 } 58 } 59 } 60 61 public void visitPackageNode(PackageNode node) { 62 if (criteria.matches(node)) { 63 done = true; 64 } 65 } 66 67 public void visitInboundPackageNode(PackageNode node) { 68 } 70 71 public void visitOutboundPackageNode(PackageNode node) { 72 } 74 75 public void visitClassNode(ClassNode node) { 76 if (criteria.matches(node)) { 77 done = true; 78 } 79 } 80 81 public void visitInboundClassNode(ClassNode node) { 82 } 84 85 public void visitOutboundClassNode(ClassNode node) { 86 } 88 89 public void visitFeatureNode(FeatureNode node) { 90 if (criteria.matches(node)) { 91 done = true; 92 } 93 } 94 95 public void visitInboundFeatureNode(FeatureNode node) { 96 } 98 99 public void visitOutboundFeatureNode(FeatureNode node) { 100 } 102 } 103 | Popular Tags |