- Timestamp:
- 2003-05-27T15:57:37+12:00 (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gli/src/org/greenstone/gatherer/cdm/ElementWrapper.java
r4293 r4366 6 6 */ 7 7 public class ElementWrapper 8 9 10 11 12 8 implements Comparable { 9 /** The element as the data from this object. */ 10 private Node element = null; 11 /** Constructor. 12 * @param element The <strong>Node</strong> this object is wrapped around. 13 13 */ 14 15 16 17 14 public ElementWrapper(Node element) { 15 this.element = element; 16 } 17 /** Compare two objects for ordering. 18 18 * @param object The other <strong>Object</strong> to compare to. 19 19 * @return An <i>int</i> indicating the ordering as is String.compareTo 20 20 */ 21 22 23 24 25 26 27 21 public int compareTo(Object object) { 22 if(object == null) { 23 return 1; 24 } 25 return toString().compareTo(object.toString()); 26 } 27 /** Compare two objects for equality. 28 28 * @param object The <strong>Object</strong> to compare to. 29 29 * @return <i>true</i> if the objects are equal, <i>false</i> otherwise. 30 30 */ 31 32 33 34 35 36 37 31 public boolean equals(Object object) { 32 if(compareTo(object) == 0) { 33 return true; 34 } 35 return false; 36 } 37 /** Retrieve the name of the element. 38 38 * @return The fully qualified name as a <strong>String</strong>. 39 39 * @see org.greenstone.gatherer.msm.MSMUtils 40 40 */ 41 42 43 44 41 public String name() { 42 return MSMUtils.getFullName((Element)element); 43 } 44 /** Retrieve a textual representation of this object. 45 45 * @return A <strong>String</strong>. 46 46 * @see org.greenstone.gatherer.msm.MSMUtils 47 47 */ 48 49 50 48 public String toString() { 49 return MSMUtils.getIdentifier(element) + ": " + MSMUtils.getDescription(element); 50 } 51 51 }
Note:
See TracChangeset
for help on using the changeset viewer.