1 57 58 package org.apache.commons.jrcs.diff; 59 60 import java.util.List ; 61 62 71 public class AddDelta 72 extends Delta 73 { 74 75 AddDelta() 76 { 77 super(); 78 } 79 80 public AddDelta(int origpos, Chunk rev) 81 { 82 init(new Chunk(origpos, 0), rev); 83 } 84 85 public void verify(List target) throws PatchFailedException 86 { 87 if (original.first() > target.size()) 88 { 89 throw new PatchFailedException("original.first() > target.size()"); 90 } 91 } 92 93 public void applyTo(List target) 94 { 95 revised.applyAdd(original.first(), target); 96 } 97 98 public void toString(StringBuffer s) 99 { 100 s.append(original.anchor()); 101 s.append("a"); 102 s.append(revised.rangeString()); 103 s.append(Diff.NL); 104 revised.toString(s, "> ", Diff.NL); 105 } 106 107 110 public void toRCSString(StringBuffer s, String EOL) 111 { 112 s.append("a"); 113 s.append(original.anchor()); 114 s.append(" "); 115 s.append(revised.size()); 116 s.append(EOL); 117 revised.toString(s, "", EOL); 118 } 119 120 123 public void Accept(RevisionVisitor visitor) 124 { 125 visitor.visit(this); 126 } 127 128 public void accept(RevisionVisitor visitor) 129 { 130 visitor.visit(this); 131 } 132 } 133 134 135 136 137 138 | Popular Tags |