KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > jfun > parsec > tokens > TokenDecimal


1 /*****************************************************************************
2  * Copyright (C) Zephyr Business Solutions Corp. All rights reserved. *
3  * ------------------------------------------------------------------------- *
4  * The software in this package is published under the terms of the BSD *
5  * style license a copy of which has been included with this distribution in *
6  * the LICENSE.txt file. *
7  *****************************************************************************/

8 /*
9  * Created on 2004-11-15
10  *
11  * Author Ben Yu
12  */

13 package jfun.parsec.tokens;
14
15 import jfun.parsec.Tokenizer;
16
17 /**
18  * The token that represents any decimal literal.
19  * @author Ben Yu
20  *
21  * 2004-11-15
22  */

23 @Deprecated JavaDoc
24 public class TokenDecimal extends TypedToken<TokenType>
25 implements java.io.Serializable JavaDoc{
26   /**
27    * @param raw the raw string of the decimal.
28    */

29   TokenDecimal(final String JavaDoc raw) {
30     super(raw, TokenType.Decimal);
31   }
32
33   /**
34    * gets the string representation of the decimal.
35    * @return the integral part.
36    */

37   public final String JavaDoc getString(){return getText();}
38
39   private static final Tokenizer tn = new Tokenizer(){
40     public Object JavaDoc toToken(final CharSequence JavaDoc cs,
41         final int from, final int len){
42       return new TokenDecimal(cs.subSequence(from, from+len).toString());
43     }
44   };
45   /**
46    * Creates a Tokenizer that's gonna tokenize any valid decimal literal string to a TokenDecimal object.
47    * @return the Tokenizer instance.
48    */

49   public static Tokenizer getTokenizer(){return tn;}
50 }
51
Popular Tags