00001 namespace JLibDiff
00002 {
00003 using System;
00004
00005 class DiffType
00006 {
00007
00008 private const short CODE_ERROR = 1;
00009 private const short CODE_ADD = 2;
00010 private const short CODE_CHANGE = 3;
00011 private const short CODE_DELETE = 4;
00012 private const short CODE_DIFF_ALL = 5;
00013 private const short CODE_DIFF_1ST = 6;
00014 private const short CODE_DIFF_2ND = 7;
00015 private const short CODE_DIFF_3RD = 8;
00016
00017 private short typecode;
00018
00019 public static DiffType ERROR = new DiffType(CODE_ERROR);
00020 public static DiffType ADD = new DiffType(CODE_ADD);
00021 public static DiffType CHANGE = new DiffType(CODE_CHANGE);
00022 public static DiffType DELETE = new DiffType(CODE_DELETE);
00023 public static DiffType DIFF_ALL = new DiffType(CODE_DIFF_ALL);
00024 public static DiffType DIFF_1ST = new DiffType(CODE_DIFF_1ST);
00025 public static DiffType DIFF_2ND = new DiffType(CODE_DIFF_2ND);
00026 public static DiffType DIFF_3RD = new DiffType(CODE_DIFF_3RD);
00027
00028 private DiffType(short pcode)
00029 {
00030 typecode = pcode;
00031 }
00032
00033 internal virtual short code()
00034 {
00035 return typecode;
00036 }
00037
00038 public virtual System.String toString()
00039 {
00040 switch (typecode)
00041 {
00042 case CODE_ERROR:
00043 return "ERROR";
00044
00045 case CODE_ADD:
00046 return "ADD";
00047
00048 case CODE_CHANGE:
00049 return "CHANGE";
00050
00051 case CODE_DELETE:
00052 return "DELETE";
00053
00054 case CODE_DIFF_ALL:
00055 return "DIFF_ALL";
00056
00057 case CODE_DIFF_1ST:
00058 return "DIFF_1ST";
00059
00060 case CODE_DIFF_2ND:
00061 return "DIFF_2ND";
00062
00063 case CODE_DIFF_3RD:
00064 return "DIFF_3RD";
00065
00066 default:
00067 return "";
00068
00069 }
00070 }
00071 public virtual int toInt()
00072 {
00073 switch (typecode)
00074 {
00075 case CODE_DIFF_ALL:
00076 return 5;
00077
00078 case CODE_DIFF_1ST:
00079 return 6;
00080
00081 case CODE_DIFF_2ND:
00082 return 7;
00083
00084 case CODE_DIFF_3RD:
00085 return 8;
00086
00087 default:
00088 return 0;
00089
00090 }
00091 }
00092 }
00093 }