KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > JFlex > CharClassInterval


1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
2  * JFlex 1.4.1 *
3  * Copyright (C) 1998-2004 Gerwin Klein <lsf@jflex.de> *
4  * All rights reserved. *
5  * *
6  * This program is free software; you can redistribute it and/or modify *
7  * it under the terms of the GNU General Public License. See the file *
8  * COPYRIGHT for more information. *
9  * *
10  * This program is distributed in the hope that it will be useful, *
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13  * GNU General Public License for more details. *
14  * *
15  * You should have received a copy of the GNU General Public License along *
16  * with this program; if not, write to the Free Software Foundation, Inc., *
17  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
18  * *
19  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

20
21 package JFlex;
22
23 /**
24  * Stores an interval of characters together with the character class
25  *
26  * A character belongs to an interval, if its Unicode value is greater than or equal
27  * to the Unicode value of <CODE>start</code> and smaller than or euqal to the Unicode
28  * value of <CODE>end</code>.
29  *
30  * All characters of the interval must belong to the same character class.
31  *
32  * @author Gerwin Klein
33  * @version JFlex 1.4.1, $Revision: 2.3 $, $Date: 2004/11/06 23:03:30 $
34  */

35 public class CharClassInterval {
36
37   /**
38    * The first character of the interval
39    */

40   int start;
41
42   /**
43    * The last character of the interval
44    */

45   int end;
46
47   /**
48    * The code of the class all characters of this interval belong to.
49    */

50   int charClass;
51   
52
53   /**
54    * Creates a new CharClassInterval from <CODE>start</code> to <CODE>end</code>
55    * that belongs to character class <CODE>charClass</code>.
56    *
57    * @param start The first character of the interval
58    * @param end The last character of the interval
59    * @param charClass The code of the class all characters of this interval belong to.
60    */

61   public CharClassInterval(int start, int end, int charClass) {
62     this.start = start;
63     this.end = end;
64     this.charClass = charClass;
65   }
66
67   /**
68    * returns string representation of this class interval
69    */

70   public String JavaDoc toString() {
71     return "["+start+"-"+end+"="+charClass+"]";
72   }
73 }
74
Popular Tags