// age == ---> SnippetType.SINGLE
// age == $param ---> SnippetType.PARAM
// age == $1 || age == $2 ---> SnippetType.INDEXED
// forall{age < $}{,} ---> SnippetType.FORALL
String template = content.trim();
SnippetType type = SnippetBuilder.getType( template );
if ( type == SnippetType.SINGLE ) {
type = SnippetType.PARAM;
boolean hasExplicitOperator = false;
for ( String op : operators ) {
if ( template.endsWith( op ) ) {
hasExplicitOperator = true;
break;
}
}
if ( !hasExplicitOperator ) {
template = template + " ==";
}
template = template + " \"";
template = template + SnippetBuilder.PARAM_STRING + "\"";
}
//Make a ValueBuilder for the template
switch ( type ) {
case INDEXED:
return new IndexedParametersValueBuilder( template,
parameterUtilities );
case PARAM:
return new SingleParameterValueBuilder( template,
parameterUtilities );
case SINGLE:
return new LiteralValueBuilder( template );
}
throw new DecisionTableParseException( "SnippetBuilder.SnippetType '" + type.toString() + "' is not supported. The column will not be added." );
}