KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > SOFA > SOFAnet > Admin > RMI > InputTriggerDesc


1 /*
2  * InputTriggerDesc.java
3  *
4  * Created on 18. květen 2004, 14:24
5  */

6
7 package SOFA.SOFAnet.Admin.RMI;
8
9 import SOFA.SOFAnet.Repository.InputTrigger;
10 import java.io.Serializable JavaDoc;
11
12 /**
13  *
14  * @author Ladislav Sobr
15  */

16 public class InputTriggerDesc implements Comparable JavaDoc, Serializable JavaDoc
17 {
18   public String JavaDoc name;
19   public String JavaDoc description;
20   
21   /** Creates a new instance of InputTriggerDesc */
22   public InputTriggerDesc(InputTrigger inputTrigger)
23   {
24     this.name = inputTrigger.getName();
25     this.description = inputTrigger.getDescription();
26   }
27     
28   InputTriggerDesc(String JavaDoc name, String JavaDoc description)
29   {
30     this.name = name;
31     this.description = description;
32   }
33
34   public boolean equals(Object JavaDoc o)
35   {
36     if (this == o) return true;
37     if (o instanceof InputTriggerDesc)
38     {
39       InputTriggerDesc inputTriggerDesc = (InputTriggerDesc)o;
40       return toString().compareTo(inputTriggerDesc.toString()) == 0;
41     }
42     else return false;
43   }
44
45   public int compareTo(Object JavaDoc o)
46   {
47     InputTriggerDesc inputTriggerDesc = (InputTriggerDesc)o;
48     return toString().compareTo(inputTriggerDesc.toString());
49   }
50
51   public String JavaDoc toString()
52   {
53     if (description.length() == 0) return name;
54     else return name + " (" + description + ")";
55   }
56 }
57
Popular Tags