1 15 package org.apache.hivemind.conditional; 16 17 import org.apache.hivemind.util.Defense; 18 19 25 class Token 26 { 27 private TokenType _type; 28 29 private String _value; 30 31 Token(TokenType type) 32 { 33 this(type, null); 34 } 35 36 42 43 Token(TokenType type, String value) 44 { 45 Defense.notNull(type, "type"); 46 47 _type = type; 48 _value = value; 49 } 50 51 public TokenType getType() 52 { 53 return _type; 54 } 55 56 60 61 public String getValue() 62 { 63 return _value; 64 } 65 66 70 71 public String toString() 72 { 73 StringBuffer buffer = new StringBuffer ("<"); 74 75 buffer.append(_type); 76 77 if (_value != null) 78 { 79 buffer.append("("); 80 buffer.append(_value); 81 buffer.append(")"); 82 } 83 84 buffer.append(">"); 85 86 return buffer.toString(); 87 } 88 } | Popular Tags |