KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > jfun > parsec > PositionedToken


1 package jfun.parsec;
2
3
4 /**
5  * This class carries the position information of a token.
6  * @deprecated Use {@link Tok} instead.
7  * @author Ben Yu
8  *
9  * 2004-11-7
10  */

11 public class PositionedToken implements java.io.Serializable JavaDoc{
12   private final int ind;
13   private final int len;
14   private final Object JavaDoc tok;
15   
16   /**
17    * Gets the length of the token.
18    * @return the length of the token.
19    */

20   public int getLength(){
21     return len;
22   }
23   /**
24    * gets the index of the token in the orginal CharSequence.
25    * @return the index.
26    */

27   public int getIndex(){return ind;}
28   /**
29    * gets the token.
30    * @return the token.
31    */

32   public Object JavaDoc getToken(){return tok;}
33
34   /**
35    * Create a PositionedToken object.
36    * @param i the starting index.
37    * @param l the length of the token.
38    * @param tok the token.
39    */

40   public PositionedToken(final int i, final int l, final Object JavaDoc tok) {
41     this.ind = i;
42     this.len = l;
43     this.tok = tok;
44   }
45   public String JavaDoc toString(){
46     return tok.toString();
47   }
48 }
49
Popular Tags