1 6 7 package SOFA.SOFAnet.Admin.RMI; 8 9 import SOFA.SOFAnet.Repository.OutputTrigger; 10 import java.io.Serializable ; 11 12 16 public class OutputTriggerDesc implements Comparable , Serializable 17 { 18 public String name; 19 public String description; 20 21 22 public OutputTriggerDesc(OutputTrigger outputTrigger) 23 { 24 this.name = outputTrigger.getName(); 25 this.description = outputTrigger.getDescription(); 26 } 27 28 OutputTriggerDesc(String name, String description) 29 { 30 this.name = name; 31 this.description = description; 32 } 33 34 public boolean equals(Object o) 35 { 36 if (this == o) return true; 37 if (o instanceof OutputTriggerDesc) 38 { 39 OutputTriggerDesc outputTriggerDesc = (OutputTriggerDesc)o; 40 return toString().compareTo(outputTriggerDesc.toString()) == 0; 41 } 42 else return false; 43 } 44 45 public int compareTo(Object o) 46 { 47 OutputTriggerDesc outputTriggerDesc = (OutputTriggerDesc)o; 48 return toString().compareTo(outputTriggerDesc.toString()); 49 } 50 51 public String toString() 52 { 53 if (description.length() == 0) return name; 54 else return name + " (" + description + ")"; 55 } 56 } | Popular Tags |