00001 namespace JLibDiff
00002 {
00003         using System;
00004         
00009         [Serializable]
00010         public class HunkChange:Hunk
00011         {
00012                 
00013                 internal int ld1;
00014                 internal int lf1;
00015                 internal int ld2;
00016                 internal int lf2;
00017                 
00018                 internal System.Collections.ArrayList a = new System.Collections.ArrayList();
00019                 internal System.Collections.ArrayList b = new System.Collections.ArrayList();
00020                 
00021                 
00022                 public override void  accept(HunkVisitor visitor)
00023                 {
00024                         visitor.visitHunkChange(this);
00025                 }
00026                 
00027                 
00028                 
00029 
00030 
00031                 public virtual System.String getNewContents()
00032                 {
00033                         System.String s = new System.String("".ToCharArray());
00034                          for (System.Collections.IEnumerator e = b.GetEnumerator(); e.MoveNext(); )
00035                         {
00036                                 s = System.String.Concat(s, (System.String) e.Current);
00037                         }
00038                         return s;
00039                 }
00040                 
00041                 
00042 
00043 
00044 
00045                 public override System.String convert()
00046                 {
00047                         System.String s = new System.String(System.Convert.ToString(ld1).ToCharArray());
00048                         if (ld1 != lf1)
00049                                 s = System.String.Concat(s, "," + lf1);
00050                         s = System.String.Concat(s, "c" + ld2);
00051                         if (ld2 != lf2)
00052                                 s = System.String.Concat(s, "," + lf2);
00053                         s = System.String.Concat(s, "\n");
00054                          for (System.Collections.IEnumerator e = a.GetEnumerator(); e.MoveNext(); )
00055                         {
00056                                 s = System.String.Concat(s, "< " + (System.String) e.Current);
00057                         }
00058                         s = System.String.Concat(s, "---\n");
00059                          for (System.Collections.IEnumerator e = b.GetEnumerator(); e.MoveNext(); )
00060                         {
00061                                 s = System.String.Concat(s, "> " + (System.String) e.Current);
00062                         }
00063                         return s;
00064                 }
00065                 
00066                 
00067 
00068 
00069 
00070                 public override System.String convert_ED()
00071                 {
00072                         System.String s = new System.String(System.Convert.ToString(ld1).ToCharArray());
00073                         if (ld1 != lf1)
00074                                 s = System.String.Concat(s, "," + lf1);
00075                         s = System.String.Concat(s, "c\n");
00076                          for (System.Collections.IEnumerator e = b.GetEnumerator(); e.MoveNext(); )
00077                         {
00078                                 s = System.String.Concat(s, (System.String) e.Current);
00079                         }
00080                         s = System.String.Concat(s, ".\n");
00081                         return s;
00082                 }
00083                 
00084                 
00085 
00086 
00087 
00088                 public override System.String convert_RCS()
00089                 {
00090                         System.String s = new System.String(("d" + ld1 + " " + (lf1 - ld1 + 1) + "\n").ToCharArray());
00091                         s = System.String.Concat(s, "a" + lf1 + " " + (lf2 - ld2 + 1) + "\n");
00092                          for (System.Collections.IEnumerator e = b.GetEnumerator(); e.MoveNext(); )
00093                         {
00094                                 s = System.String.Concat(s, (System.String) e.Current);
00095                         }
00096                         return s;
00097                 }
00098                 
00099                 
00100 
00101 
00102 
00103 
00104 
00105                 public override int lowLine(int filenum)
00106                 {
00107                         if (filenum == 0)
00108                                 return ld1;
00109                         else
00110                                 return ld2;
00111                 }
00112                 
00113                 
00114 
00115 
00116 
00117 
00118 
00119                 public override int highLine(int filenum)
00120                 {
00121                         if (filenum == 0)
00122                                 return lf1;
00123                         else
00124                                 return lf2;
00125                 }
00126                 
00127                 
00128 
00129 
00130 
00131 
00132 
00133                 public override int numLines(int filenum)
00134                 {
00135                         if (filenum == 0)
00136                                 return (lf1 - ld1 + 1);
00137                         else
00138                                 return (lf2 - ld2 + 1);
00139                 }
00140                 
00141                 
00142 
00143 
00144 
00145 
00146 
00147 
00148                 public override System.String relNum(int filenum, int linenum)
00149                 {
00150                         if (filenum == 0)
00151                                 return (System.String) a[linenum];
00152                         else
00153                                 return (System.String) b[linenum];
00154                 }
00155         }
00156 }