1 32 33 package com.jeantessier.diff; 34 35 import org.apache.log4j.*; 36 37 import com.jeantessier.classreader.*; 38 39 44 public class DeprecatableDifferences extends DecoratorDifferences { 45 private boolean newDeprecation; 46 private boolean removedDeprecation; 47 48 51 DeprecatableDifferences(Differences component, Deprecatable oldDeprecatable, Deprecatable newDeprecatable) { 52 super(component); 53 54 Logger.getLogger(getClass()).debug("Begin " + getName()); 55 56 if (oldDeprecatable != null && newDeprecatable != null) { 57 Logger.getLogger(getClass()).debug(" old deprecatable: " + oldDeprecatable.isDeprecated()); 58 Logger.getLogger(getClass()).debug(" new deprecatable: " + newDeprecatable.isDeprecated()); 59 60 setRemovedDeprecation(oldDeprecatable.isDeprecated() && !newDeprecatable.isDeprecated()); 61 setNewDeprecation(!oldDeprecatable.isDeprecated() && newDeprecatable.isDeprecated()); 62 } 63 64 Logger.getLogger(getClass()).debug("End " + getName() + ": " + (isEmpty() ? "empty" : "not empty")); 65 } 66 67 public boolean isNewDeprecation() { 68 Logger.getLogger(getClass()).debug(getName() + " NewDeprecation(): " + newDeprecation); 69 return newDeprecation; 70 } 71 72 public void setNewDeprecation(boolean newDeprecation) { 73 this.newDeprecation = newDeprecation; 74 } 75 76 public boolean isRemovedDeprecation() { 77 Logger.getLogger(getClass()).debug(getName() + " RemovedDeprecation(): " + removedDeprecation); 78 return removedDeprecation; 79 } 80 81 public void setRemovedDeprecation(boolean removedDeprecation) { 82 this.removedDeprecation = removedDeprecation; 83 } 84 85 public boolean isEmpty() { 86 return 87 !isNewDeprecation() && 88 !isRemovedDeprecation() && 89 getComponent().isEmpty(); 90 } 91 92 public void accept(Visitor visitor) { 93 visitor.visitDeprecatableDifferences(this); 94 } 95 } 96 | Popular Tags |