xbn.template.util
Class UtilTemplate

java.lang.Object
  |
  +--xbn.XBNObject
        |
        +--xbn.template.util.UtilTemplate

public class UtilTemplate
extends XBNObject

Random functions related to Templates.

Source code:  UtilTemplate.java.


Fields inherited from class xbn.XBNObject
bFALSE_IN_PRODUCTION, bTRUE_IN_PRODUCTION, sCNSTR, sES, sLINE_SEP
 
Constructor Summary
UtilTemplate()
          Create a UtilTemplate.
 
Method Summary
 i_i addUnqGapNamesToACS(VWString vws_uniqueGaps, ForLineRetrieval flr_srcTxt, GapConfig gap_config, Outputter optr_dbg)
          Add all the unique gap names found in the source text to the VWString.
 String[] getAOSUniqueGapNames(ForLineRetrieval flr_srcTxt, GapConfig gap_config, Outputter optr_dbg)
          Get all the unique gap names that exist in the provided source text, or null if no gaps exist.
 String getFilled1GapTString(String s_templateWithOneGap, String s_fillText)
          Get the resulting string, after filling in the single gap, existing in the provided template string.
 String getFilledXGapsTString(int i_rqdUniqueGaps, String s_templateWithXGaps, String[] as_fillText)
          Get the resulting string, after filling in the gaps existing in the provided template string.
 String getOriginalText(Template t_emplate)
          Want to see the original text, as it existed before it was parsed?
 String getOriginalText(TemplateData template_data)
          Want to see the original text, as it existed before it was parsed?
 s_s[] getRecursivelyFilled(TDOSArray tdosa_recursive)
          Recursively fill a set of templates, and get the resulting name/value in a placeholder.s_s object (name=s1, value=s2).
 
Methods inherited from class xbn.XBNObject
getXMsgPrefix, sop, sopl, sopl, throwAX, throwAXIfBadStr, throwAXIfNull, throwAXSpoof
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UtilTemplate

public UtilTemplate()

Create a UtilTemplate. This constructor does nothing.

Method Detail

getAOSUniqueGapNames

public final String[] getAOSUniqueGapNames(ForLineRetrieval flr_srcTxt,
                                           GapConfig gap_config,
                                           Outputter optr_dbg)

Get all the unique gap names that exist in the provided source text, or null if no gaps exist.

See addUnqGapNamesToACS


addUnqGapNamesToACS

public final i_i addUnqGapNamesToACS(VWString vws_uniqueGaps,
                                     ForLineRetrieval flr_srcTxt,
                                     GapConfig gap_config,
                                     Outputter optr_dbg)

Add all the unique gap names found in the source text to the VWString.

This creates a new TemplateDataOrString with the following constructor parameters:

(null, flr_srcTxt, (new TParseConfig(gap_config, true, optr_dbg)))

Parameters:
vws_uniqueGaps - The VWString to add to. If null, a new VWString is created. How convenient is that? This parameter is manipulated by this function. It...
  • ...is left unaltered, if there are no gaps in the source text, or if there are gaps in the source text, but every one already exists in vws_uniqueGaps.
  • ...has any unique gaps existing in the source text to the VWString.
Returns:
An i_i Where i1 equals the number of unique gap names added to vws_uniqueGaps, and i2 is the number of absolute gaps existing in flr_srcTxt.

getFilled1GapTString

public final String getFilled1GapTString(String s_templateWithOneGap,
                                         String s_fillText)

Get the resulting string, after filling in the single gap, existing in the provided template string.

Equal to getFilledXGapsTString(1, s_templateWithOneGap, (new String[] {s_fillText}))


getFilledXGapsTString

public final String getFilledXGapsTString(int i_rqdUniqueGaps,
                                          String s_templateWithXGaps,
                                          String[] as_fillText)

Get the resulting string, after filling in the gaps existing in the provided template string.

Parameters:
i_rqdUniqueGaps - The number of gaps required to exist in s_templateWithXGaps. Must be greater than zero.
s_templateWithXGaps - The template source text. Must be non null, and contain exactly i_rqdUniqueGaps gaps. All gap names are surrounded with tag delimiters which, by default, are TConfigDefaults.getTagTxtStart and TConfigDefaults.getTagTxtEnd.
as_fillText - The array of strings containing the text to fill into the unique gaps in s_templateWithXGaps. Must be valid according to AOOValid.crashIfBad, and its length must equal i_rqdUniqueGaps.
Throws:
AssertException - If a TemplateFormatException is thrown when parsing s_templateWithXGaps, for any reason.

getOriginalText

public final String getOriginalText(Template t_emplate)

Want to see the original text, as it existed before it was parsed?


getOriginalText

public final String getOriginalText(TemplateData template_data)

Want to see the original text, as it existed before it was parsed?


getRecursivelyFilled

public final s_s[] getRecursivelyFilled(TDOSArray tdosa_recursive)

Recursively fill a set of templates, and get the resulting name/value in a placeholder.s_s object (name=s1, value=s2).

At least one element must be a string, which is the "seed" to prevent circular fills. Every gap must be the name of an existing template/string (except itself). There must be at least one gap in at least one Template.

Example code  XmplRecursiveFill.java




Copyright 1997-2003, Jeff Epstein, All Rights Reserved. See top of source code files for copyright notice.

 

http://sourceforge.net/projects/xbnjava

 

SourceForge.net Logo