**/
public TemplateDataOrString(String s_name, ForLineRetrieval for_lineRetrieval, TParseConfig tp_config) throws TemplateFormatException {
throwAXIfNull(for_lineRetrieval, "for_lineRetrieval", sCNSTR);
throwAXIfNull(tp_config, "tp_config", sCNSTR);
sName = s_name;
Outputter optr_dbg = tp_config.getOptrDebug();
if(optr_dbg.isOn()) {
optr_dbg.write("TemplateDataOrString: Parsing...START");
optr_dbg.write("\tTemplate name: '" + getName() + "'");
optr_dbg.write("[" + tp_config.toString() + "]");
}
VWString acsSurroundingText = new VWString();
StringBuffer sbCurrentSurrText = new StringBuffer(sES);
AOSLCreator aoslc = new AOSLCreator();
TLAObjects tlao = new TLAObjects(tp_config);
while(for_lineRetrieval.hasMoreLines()) {
StringBuffer sbLine = for_lineRetrieval.getNextLine();
TemplateLineAnalyzer tla = new TemplateLineAnalyzer(getName(), for_lineRetrieval.getLineNumberPrev(), sbLine, tlao);
String sFinalSurrTxt = null;
while(!tla.isDoneAnalyzing()) {
if(tla.hasAnotherGap()) {
s_s ss = tla.getNextSurrTxtAndGap();
if(!tp_config.doIgnoreSurrTxt()) {
sbCurrentSurrText.append(ss.s1);
addCurrSurrTextOntoArray(acsSurroundingText, sbCurrentSurrText);
}
aoslc.addString(ss.s2);
if(aoslc.wasLastStringUnique()) {
//THIS IS PRINTING OUT AFTER THE GAP *FOLLOWING*
//THE ONE THAT IS UNIQUE. HMMMMM.
optr_dbg.write("\t\t\t[ UNIQUE ]");
}
} else {
//The end of the line has been reached. Get the final
//surrounding text.
sFinalSurrTxt = tla.getFinalSurrTxt();
}
}
if(!tp_config.doIgnoreSurrTxt()) {
sbCurrentSurrText.append(sFinalSurrTxt);
}
}
if(aoslc.getCountUnq() < 1) {
//There are no gaps, so the FLR contains a plain string.
sString = sbCurrentSurrText.toString();
tData = null;
optr_dbg.write("No gaps found. isTemplate() equals false. Use getString().");
} else {
//There is at least one gap. Add the final surrounding
//text to the array.
if(!tp_config.doIgnoreSurrTxt()) {
addCurrSurrTextOntoArray(acsSurroundingText, sbCurrentSurrText);
}
sString = null;
aoslc.lock();
tData = new TemplateData(getName(),
aoslc.getAOSLookup(),
new APString(acsSurroundingText.getAOString()),
tlao.sTagStart, tlao.sTagEnd);
sName = null;
if(optr_dbg.isOn()) {
optr_dbg.write(tData.getAOSLookup().getUSAPUnique().getLength() + " unique gaps found. isTemplate() equals true. Use getTemplateData().");
}
}
optr_dbg.write("TemplateDataOrString: Parsing...END");
}