1 package org.enhydra.xml.driver.diff; 2 3 import java.util.Enumeration ; 4 import java.util.Vector ; 5 6 10 public class HunkDel extends Hunk{ 11 12 int ld1; 13 int lf1; 14 int ld2; 15 16 Vector a=new Vector (); 17 18 public void accept(HunkVisitor visitor) { 19 visitor.visitHunkDel(this); 20 } 21 22 23 26 public String getOldContents(){ 27 String s=new String (); 28 for (Enumeration e = a.elements() ; e.hasMoreElements() ;) 29 s=s.concat((String )e.nextElement()); 30 return s; 31 } 32 33 37 public String convert(){ 38 String s=new String (Integer.toString(ld1)); 39 if(ld1!=lf1) 40 s=s.concat(","+lf1); 41 s=s.concat("d"+ld2+"\n"); 42 for (Enumeration e = a.elements() ; e.hasMoreElements() ;) 43 s=s.concat("< "+(String )e.nextElement()); 44 return s; 45 } 46 47 51 public String convert_ED(){ 52 String s=new String (Integer.toString(ld1)); 53 if(ld1!=lf1) 54 s=s.concat(","+lf1); 55 s=s.concat("d\n"); 56 return s; 57 } 58 59 63 public String convert_RCS(){ 64 String s=new String ("d"+ld1+" "+(lf1-ld1+1)+"\n"); 65 return s; 66 } 67 68 74 public int lowLine(int filenum){ 75 if(filenum==0) 76 return ld1; 77 else 78 return ld2; 79 } 80 81 87 public int highLine(int filenum){ 88 if(filenum==0) 89 return lf1; 90 else 91 return ld2; 92 } 93 94 100 public int numLines(int filenum){ 101 if(filenum==0) 102 return (lf1 - ld1 +1); 103 else 104 return 1; 105 } 106 107 114 public String relNum(int filenum,int linenum){ 115 if(filenum==0) 116 return (String )a.elementAt(linenum); 117 else 118 return null; 119 } 120 121 } 122 | Popular Tags |