1 32 33 package com.jeantessier.diff; 34 35 import org.apache.log4j.*; 36 37 import com.jeantessier.classreader.*; 38 39 44 public class DocumentableDifferences extends DecoratorDifferences { 45 private boolean newDocumentation; 46 private boolean removedDocumentation; 47 48 51 DocumentableDifferences(Differences component, Validator oldValidator, Validator newValidator) { 52 super(component); 53 54 Logger.getLogger(getClass()).debug("Begin " + getName()); 55 56 setNewDocumentation(!oldValidator.isAllowed(component.getName()) && newValidator.isAllowed(component.getName())); 57 setRemovedDocumentation(oldValidator.isAllowed(component.getName()) && !newValidator.isAllowed(component.getName())); 58 59 Logger.getLogger(getClass()).debug("End " + getName() + ": " + (isEmpty() ? "empty" : "not empty")); 60 } 61 62 public boolean isNewDocumentation() { 63 Logger.getLogger(getClass()).debug(getName() + " NewDocumentation(): " + newDocumentation); 64 return newDocumentation; 65 } 66 67 public void setNewDocumentation(boolean newDocumentation) { 68 this.newDocumentation = newDocumentation; 69 } 70 71 public boolean isRemovedDocumentation() { 72 Logger.getLogger(getClass()).debug(getName() + " RemovedDocumentation(): " + removedDocumentation); 73 return removedDocumentation; 74 } 75 76 public void setRemovedDocumentation(boolean removedDocumentation) { 77 this.removedDocumentation = removedDocumentation; 78 } 79 80 public boolean isEmpty() { 81 return 82 !isNewDocumentation() && 83 !isRemovedDocumentation() && 84 getComponent().isEmpty(); 85 } 86 87 public void accept(Visitor visitor) { 88 visitor.visitDocumentableDifferences(this); 89 } 90 } 91 | Popular Tags |