1 57 58 package org.apache.commons.jrcs.diff.print; 59 60 import org.apache.commons.jrcs.diff.AddDelta; 61 import org.apache.commons.jrcs.diff.ChangeDelta; 62 import org.apache.commons.jrcs.diff.Chunk; 63 import org.apache.commons.jrcs.diff.DeleteDelta; 64 65 66 73 public class RCSPrint extends BasePrint { 74 75 79 public RCSPrint(StringBuffer sb) { 80 super(sb); 81 } 82 83 87 public void visit(DeleteDelta delta) { 88 StringBuffer s = getStringBuffer(); 89 Chunk original = delta.getOriginal(); 90 s.append("d"); 91 s.append(original.rcsfrom()); 92 s.append(" "); 93 s.append(original.size()); 94 s.append(getEOL()); 95 } 96 97 101 public void visit(ChangeDelta delta) { 102 StringBuffer s = getStringBuffer(); 103 Chunk original = delta.getOriginal(); 104 Chunk revised = delta.getRevised(); 105 s.append("d"); 106 s.append(original.rcsfrom()); 107 s.append(" "); 108 s.append(original.size()); 109 s.append(getEOL()); 110 s.append("a"); 111 s.append(original.rcsto()); 112 s.append(" "); 113 s.append(revised.size()); 114 s.append(getEOL()); 115 revised.toString(s, "", getEOL()); 116 } 117 118 122 public void visit(AddDelta delta) { 123 StringBuffer s = getStringBuffer(); 124 Chunk original = delta.getOriginal(); 125 Chunk revised = delta.getRevised(); 126 s.append("a"); 127 s.append(original.anchor()); 128 s.append(" "); 129 s.append(revised.size()); 130 s.append(getEOL()); 131 revised.toString(s, "", getEOL()); 132 } 133 134 } 135 | Popular Tags |