/* * * Please visit http://radeox.org/ for updates and contact. * * --LICENSE NOTICE-- This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser * General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any * later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free * Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA --LICENSE NOTICE-- */ package org.plog4u.wiki.macro.code; import java.util.HashMap; import java.util.HashSet; import org.radeox.macro.code.SourceCodeFormatter; /** * Java CodeFilter colourizes C# source code * */ public class JavaCodeFilter extends AbstractCPPBasedCodeFilter implements SourceCodeFormatter { private static HashMap KEYWORD_SET = new HashMap(); private static final String[] KEYWORDS = { "class", "abstract", "break", "byvalue", "case", "cast", "catch", "const", "continue", "default", "do", "else", "extends", "false", "final", "finally", "for", "future", "generic", "goto", "if", "implements", "import", "inner", "instanceof", "interface", "native", "new", "null", "operator", "outer", "package", "private", "protected", "public", "rest", "return", "static", "super", "switch", "synchronized", "this", "throw", "throws", "transient", "true", "try", "var", "volatile", "while", "assert", "enum" }; private static final String[] OBJECT_WORDS = { "Boolean", "Byte", "Character", "Class", "ClassLoader", "Cloneable", "Compiler", "Double", "Float", "Integer", "Long", "Math", "Number", "Object", "Process", "Runnable", "Runtime", "SecurityManager", "Short", "String", "StringBuffer", "System", "Thread", "ThreadGroup", "Void", "boolean", "char", "byte", "short", "int", "long", "float", "double", "void"}; private static HashSet OBJECT_SET = new HashSet(); { for (int i = 0; i < KEYWORDS.length; i++) { //KEYWORD_SET.put(KEYWORDS[i], ""+KEYWORDS[i]+""); createHashMap(KEYWORD_SET, KEYWORDS[i]); } for (int i = 0; i < OBJECT_WORDS.length; i++) { OBJECT_SET.add(OBJECT_WORDS[i]); } } public JavaCodeFilter() { } /** * @return Returns the KEYWORD_SET. */ public HashMap getKeywordSet() { return KEYWORD_SET; } public String getName() { return "java"; } /** * @return Returns the OBJECT_SET. */ public HashSet getObjectSet() { return OBJECT_SET; } }