Package org.nineml.coffeegrinder.trees
Interface TreeSelector
-
public interface TreeSelectorThe tree selector is responsible for choosing among ambiguous parses.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidendNonterminal(NonterminalSymbol symbol, java.util.Map<java.lang.String,java.lang.String> attributes, int leftExtent, int rightExtent)Enda a nonterminal.booleangetMadeAmbiguousChoice()Did the tree selector make an arbitrary choice?voidreset()Reset the state of the tree selector.Familyselect(java.util.List<Family> choices, java.util.List<Family> otherChoices)Make a selection.voidstartNonterminal(NonterminalSymbol symbol, java.util.Map<java.lang.String,java.lang.String> attributes, int leftExtent, int rightExtent)Start a nonterminal.
-
-
-
Method Detail
-
getMadeAmbiguousChoice
boolean getMadeAmbiguousChoice()
Did the tree selector make an arbitrary choice?A non-arbitrary choice, resolved by priority or some other mechanism does not necessarily count as an ambiguous choice.
- Returns:
- True if the selector made an arbitrary choice.
-
startNonterminal
void startNonterminal(NonterminalSymbol symbol, java.util.Map<java.lang.String,java.lang.String> attributes, int leftExtent, int rightExtent)
Start a nonterminal.The start and end nonterminal methods allow the tree selector to track what choices have already been made.
- Parameters:
symbol- The symbol.attributes- Its attributes.leftExtent- The starting position in the input.rightExtent- The ending position in the input.
-
endNonterminal
void endNonterminal(NonterminalSymbol symbol, java.util.Map<java.lang.String,java.lang.String> attributes, int leftExtent, int rightExtent)
Enda a nonterminal.The start and end nonterminal methods allow the tree selector to track what choices have already been made.
- Parameters:
symbol- The symbol.attributes- Its attributes.leftExtent- The starting position in the input.rightExtent- The ending position in the input.
-
select
Family select(java.util.List<Family> choices, java.util.List<Family> otherChoices)
Make a selection.The list of choices will always contain at least one choice. The list of otherChoices will include any choices previously made. The method must return a choice.
- Parameters:
choices- The available, unused choices.otherChoices- The available, but previously selected choices.- Returns:
- The selected choice.
-
reset
void reset()
Reset the state of the tree selector.
-
-