AboutSTEP/mt Core is the core component of STEP/mt ( S tructured TE xt P rocessor based on minimal m arkup and t emplates). Content
For more information about the core package, see the API documentation. DetailsResolving PatternsIdentificators and Separators of regions can be defined using references to other named patterns:
region.addIdentificator("ABC${numberpattern}");
A pattern with the name numberpattern will be resolved at the position of the placeholder ${numberpattern} :
Pattern numberpattern = new NumberPattern();
numberpattern.setName("numberpattern");
PatternMap map = new PatternMap();
map.add(numberpattern);
region.addIdentificator("ABC${numberpattern}");
region.resolvePatterns(map);
The result of the resolving process will be a PatternSet containing a StringPattern (which is never directly addressed) and a ContainerPattern containing a NumberPattern . This is happening in the background:
PatternSet set = new PatternSet();
set.add(new StringPattern("ABC");
set.add(new ContainerPattern("numberpattern"));
...
for (Iterator it = containerPatterns.iterator(); it.hasNext();)
{
((ContainerPattern) it.next()).resolve(patternMap);
}
...
public class ContainerPattern implements Pattern
{
...
public void resolve(PatternMap patternMap)
{
containedPattern = patternMap.get(name);
}
...
}
|