001: /*
002: * Gruntspud
003: *
004: * Copyright (C) 2002 Brett Smith.
005: *
006: * Written by: Brett Smith <t_magicthize@users.sourceforge.net>
007: *
008: * This program is free software; you can redistribute it and/or
009: * modify it under the terms of the GNU Library General Public License
010: * as published by the Free Software Foundation; either version 2 of
011: * the License, or (at your option) any later version.
012: * This program is distributed in the hope that it will be useful,
013: * but WITHOUT ANY WARRANTY; without even the implied warranty of
014: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
015: * GNU Library General Public License for more details.
016: *
017: * You should have received a copy of the GNU Library General Public
018: * License along with this program; if not, write to the Free Software
019: * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
020: */
021:
022: package gruntspud;
023:
024: /**
025: * Description of the Class
026: *
027: *@author magicthize
028: *@created 26 May 2002
029: */
030: public class CVSSubstTypeFilter implements Comparable {
031: private String extension;
032: private String typeName;
033: private CVSSubstType type;
034:
035: /**
036: * Creates a new CVSSubstTypeFilter object.
037: *
038: * @param extension DOCUMENT ME!
039: * @param type DOCUMENT ME!
040: * @param typeName DOCUMENT ME!
041: */
042: public CVSSubstTypeFilter(String extension, CVSSubstType type,
043: String typeName) {
044: this .extension = extension;
045: this .typeName = typeName;
046: setType(type);
047: }
048:
049: /**
050: * DOCUMENT ME!
051: *
052: * @param o DOCUMENT ME!
053: *
054: * @return DOCUMENT ME!
055: */
056: public int compareTo(Object o) {
057: CVSSubstTypeFilter f = (CVSSubstTypeFilter) o;
058: int i = getExtension().compareTo(f.getExtension());
059:
060: if (i == 0) {
061: return getTypeName().compareTo(f.getTypeName());
062: } else {
063:
064: return i;
065: }
066: }
067:
068: /**
069: * DOCUMENT ME!
070: *
071: * @param type DOCUMENT ME!
072: */
073: public void setType(CVSSubstType type) {
074: this .type = type;
075: }
076:
077: /**
078: * DOCUMENT ME!
079: *
080: * @return DOCUMENT ME!
081: */
082: public CVSSubstType getType() {
083: return type;
084: }
085:
086: /**
087: * DOCUMENT ME!
088: *
089: * @return DOCUMENT ME!
090: */
091: public String getTypeName() {
092: return typeName;
093: }
094:
095: /**
096: * DOCUMENT ME!
097: *
098: * @return DOCUMENT ME!
099: */
100: public String getExtension() {
101: return extension;
102: }
103: }
|