001package Torello.JavaDoc; 002 003import java.io.IOException; 004import java.util.Vector; 005 006import Torello.HTML.HTMLNode; 007 008import Torello.HTML.Tools.SyntaxHiLite.HiLiteCache; 009import Torello.HTML.Tools.SyntaxHiLite.PygmentsOrg; 010 011/** 012 * A simple Functional-Interface allowing a user to swap in any customized, alternate or 013 * proprietary Syntax HiLiter to replace the default HiLiter used by this Upgrader Tool. 014 * 015 * <BR /><BR /><EMBED CLASS='external-html' DATA-FILE-ID=HILITER> 016 */ 017@FunctionalInterface 018public interface HiLiter 019{ 020 /** 021 * This {@code Functional Interface} expects this method to be implemented. Any HiLiter that 022 * would be "plugged into" this Documentation Tool must be able to <B>Pretty-Print HiLite</B> 023 * input Source-Code (passed as a {@code java.lang.String}) <I>and return HTML</I>. 024 * 025 * <BR /><BR /><B>NOTE:</B> Any Code HiLiter that can operate with this input may be plugged 026 * in here. In order to "Vectorize" HTML, just use the 027 * {@code HTMLPage.getPageTokens(String, false)} method. 028 * 029 * @param code This is the Source-Code as a {@code java.lang.String} 030 * 031 * @param codeType This is a short descriptor of what kind of code is being passed. The most 032 * frequent values for this parameter are: {@code 'java', 'html', 'js'} etc... 033 * 034 * @param snippetOrComplete This is a {@code boolean} that when {@code TRUE}, indicates that 035 * a <B>code-snippet</B> has been passed, and when {@code FALSE} indicates that a <B>complete 036 * source code file</B> has been passed. 037 * 038 * @return The intention is to return a Vectorized-HTML page (or sub-page) that contains a 039 * <B>HiLited & Pretty-Printed</B> version of the source-code. 040 * 041 * @throws IOException This method is not defined, but it is permitted to throw 042 * {@code IOException} - if there have been I/O problems when attempting to transform the 043 * source-code. 044 * 045 * @throws HiLiteException This exception may be used if other problems occur during the 046 * transformation process. 047 */ 048 public Vector<HTMLNode> hiLite 049 (String code, String codeType, boolean snippetOrComplete) 050 throws IOException, HiLiteException; 051 052 /** 053 * The Default <B>Code HiLiter</B> uses the package 054 * {@code Torello.HTML.Tools.SyntaxHiLite}. 055 * 056 * @param cache This is the HiLiter-Cache that <I>may or may not be used</I>. If this parameter 057 * is passed {@code 'null'}, it will be ignored. 058 * 059 * @param snippetStyleCode Some of the source-code passed to this {@code HiLiter} will be 060 * short <I>code-snippets</I>, while other passed values of source-code will be <I>complete 061 * source-code files.</I> This {@code String} is the {@code 'Style Parameter'} used for 062 * code-snippets. 063 * 064 * <BR /><BR />You may view the complete-list of valid Style Parameters in use with this 065 * HiLiter with {@link PygmentsOrg#getStyleTypes()}. 066 * 067 * @param completeStyleCode When the {@code HiLiter} is asked to Hi-Lite and entire source 068 * code file, this parameter will be used for a {@code 'Style Parameter'} with the 069 * {@code HiLiter}. 070 * 071 * @return An instance of {@code HiLiter} that can be used by the {@code Upgrade} Tool 072 * 073 * @throws IllegalArgumentException If invalid Styling-Parameters were passed either to 074 * {@code 'snippetStyleCode'} or {@code 'completeStyleCode'}. 075 * 076 * @see PygmentsOrg#prettyPrintScrapeToVectorAndSimplify(String, String, String, boolean) 077 * @see PygmentsOrg#prettyPrintScrapeToVectorAndSimplify(String, String, String, boolean, HiLiteCache) 078 */ 079 public static HiLiter getDefault( 080 final HiLiteCache cache, 081 final String snippetStyleCode, 082 final String completeStyleCode 083 ) 084 { 085 return Torello.HTML.Tools.SyntaxHiLite.JDUExport.JDUHiLiter.getDefault 086 (cache, snippetStyleCode, completeStyleCode); 087 } 088 089}