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.UserExtraGapGetter; 017 import com.github.aliteralmind.codelet.CodeletType; 018 import com.github.aliteralmind.codelet.CodeletGap; 019 import com.github.aliteralmind.codelet.CodeletTemplateBase; 020 import com.github.aliteralmind.templatefeather.FeatherTemplate; 021/** 022 <p>The text into which {@code {@.codelet.and.out}} output (the example-code's console output) is placed.</p> 023 024 <A NAME="gaps"></a><h2><a href="{@docRoot}/com/github/aliteralmind/codelet/CodeletTemplateBase.html"><IMG SRC="{@docRoot}/resources/up_arrow.gif"/></a> Codelet: {@code {@.codelet.and.out}}: Template: <u>Gap names</u></h2> 025 026 <p>The only required gaps are "{@link #GAP_BODY_SOURCE_CODE body_source_code}" and "{@link #GAP_BODY_CONSOLE_OUTPUT body_console_output}", which are where the fully-processed source and output are placed.</p> 027 028 <p>In addition to any {@linkplain com.github.aliteralmind.codelet.UserExtraGapGetter#getForCodeletAndOut() user-extra} gaps {@code {@.codelet.and.out}} template provides for the same "default" optional gaps as made available in <i>both</i> {@link com.github.aliteralmind.codelet.type.SourceCodeTemplate} and {@link com.github.aliteralmind.codelet.type.SourceAndOutTemplate}.</p> 029 030 * @since 0.1.0 031 * @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> 032 **/ 033public class SourceAndOutTemplate extends CodeletTemplateBase { 034 /** 035 <p>The gap name for the fully processed source-code, which is one of two gaps required to exist in the template--equal to {@code "body_source_code"}.</p> 036 037 * @see <a href="#gaps"><IMG SRC="{@docRoot}/resources/up_arrow.gif"/></a> 038 * @see #GAP_BODY_CONSOLE_OUTPUT 039 * @see #fillBodyGap(String, String) 040 */ 041 public static final String GAP_BODY_SOURCE_CODE = "body_source_code"; 042 /** 043 <p>The gap name for the fully processed console output, which is one of two gaps required to exist in the template--equal to {@code "body_console_output"}.</p> 044 045 * @see <a href="#gaps"><IMG SRC="{@docRoot}/resources/up_arrow.gif"/></a> 046 * @see #GAP_BODY_SOURCE_CODE 047 * @see #fillBodyGap(String, String) 048 */ 049 public static final String GAP_BODY_CONSOLE_OUTPUT = "body_console_output"; 050 /** 051 <p>Create the first instance.</p> 052 053 * <p>Equal to</p> 054 055<blockquote><pre> 056{@link com.github.aliteralmind.codelet.CodeletTemplateBase#CodeletTemplateBase(CodeletType, FeatherTemplate, String, String[], CodeletGap[], UserExtraGapGetter) super}({@link com.github.aliteralmind.codelet.CodeletType CodeletType}.{@link com.github.aliteralmind.codelet.CodeletType#SOURCE_AND_OUT SOURCE_AND_OUT}, template, tmpl_path 057 new String[]{{@link #GAP_BODY_SOURCE_CODE}, {@link #GAP_BODY_CONSOLE_OUTPUT}}, 058 new CodeletGap[] { 059 {@link com.github.aliteralmind.codelet.type.SourceCodeTemplate ConsoleOutTemplate.GAP_COMMAND_LINE_PARAMS}.{@link com.github.aliteralmind.codelet.type.ConsoleOutTemplate#GAP_COMMAND_LINE_PARAMS GAP_COMMAND_LINE_PARAMS}, 060 {@link com.github.aliteralmind.codelet.type.SourceCodeTemplate}.{@link com.github.aliteralmind.codelet.type.SourceCodeTemplate#GAP_FQ_CLASS_NAME GAP_FQ_CLASS_NAME}, 061 SourceCodeTemplate.{@link com.github.aliteralmind.codelet.type.SourceCodeTemplate#GAP_FQ_CLASS_NAME_DIR GAP_FQ_CLASS_NAME_DIR}, 062 SourceCodeTemplate.{@link com.github.aliteralmind.codelet.type.SourceCodeTemplate#GAP_FQ_CLASS_NAME_URL GAP_FQ_CLASS_NAME_URL}, 063 SourceCodeTemplate.{@link com.github.aliteralmind.codelet.type.SourceCodeTemplate#GAP_JAVADOC_URL GAP_JAVADOC_URL}, 064 SourceCodeTemplate.{@link com.github.aliteralmind.codelet.type.SourceCodeTemplate#GAP_PACKAGE GAP_PACKAGE}, 065 SourceCodeTemplate.{@link com.github.aliteralmind.codelet.type.SourceCodeTemplate#GAP_PACKAGE_DIR GAP_PACKAGE_DIR}, 066 SourceCodeTemplate.{@link com.github.aliteralmind.codelet.type.SourceCodeTemplate#GAP_PACKAGE_URL GAP_PACKAGE_URL}, 067 SourceCodeTemplate.{@link com.github.aliteralmind.codelet.type.SourceCodeTemplate#GAP_SIMPLE_CLASS_NAME GAP_SIMPLE_CLASS_NAME}, 068 SourceCodeTemplate.{@link com.github.aliteralmind.codelet.type.SourceCodeTemplate#GAP_SOURCE_URL GAP_SOURCE_URL}, 069 SourceCodeTemplate.{@link com.github.aliteralmind.codelet.type.SourceCodeTemplate#GAP_SRC_BASE_DIR GAP_SRC_BASE_DIR}, 070 SourceCodeTemplate.{@link com.github.aliteralmind.codelet.type.SourceCodeTemplate#GAP_SRC_PATH GAP_SRC_PATH}}, 071 userExtra_getter) 072</pre></blockquote> 073 074 * @see #SourceAndOutTemplate(SourceAndOutTemplate, FeatherTemplate, String) 075 */ 076 public SourceAndOutTemplate(FeatherTemplate template, String tmpl_path, UserExtraGapGetter userExtra_getter) { 077 super(CodeletType.SOURCE_AND_OUT, template, tmpl_path, 078 new String[]{GAP_BODY_SOURCE_CODE, GAP_BODY_CONSOLE_OUTPUT}, 079 new CodeletGap[] { 080 ConsoleOutTemplate.GAP_COMMAND_LINE_PARAMS, 081 SourceCodeTemplate.GAP_FQ_CLASS_NAME, 082 SourceCodeTemplate.GAP_FQ_CLASS_NAME_DIR, 083 SourceCodeTemplate.GAP_FQ_CLASS_NAME_URL, 084 SourceCodeTemplate.GAP_JAVADOC_URL, 085 SourceCodeTemplate.GAP_PACKAGE, 086 SourceCodeTemplate.GAP_PACKAGE_DIR, 087 SourceCodeTemplate.GAP_PACKAGE_URL, 088 SourceCodeTemplate.GAP_SIMPLE_CLASS_NAME, 089 SourceCodeTemplate.GAP_SOURCE_URL, 090 SourceCodeTemplate.GAP_SRC_BASE_DIR, 091 SourceCodeTemplate.GAP_SRC_PATH}, 092 userExtra_getter); 093 } 094 /** 095 <p>Create the second or subsequent instance.</p> 096 097 * <p>Equal to</p> 098 099<blockquote><pre>{@link com.github.aliteralmind.codelet.CodeletTemplateBase#CodeletTemplateBase(CodeletTemplateBase, FeatherTemplate, String) super}(to_copy, template, tmpl_path)</pre></blockquote> 100 101 * @see #SourceAndOutTemplate(FeatherTemplate, String, UserExtraGapGetter) 102 */ 103 public SourceAndOutTemplate(SourceAndOutTemplate to_copy, FeatherTemplate template, String tmpl_path) { 104 super(to_copy, template, tmpl_path); 105 } 106 public SourceAndOutTemplate(SourceAndOutTemplate to_copy, Appendable debugDest_ifNonNull) { 107 super(to_copy, debugDest_ifNonNull); 108 } 109 /** 110 <p>Fill the fully-processed source-code body gap.</p> 111 112 * <p>Equal to</p> 113 114<blockquote><pre>{@link com.github.aliteralmind.codelet.CodeletTemplateBase#fillBodyGap(String, String) fillBodyGap}({@link #GAP_BODY_SOURCE_CODE}, body_text)*</pre></blockquote> 115 116 * @see #fillConsoleOutputBody(String) 117 */ 118 public final SourceAndOutTemplate fillSourceCodeBody(String body_text) { 119 fillBodyGap(GAP_BODY_SOURCE_CODE, body_text); 120 return this; 121 } 122 /** 123 <p>Fill the fully-processed console-output body gap.</p> 124 125 * <p>Equal to</p> 126 127<blockquote><pre>{@link com.github.aliteralmind.codelet.CodeletTemplateBase#fillBodyGap(String, String) fillBodyGap}*({@link #GAP_BODY_CONSOLE_OUTPUT}, body_text)</pre></blockquote> 128 129 * @see #fillSourceCodeBody(String) 130 */ 131 public final SourceAndOutTemplate fillConsoleOutputBody(String body_text) { 132 fillBodyGap(GAP_BODY_CONSOLE_OUTPUT, body_text); 133 return this; 134 } 135 /** 136 <p>Duplicate this template.</p> 137 138 * @return <code>(new {@link #SourceAndOutTemplate(SourceAndOutTemplate, Appendable) SourceAndOutTemplate}(this, debugDest_ifNonNull))</code> 139 */ 140 public SourceAndOutTemplate getObjectCopy(Appendable debugDest_ifNonNull) { 141 return (new SourceAndOutTemplate(this, debugDest_ifNonNull)); 142 } 143 public static final SourceAndOutTemplate newFromPathAndUserExtraGaps(String path, String path_name, UserExtraGapGetter userExtra_getter) { 144 return (new SourceAndOutTemplate(newTemplateFromPath(path, path_name), path, userExtra_getter)); 145 } 146 public static final FeatherTemplate newTemplateFromPath(String path, String path_name) { 147 return CodeletTemplateBase.newTemplateFromPath(path, path_name, GAP_BODY_SOURCE_CODE, GAP_BODY_CONSOLE_OUTPUT); 148 } 149}