|
22 | 22 | */ |
23 | 23 | public class SyntaxUtilities { |
24 | 24 |
|
25 | | - /** |
26 | | - * Checks if a subregion of a <code>Segment</code> is equal to a |
27 | | - * string. |
28 | | - * @param ignoreCase True if case should be ignored, false otherwise |
29 | | - * @param text The segment |
30 | | - * @param offset The offset into the segment |
31 | | - * @param match The string to match |
32 | | - */ |
33 | | - public static boolean regionMatches(boolean ignoreCase, Segment text, |
34 | | - int offset, String match) { |
35 | | - int length = offset + match.length(); |
36 | | - char[] textArray = text.array; |
37 | | - if(length > text.offset + text.count) |
38 | | - return false; |
39 | | - for(int i = offset, j = 0; i < length; i++, j++) |
40 | | - { |
41 | | - char c1 = textArray[i]; |
42 | | - char c2 = match.charAt(j); |
43 | | - if(ignoreCase) |
44 | | - { |
45 | | - c1 = Character.toUpperCase(c1); |
46 | | - c2 = Character.toUpperCase(c2); |
47 | | - } |
48 | | - if(c1 != c2) |
49 | | - return false; |
50 | | - } |
51 | | - return true; |
52 | | - } |
53 | | - |
54 | | - |
55 | | - /** |
56 | | - * Checks if a subregion of a <code>Segment</code> is equal to a |
57 | | - * character array. |
58 | | - * @param ignoreCase True if case should be ignored, false otherwise |
59 | | - * @param text The segment |
60 | | - * @param offset The offset into the segment |
61 | | - * @param match The character array to match |
62 | | - */ |
63 | | - public static boolean regionMatches(boolean ignoreCase, Segment text, |
64 | | - int offset, char[] match) { |
65 | | - int length = offset + match.length; |
66 | | - char[] textArray = text.array; |
67 | | - if(length > text.offset + text.count) |
68 | | - return false; |
69 | | - for(int i = offset, j = 0; i < length; i++, j++) |
70 | | - { |
71 | | - char c1 = textArray[i]; |
72 | | - char c2 = match[j]; |
73 | | - if(ignoreCase) |
74 | | - { |
75 | | - c1 = Character.toUpperCase(c1); |
76 | | - c2 = Character.toUpperCase(c2); |
77 | | - } |
78 | | - if(c1 != c2) |
79 | | - return false; |
80 | | - } |
81 | | - return true; |
82 | | - } |
| 25 | +// /** |
| 26 | +// * Checks if a subregion of a <code>Segment</code> is equal to a |
| 27 | +// * string. |
| 28 | +// * @param ignoreCase True if case should be ignored, false otherwise |
| 29 | +// * @param text The segment |
| 30 | +// * @param offset The offset into the segment |
| 31 | +// * @param match The string to match |
| 32 | +// */ |
| 33 | +// public static boolean regionMatches(boolean ignoreCase, Segment text, |
| 34 | +// int offset, String match) { |
| 35 | +// int length = offset + match.length(); |
| 36 | +// char[] textArray = text.array; |
| 37 | +// if(length > text.offset + text.count) |
| 38 | +// return false; |
| 39 | +// for(int i = offset, j = 0; i < length; i++, j++) |
| 40 | +// { |
| 41 | +// char c1 = textArray[i]; |
| 42 | +// char c2 = match.charAt(j); |
| 43 | +// if(ignoreCase) |
| 44 | +// { |
| 45 | +// c1 = Character.toUpperCase(c1); |
| 46 | +// c2 = Character.toUpperCase(c2); |
| 47 | +// } |
| 48 | +// if(c1 != c2) |
| 49 | +// return false; |
| 50 | +// } |
| 51 | +// return true; |
| 52 | +// } |
83 | 53 |
|
84 | 54 |
|
85 | 55 | // /** |
@@ -107,50 +77,7 @@ public static boolean regionMatches(boolean ignoreCase, Segment text, |
107 | 77 | // } |
108 | 78 |
|
109 | 79 |
|
110 | | - /** |
111 | | - * Paints the specified line onto the graphics context. Note that this |
112 | | - * method munges the offset and count values of the segment. |
113 | | - * @param line The line segment |
114 | | - * @param tokens The token list for the line |
115 | | - * @param styles The syntax style list |
116 | | - * @param expander The tab expander used to determine tab stops. May |
117 | | - * be null |
118 | | - * @param gfx The graphics context |
119 | | - * @param x The x co-ordinate |
120 | | - * @param y The y co-ordinate |
121 | | - * @return The x co-ordinate, plus the width of the painted string |
122 | | - */ |
123 | | - public static int paintSyntaxLine(Segment line, Token tokens, |
124 | | - SyntaxStyle[] styles, |
125 | | - TabExpander expander, Graphics gfx, |
126 | | - int x, int y) { |
127 | | - Font defaultFont = gfx.getFont(); |
128 | | - Color defaultColor = gfx.getColor(); |
129 | | - |
130 | | - for (;;) { |
131 | | - byte id = tokens.id; |
132 | | - if(id == Token.END) |
133 | | - break; |
134 | | - |
135 | | - int length = tokens.length; |
136 | | - if (id == Token.NULL) { |
137 | | - if(!defaultColor.equals(gfx.getColor())) |
138 | | - gfx.setColor(defaultColor); |
139 | | - if(!defaultFont.equals(gfx.getFont())) |
140 | | - gfx.setFont(defaultFont); |
141 | | - } else { |
142 | | - styles[id].setGraphicsFlags(gfx,defaultFont); |
143 | | - } |
144 | | - line.count = length; |
145 | | - x = Utilities.drawTabbedText(line,x,y,gfx,expander,0); |
146 | | - line.offset += length; |
147 | | - |
148 | | - tokens = tokens.next; |
149 | | - } |
150 | | - |
151 | | - return x; |
152 | | - } |
153 | 80 |
|
154 | 81 | // private members |
155 | | - private SyntaxUtilities() {} |
| 82 | +// private SyntaxUtilities() {} |
156 | 83 | } |
0 commit comments