View Javadoc
1 package jsdsi; 2 3 import jsdsi.sexp.Sexp; 4 import jsdsi.sexp.SexpUtil; 5 6 /*** 7 * A tag defined by a simple string. 8 * 9 * @author Sameer Ajmani 10 * @author Sean Radford 11 * @version $Revision: 1.5.2.1 $ $Date: 2005/11/08 03:12:52 $ 12 */ 13 public class StringTag extends ExprTag { 14 15 private static final long serialVersionUID = -2461811044266013845L; 16 17 /*** 18 * The string value of this <code>StringTag</code>. 19 */ 20 private transient final String value; 21 22 /*** 23 * Creates a new <code>StringTag</code> for a given string value. 24 * 25 * @param v string to create the <code>StringTag</code>. 26 */ 27 public StringTag(String v) { 28 assert(v != null) : "null value"; 29 value = v; 30 } 31 32 /*** 33 * @see jsdsi.Tag#intersect(Tag) 34 */ 35 public Tag intersect(Tag that) 36 { 37 if (that instanceof StringTag) { 38 return this.intersect((StringTag)that); 39 } 40 if (that instanceof PrefixTag) { 41 return that.intersect(this); 42 } 43 if (that instanceof ReversePrefixTag) { 44 return that.intersect(this); 45 } 46 if (that instanceof RangeTag) { 47 return that.intersect(this); 48 } 49 if (that instanceof SetTag) { 50 return that.intersect(this); 51 } 52 return Tag.NULL_TAG; 53 } 54 55 /*** 56 * @see jsdsi.Tag#intersect(Tag) 57 */ 58 public Tag intersect(StringTag that) 59 { 60 if (this.equals(that)) { 61 return this; 62 } 63 return Tag.NULL_TAG; 64 } 65 66 /*** 67 * @see java.lang.Object#equals(Object) 68 */ 69 public boolean equals(Object that) { 70 return (that instanceof StringTag) 71 && this.value.equals(((StringTag)that).value); 72 } 73 74 /*** 75 * @see java.lang.Object#hashCode() 76 */ 77 public int hashCode() { 78 return value.hashCode(); 79 } 80 81 /*** 82 * @return the string value of this <code>StringTag</code>. 83 */ 84 public String getValue() { 85 return value; 86 } 87 88 public Sexp toTagSexp() { 89 return SexpUtil.toSexp(getValue()); 90 } 91 }

This page was automatically generated by Maven