001/*license*\ 002 Codelet: Copyright (C) 2014, Jeff Epstein (aliteralmind __DASH__ github __AT__ yahoo __DOT__ com) 003 004 This software is dual-licensed under the: 005 - Lesser General Public License (LGPL) version 3.0 or, at your option, any later version; 006 - Apache Software License (ASL) version 2.0. 007 008 Either license may be applied at your discretion. More information may be found at 009 - http://en.wikipedia.org/wiki/Multi-licensing. 010 011 The text of both licenses is available in the root directory of this project, under the names "LICENSE_lgpl-3.0.txt" and "LICENSE_asl-2.0.txt". The latest copies may be downloaded at: 012 - LGPL 3.0: https://www.gnu.org/licenses/lgpl-3.0.txt 013 - ASL 2.0: http://www.apache.org/licenses/LICENSE-2.0.txt 014\*license*/ 015package com.github.aliteralmind.codelet.type; 016 import com.github.aliteralmind.codelet.CodeletType; 017 import com.github.aliteralmind.codelet.UserExtraGapGetter; 018 import com.github.aliteralmind.codelet.CodeletGap; 019 import com.github.aliteralmind.codelet.CodeletBaseConfig; 020 import com.github.aliteralmind.codelet.CodeletInstance; 021 import com.github.aliteralmind.codelet.TagletTextUtil; 022 import com.github.aliteralmind.templatefeather.FeatherTemplate; 023 import java.util.Map; 024 import java.util.Set; 025 import java.util.TreeMap; 026 import static com.github.xbn.lang.XbnConstants.*; 027/** 028 <p>The text into which {@code {@.codelet}} output (the example-code's source) is placed.</p> 029 030 <A NAME="gaps"></a><h2><a href="{@docRoot}/overview-summary.html#overview_description"><IMG SRC="{@docRoot}/resources/up_arrow.gif"/></a> Codelet: {@code {@.codelet}}: Template: <u>Gap names</u></h2> 031 032 <p>The only required gap is "{@link #BODY_GAP_NAME body}", which is where the fully-processed source-code is placed.</p> 033 034 <p>In addition to any {@linkplain com.github.aliteralmind.codelet.UserExtraGapGetter#getForCodeletDotOut() user-extra} gaps, the {@code {@.codelet}} template also provides for the following "default" optional gaps:</p> 035 036 <p><TABLE ALIGN="center" BORDER="1" CELLSPACING="0" CELLPADDING="4" BGCOLOR="#EEEEEE"><TR ALIGN="center" VALIGN="middle"> 037 <TD><b><u>Name</u></b></TD> 038 <TD><b><u>Description</u></b></TD> 039 </TR><TR> 040 <TD>{@link #GAP_COMMAND_LINE_PARAMS command_line_params}</TD> 041 <TD>Parameters as passed to the example code's main function.</TD> 042 </TR><TR> 043 <TD>{@link com.github.aliteralmind.codelet.type.SourceCodeTemplate#GAP_SIMPLE_CLASS_NAME simple_class_name}*</TD> 044 <TD>The example code's non-fully-qualified class name.</TD> 045 </TR><TR> 046 <TD>{@link com.github.aliteralmind.codelet.type.SourceCodeTemplate#GAP_FQ_CLASS_NAME fq_class_name}*</TD> 047 <TD>The example code's fully-qualified class name.</TD> 048 </TR><TR> 049 <TD>{@link com.github.aliteralmind.codelet.type.SourceCodeTemplate#GAP_PACKAGE package}*</TD> 050 <TD>The example code's package name.</TD> 051 </TR></TABLE></p> 052 053 * @since 0.1.0 054 * @author Copyright (C) 2014, Jeff Epstein ({@code aliteralmind __DASH__ github __AT__ yahoo __DOT__ com}), dual-licensed under the LGPL (version 3.0 or later) or the ASL (version 2.0). See source code for details. <a href="http://codelet.aliteralmind.com">{@code http://codelet.aliteralmind.com}</a>, <a href="https://github.com/aliteralmind/codelet">{@code https://github.com/aliteralmind/codelet}</a> 055 **/ 056public class ConsoleOutTemplate extends OnlyOneBodyGapTemplateBase { 057 /** 058 <p>Parameters as passed to the example code's main function--Name is {@code "command_line_params"}.</p> 059 060 061 <p>Gap is {@linkplain com.github.aliteralmind.codelet.CodeletGap#getFillText(CodeletInstance) filled} with</p> 062 063<blockquote><pre>................</pre></blockquote> 064 065 * @see <a href="#gaps"><IMG SRC="{@docRoot}/resources/up_arrow.gif"/></a> 066 */ 067 public static final CodeletGap GAP_COMMAND_LINE_PARAMS = new CmdLineParamsGap(); 068 /** 069 <p>Create the first instance.</p> 070 071 * <p>Equal to</p> 072 073<blockquote><pre>{@link com.github.aliteralmind.codelet.type.OnlyOneBodyGapTemplateBase#OnlyOneBodyGapTemplateBase(CodeletType, FeatherTemplate, String, CodeletGap[], UserExtraGapGetter) super}({@link com.github.aliteralmind.codelet.CodeletType CodeletType}.{@link com.github.aliteralmind.codelet.CodeletType#SOURCE_CODE SOURCE_CODE}, template, tmpl_path, 074 new CodeletGap[] { 075 {@link com.github.aliteralmind.codelet.type.SourceCodeTemplate SourceCodeTemplate}.{@link com.github.aliteralmind.codelet.type.SourceCodeTemplate#GAP_PACKAGE GAP_PACKAGE}, 076 SourceCodeTemplate.{@link com.github.aliteralmind.codelet.type.SourceCodeTemplate#GAP_SIMPLE_CLASS_NAME GAP_SIMPLE_CLASS_NAME}, 077 SourceCodeTemplate.{@link com.github.aliteralmind.codelet.type.SourceCodeTemplate#GAP_FQ_CLASS_NAME GAP_FQ_CLASS_NAME}, 078 {@link #GAP_COMMAND_LINE_PARAMS}}, 079 userExtra_getter)</pre></blockquote> 080 * @see #ConsoleOutTemplate(ConsoleOutTemplate, FeatherTemplate, String) 081 */ 082 public ConsoleOutTemplate(FeatherTemplate template, String tmpl_path, UserExtraGapGetter userExtra_getter) { 083 super(CodeletType.SOURCE_CODE, template, tmpl_path, 084 new CodeletGap[] { 085 SourceCodeTemplate.GAP_PACKAGE, 086 SourceCodeTemplate.GAP_SIMPLE_CLASS_NAME, 087 SourceCodeTemplate.GAP_FQ_CLASS_NAME, 088 GAP_COMMAND_LINE_PARAMS}, 089 userExtra_getter); 090 } 091 /** 092 <p>Create the second or subsequent instance.</p> 093 094 * <p>Equal to</p> 095 096<blockquote><pre>{@link com.github.aliteralmind.codelet.type.OnlyOneBodyGapTemplateBase#OnlyOneBodyGapTemplateBase(OnlyOneBodyGapTemplateBase, FeatherTemplate, String) super}(to_copy, template, tmpl_path)</pre></blockquote> 097 098 * @see #ConsoleOutTemplate(FeatherTemplate, String, UserExtraGapGetter) 099 */ 100 public ConsoleOutTemplate(ConsoleOutTemplate to_copy, FeatherTemplate template, String tmpl_path) { 101 super(to_copy, template, tmpl_path); 102 } 103 public ConsoleOutTemplate(ConsoleOutTemplate to_copy, Appendable debugDest_ifNonNull) { 104 super(to_copy, debugDest_ifNonNull); 105 } 106 public ConsoleOutTemplate fillBody(String fully_processed) { 107 fillBodyGap(fully_processed); 108 return this; 109 } 110 /** 111 <p>Duplicate this template.</p> 112 113 * @return <code>(new {@link #ConsoleOutTemplate(ConsoleOutTemplate, Appendable) ConsoleOutTemplate}(this, debugDest_ifNonNull))</code> 114 */ 115 public ConsoleOutTemplate getObjectCopy(Appendable debugDest_ifNonNull) { 116 return (new ConsoleOutTemplate(this, debugDest_ifNonNull)); 117 } 118 public static final ConsoleOutTemplate newFromPathAndUserExtraGaps(String path, String path_name, UserExtraGapGetter userExtra_getter) { 119 return (new ConsoleOutTemplate(newTemplateFromPath(path, path_name), path, userExtra_getter)); 120 } 121} 122class CmdLineParamsGap extends CodeletGap { 123 public CmdLineParamsGap() { 124 super("command_line_params"); 125 } 126 public String getFillText(CodeletInstance instance) { 127 return "CmdLineParamsGap.getFillText(ci): FIX ME!"; 128 } 129}