1 32 33 package com.jeantessier.diff; 34 35 import java.util.*; 36 37 import org.apache.log4j.*; 38 39 import com.jeantessier.classreader.*; 40 41 48 public class ClassDifferences extends RemovableDifferences { 49 private Classfile oldClass; 50 private Classfile newClass; 51 52 private Collection featureDifferences = new LinkedList(); 53 54 57 ClassDifferences(String name, Classfile oldClass, Classfile newClass) { 58 super(name); 59 60 setOldClass(oldClass); 61 setNewClass(newClass); 62 63 if (oldClass != null) { 64 setOldDeclaration(oldClass.getDeclaration()); 65 } 66 67 if (newClass != null) { 68 setNewDeclaration(newClass.getDeclaration()); 69 } 70 71 if (isModified()) { 72 Logger.getLogger(getClass()).debug(getName() + " declaration has been modified."); 73 } else { 74 Logger.getLogger(getClass()).debug(getName() + " declaration has not been modified."); 75 } 76 } 77 78 public Classfile getOldClass() { 79 return oldClass; 80 } 81 82 protected void setOldClass(Classfile oldClass) { 83 this.oldClass = oldClass; 84 } 85 86 public Classfile getNewClass() { 87 return newClass; 88 } 89 90 protected void setNewClass(Classfile newClass) { 91 this.newClass = newClass; 92 } 93 94 public Collection getFeatureDifferences() { 95 return featureDifferences; 96 } 97 98 public boolean isModified() { 99 return super.isModified() || (getFeatureDifferences().size() != 0); 100 } 101 102 public void accept(Visitor visitor) { 103 visitor.visitClassDifferences(this); 104 } 105 } 106 | Popular Tags |