KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > beehive > netui > tools > testrecorder > shared > config > Category


1 /*
2  * Copyright 2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  * $Header:$
17  */

18
19 package org.apache.beehive.netui.tools.testrecorder.shared.config;
20
21 import java.io.File JavaDoc;
22
23 /**
24  * User: ozzy
25  * Date: Apr 9, 2004
26  * Time: 2:32:14 PM
27  */

28 public class Category implements Comparable JavaDoc {
29
30     private String JavaDoc name;
31     private String JavaDoc description;
32     private File JavaDoc reportDir;
33
34     public Category( String JavaDoc name, String JavaDoc description, String JavaDoc baseDirPath ) throws ConfigException {
35         this.name = name;
36         this.description = description;
37         this.reportDir = new File JavaDoc( baseDirPath + "/junit/" + name );
38     }
39
40     public String JavaDoc getName() {
41         return name;
42     }
43
44     public String JavaDoc getDescription() {
45         return description;
46     }
47
48     public String JavaDoc getReportDirPath() {
49         return reportDir.getAbsolutePath();
50     }
51
52     public int compareTo( Object JavaDoc o ) {
53         if ( o instanceof Category ) {
54             Category other = (Category) o;
55             return getName().compareToIgnoreCase( other.getName() );
56         }
57         return 1;
58     }
59
60     public boolean equals( Object JavaDoc object ) {
61         if ( this == object ) {
62             return true;
63         }
64         else if ( object == null || getClass() != object.getClass() ) {
65             return false;
66         }
67         Category other = (Category) object;
68         return getName().equals( other.getName() );
69     }
70
71     public int hashCode() {
72         return getName().hashCode();
73     }
74
75     public String JavaDoc toString() {
76         StringBuffer JavaDoc sb = new StringBuffer JavaDoc( 64 );
77         sb.append( "[ " );
78         sb.append( "name( " + name + " )" );
79         sb.append( ", reportDir( " + getReportDirPath() + " )" );
80         sb.append( ", description( " + description + " )" );
81         sb.append( " ]" );
82         return sb.toString();
83     }
84
85 }
86
Popular Tags