initial contribution
[phpeclipse.git] / archive / org.plog4u.wiki / src / org / plog4u / wiki / macro / code / JavaCodeFilter.java
1 /*
2  * 
3  * Please visit http://radeox.org/ for updates and contact.
4  * 
5  * --LICENSE NOTICE-- This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser
6  * General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any
7  * later version.
8  * 
9  * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
11  * 
12  * You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free
13  * Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA --LICENSE NOTICE--
14  */
15
16 package org.plog4u.wiki.macro.code;
17
18 import java.util.HashMap;
19 import java.util.HashSet;
20
21 import org.radeox.macro.code.SourceCodeFormatter;
22
23 /**
24  * Java CodeFilter colourizes C# source code
25  *  
26  */
27 public class JavaCodeFilter extends AbstractCPPBasedCodeFilter implements SourceCodeFormatter {
28
29   private static HashMap KEYWORD_SET = new HashMap();
30
31   private static final String[] KEYWORDS =
32     {
33       "class",
34       "abstract",
35       "break",
36       "byvalue",
37       "case",
38       "cast",
39       "catch",
40       "const",
41       "continue",
42       "default",
43       "do",
44       "else",
45       "extends",
46       "false",
47       "final",
48       "finally",
49       "for",
50       "future",
51       "generic",
52       "goto",
53       "if",
54       "implements",
55       "import",
56       "inner",
57       "instanceof",
58       "interface",
59       "native",
60       "new",
61       "null",
62       "operator",
63       "outer",
64       "package",
65       "private",
66       "protected",
67       "public",
68       "rest",
69       "return",
70       "static",
71       "super",
72       "switch",
73       "synchronized",
74       "this",
75       "throw",
76       "throws",
77       "transient",
78       "true",
79       "try",
80       "var",
81       "volatile",
82       "while",
83       "assert",
84       "enum" };
85
86   private static final String[] OBJECT_WORDS =
87     {
88       "Boolean",
89       "Byte",
90       "Character",
91       "Class",
92       "ClassLoader",
93       "Cloneable",
94       "Compiler",
95       "Double",
96       "Float",
97       "Integer",
98       "Long",
99       "Math",
100       "Number",
101       "Object",
102       "Process",
103       "Runnable",
104       "Runtime",
105       "SecurityManager",
106       "Short",
107       "String",
108       "StringBuffer",
109       "System",
110       "Thread",
111       "ThreadGroup",
112       "Void",
113       "boolean",
114       "char",
115       "byte",
116       "short",
117       "int",
118       "long",
119       "float",
120       "double",
121       "void"};
122
123   private static HashSet OBJECT_SET = new HashSet();
124
125   {
126     for (int i = 0; i < KEYWORDS.length; i++) {
127       //KEYWORD_SET.put(KEYWORDS[i], ""+KEYWORDS[i]+"");
128       createHashMap(KEYWORD_SET, KEYWORDS[i]);
129     }
130     for (int i = 0; i < OBJECT_WORDS.length; i++) {
131       OBJECT_SET.add(OBJECT_WORDS[i]);
132     }
133   }
134
135   public JavaCodeFilter() {
136   }
137
138   /**
139    * @return Returns the KEYWORD_SET.
140    */
141   public HashMap getKeywordSet() {
142     return KEYWORD_SET;
143   }
144
145   public String getName() {
146     return "java";
147   }
148
149   /**
150    * @return Returns the OBJECT_SET.
151    */
152   public HashSet getObjectSet() {
153     return OBJECT_SET;
154   }
155
156 }