xbn.template
Class TemplateOrderedGaps

java.lang.Object
  |
  +--xbn.XBNObject
        |
        +--xbn.template.Template
              |
              +--xbn.template.TemplateOrderedGaps
All Implemented Interfaces:
Named
Direct Known Subclasses:
TOGOne, TOGThree, TOGTwo

public class TemplateOrderedGaps
extends Template

A Template that has a specific set of unique gaps.

Source code:  TemplateOrderedGaps.java.

When you require that the Template has a specific set of unique gaps in it, use this to enforce it. This also allows TemplateFiller to "consider" these unique gaps in a certain order, even if they happen to be in a completely different order in the template text file.

See TemplateFiller.fill.

What does this "ordering" buy you? Let's say you have this template:

String sTemplate = Hello ~G~name~EG~. Here is the ~G~link~EG~ to that website you mentioned.

and this sub-template:

String sSublink = <A HREF="~G~link_url~EG~">~G~link_text~EG~</a>

Normally, you'd fill this template with the following code:

Template t = new Template(new FLRString(sTemplate));
Template tSubLink = new Template(new FLRString(sSublink));

TemplateFiller tf = new TemplateFiller();
tf.setTemplate(t);
tf.fill("name", "YOUR_NAME_HERE");

TemplateFiller tfSub = new TemplateFiller();
tf.setTemplate(tSubLink);
tfSub.fill("link_url", "http://sourceforge.net/projects/xbnjava");
tfSub.fill("link_text", "way cool link");

tf.fill("link", tfSub.getResult());

String sResult = tf.getResult();

Where sResult equals

Hello YOUR_NAME_HERE. Here is the <A HREF="http://sourceforge.net/projects/xbnjava">way cool link</a> to that website you mentioned.

Using this class, TemplateOrderedGaps, the code is a more concise:

Template t = new Template(new FLRString(sTemplate));
TOGTwo tog2Link = new TOGTwo((new FLRString(sSublink)), "link_url", "link_text");

TemplateFiller tf = new TemplateFiller();
tf.setTemplate(t);
tf.fill("name", "YOUR_NAME_HERE");
tf.fill("link", tog2Link, "http://sourceforge.net/projects/xbnjava", "way cool link");

String sResult = tf.getResult();


Fields inherited from class xbn.XBNObject
bFALSE_IN_PRODUCTION, bTRUE_IN_PRODUCTION, sCNSTR, sES, sLINE_SEP
 
Constructor Summary
TemplateOrderedGaps(ForLineRetrieval flr_srcTxt, OGConfig og_config)
          Create a TemplateOrderedGaps.
TemplateOrderedGaps(ForLineRetrieval flr_srcTxt, OGConfig og_config, TParseConfig tp_config)
          Create a TemplateOrderedGaps.
TemplateOrderedGaps(String s_name, ForLineRetrieval flr_srcTxt, OGConfig og_config)
          Create a TemplateOrderedGaps.
TemplateOrderedGaps(String s_name, ForLineRetrieval flr_srcTxt, OGConfig og_config, TParseConfig tp_config)
          Create a TemplateOrderedGaps.
TemplateOrderedGaps(TemplateOrderedGaps t_rdrdGaps)
          Create a full copy of the provided TemplateOrderedGaps.
 
Method Summary
 OGConfig getOGConfig()
          Get the OGConfig for direct manipulation.
 
Methods inherited from class xbn.template.Template
getAOSLHashtable, getListAbs, getListAbs, getListAbs, getListAbs, getListUnq, getListUnq, getListUnq, getListUnq, getName, getSurroundingText, getSurroundingTextCount, getTemplateData, getTFilter, getUnqArrIdxFromAbs, getUSAPAbsolute, getUSAPUnique, throwAX, throwTFX, throwTFX, toString
 
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, wait, wait, wait
 

Constructor Detail

TemplateOrderedGaps

public TemplateOrderedGaps(ForLineRetrieval flr_srcTxt,
                           OGConfig og_config)
                    throws TemplateFormatException

Create a TemplateOrderedGaps.

Equal to TemplateOrderedGaps(null, flr_srcTxt, og_config)


TemplateOrderedGaps

public TemplateOrderedGaps(ForLineRetrieval flr_srcTxt,
                           OGConfig og_config,
                           TParseConfig tp_config)
                    throws TemplateFormatException

Create a TemplateOrderedGaps.

Equal to TemplateOrderedGaps(null, flr_srcTxt, og_config, tp_config)


TemplateOrderedGaps

public TemplateOrderedGaps(String s_name,
                           ForLineRetrieval flr_srcTxt,
                           OGConfig og_config)
                    throws TemplateFormatException

Create a TemplateOrderedGaps.

Equal to TemplateOrderedGaps(s_name, flr_srcTxt, og_config, (new TParseConfig()))


TemplateOrderedGaps

public TemplateOrderedGaps(String s_name,
                           ForLineRetrieval flr_srcTxt,
                           OGConfig og_config,
                           TParseConfig tp_config)
                    throws TemplateFormatException

Create a TemplateOrderedGaps.

Equal to Template(s_name, flr_srcTxt, tp_config, og_config)

The only difference between this constructor and the super version, is that og_config (the TFilter) may not be null


TemplateOrderedGaps

public TemplateOrderedGaps(TemplateOrderedGaps t_rdrdGaps)

Create a full copy of the provided TemplateOrderedGaps.

Equal to Template(t_rdrdGaps)

Method Detail

getOGConfig

public final OGConfig getOGConfig()

Get the OGConfig for direct manipulation.

Returns:
(OGConfig)getTFilter()



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