public interface Template extends java.lang.Comparable<Template>
Template objects supports 3 core operations:
Different implements of the template interface are provided, to allow for "full string" templates (without any underspecification), templates based on regular expressions, mathematical expressions, and templates operating on semantic graphs.
Modifier and Type | Interface and Description |
---|---|
static class |
Template.MatchResult
Representation of a matching result
|
Modifier and Type | Field and Description |
---|---|
static java.util.logging.Logger |
log |
Modifier and Type | Method and Description |
---|---|
default int |
compareTo(Template other)
Compares the templates (based on their string value)
|
static Template |
create(java.lang.String value)
Creates a new template based on the string value.
|
java.lang.String |
fillSlots(Assignment fillers)
Fills the template with the given content, and returns the filled string.
|
java.util.List<Template.MatchResult> |
find(java.lang.String str,
int maxResults)
Searches for all occurrences of the template in the str.
|
java.util.Set<java.lang.String> |
getSlots()
Returns the (possibly empty) set of slots for the template
|
boolean |
isFilledBy(Assignment input)
Returns true if the provided variables cover all of the slots in the template.
|
boolean |
isUnderspecified()
Returns true if the template is an actual template, i.e. can match multiple
values (due to slots or alternative/optional elements)
|
Template.MatchResult |
match(java.lang.String str)
Checks whether the string is matching the template or not.
|
default Template.MatchResult |
partialmatch(java.lang.String str)
Checks whether the template can be found within the string.
|
static Template create(java.lang.String value)
value
- the string for the templatejava.util.Set<java.lang.String> getSlots()
boolean isUnderspecified()
Template.MatchResult match(java.lang.String str)
str
- the string to checkdefault Template.MatchResult partialmatch(java.lang.String str)
str
- the string to checkjava.util.List<Template.MatchResult> find(java.lang.String str, int maxResults)
str
- the string to checkmaxResults
- the maximum number of occurrencesboolean isFilledBy(Assignment input)
input
- the inputjava.lang.String fillSlots(Assignment fillers)
fillers
- the content associated with each slot.