001: /*
002: * Copyright (C) 2001, 2002 Robert MacGrogan
003: *
004: * This library is free software; you can redistribute it and/or
005: * modify it under the terms of the GNU Lesser General Public
006: * License as published by the Free Software Foundation; either
007: * version 2.1 of the License, or (at your option) any later version.
008: *
009: * This library is distributed in the hope that it will be useful,
010: * but WITHOUT ANY WARRANTY; without even the implied warranty of
011: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
012: * Lesser General Public License for more details.
013: *
014: * You should have received a copy of the GNU Lesser General Public
015: * License along with this library; if not, write to the Free Software
016: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
017: *
018: *
019: * $Archive: SourceJammer$
020: * $FileName: DiffType.java$
021: * $FileID: 4291$
022: *
023: * Last change:
024: * $AuthorName: Rob MacGrogan$
025: * $Date: 4/23/03 5:23 PM$
026: * $Comment: Replaced GPL header with LGPL header.$
027: *
028: * $KeyWordsOff: $
029: */
030:
031: package JLibDiff;
032:
033: class DiffType {
034:
035: private static final short CODE_ERROR = 1;
036: private static final short CODE_ADD = 2;
037: private static final short CODE_CHANGE = 3;
038: private static final short CODE_DELETE = 4;
039: private static final short CODE_DIFF_ALL = 5;
040: private static final short CODE_DIFF_1ST = 6;
041: private static final short CODE_DIFF_2ND = 7;
042: private static final short CODE_DIFF_3RD = 8;
043:
044: private short typecode;
045:
046: public static DiffType ERROR = new DiffType(CODE_ERROR);
047: public static DiffType ADD = new DiffType(CODE_ADD);
048: public static DiffType CHANGE = new DiffType(CODE_CHANGE);
049: public static DiffType DELETE = new DiffType(CODE_DELETE);
050: public static DiffType DIFF_ALL = new DiffType(CODE_DIFF_ALL);
051: public static DiffType DIFF_1ST = new DiffType(CODE_DIFF_1ST);
052: public static DiffType DIFF_2ND = new DiffType(CODE_DIFF_2ND);
053: public static DiffType DIFF_3RD = new DiffType(CODE_DIFF_3RD);
054:
055: private DiffType(short pcode) {
056: typecode = pcode;
057: }
058:
059: short code() {
060: return typecode;
061: }
062:
063: public String toString() {
064: switch (typecode) {
065: case CODE_ERROR:
066: return "ERROR";
067: case CODE_ADD:
068: return "ADD";
069: case CODE_CHANGE:
070: return "CHANGE";
071: case CODE_DELETE:
072: return "DELETE";
073: case CODE_DIFF_ALL:
074: return "DIFF_ALL";
075: case CODE_DIFF_1ST:
076: return "DIFF_1ST";
077: case CODE_DIFF_2ND:
078: return "DIFF_2ND";
079: case CODE_DIFF_3RD:
080: return "DIFF_3RD";
081: default:
082: return "";
083: }
084: }
085:
086: public int toInt() {
087: switch (typecode) {
088: case CODE_DIFF_ALL:
089: return 5;
090: case CODE_DIFF_1ST:
091: return 6;
092: case CODE_DIFF_2ND:
093: return 7;
094: case CODE_DIFF_3RD:
095: return 8;
096: default:
097: return 0;
098: }
099: }
100: }
|