1 | /*
|
---|
2 | * 10/28/2004
|
---|
3 | *
|
---|
4 | * TokenFactory.java - Interface for a class that generates tokens of some type.
|
---|
5 | *
|
---|
6 | * This library is distributed under a modified BSD license. See the included
|
---|
7 | * RSyntaxTextArea.License.txt file for details.
|
---|
8 | */
|
---|
9 | package org.fife.ui.rsyntaxtextarea;
|
---|
10 |
|
---|
11 | import javax.swing.text.Segment;
|
---|
12 |
|
---|
13 |
|
---|
14 | /**
|
---|
15 | * Interface for a class that generates tokens somehow.
|
---|
16 | *
|
---|
17 | * @author Robert Futrell
|
---|
18 | * @version 0.1
|
---|
19 | */
|
---|
20 | interface TokenFactory {
|
---|
21 |
|
---|
22 |
|
---|
23 | /**
|
---|
24 | * Returns a null token.
|
---|
25 | *
|
---|
26 | * @return A null token.
|
---|
27 | */
|
---|
28 | public Token createToken();
|
---|
29 |
|
---|
30 |
|
---|
31 | /**
|
---|
32 | * Returns a token.
|
---|
33 | *
|
---|
34 | * @param line The segment from which to get the token's text.
|
---|
35 | * @param beg The starting offset of the token's text in the segment.
|
---|
36 | * @param end The ending offset of the token's text in the segment.
|
---|
37 | * @param startOffset The offset in the document of the token.
|
---|
38 | * @param type The type of token.
|
---|
39 | * @return The token.
|
---|
40 | */
|
---|
41 | public Token createToken(final Segment line, final int beg,
|
---|
42 | final int end, final int startOffset, final int type);
|
---|
43 |
|
---|
44 |
|
---|
45 | /**
|
---|
46 | * Returns a token.
|
---|
47 | *
|
---|
48 | * @param line The char array from which to get the token's text.
|
---|
49 | * @param beg The starting offset of the token's text in the char array.
|
---|
50 | * @param end The ending offset of the token's text in the char array.
|
---|
51 | * @param startOffset The offset in the document of the token.
|
---|
52 | * @param type The type of token.
|
---|
53 | * @return The token.
|
---|
54 | */
|
---|
55 | public Token createToken(final char[] line, final int beg,
|
---|
56 | final int end, final int startOffset, final int type);
|
---|
57 |
|
---|
58 |
|
---|
59 | /**
|
---|
60 | * Resets the state of this token maker, if necessary.
|
---|
61 | * FIXME: Improve documentation.
|
---|
62 | */
|
---|
63 | public void resetAllTokens();
|
---|
64 |
|
---|
65 |
|
---|
66 | } |
---|