Class PriorityAxe
- All Implemented Interfaces:
Axe
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidforArborist(Arborist arborist) Who's using this axe?booleanIs this a specialist axe?select(ParseTree tree, ForestNode node, int count, List<Family> choices) Select a branch from a list of branches.booleanWas the previous selection ambiguous?
-
Constructor Details
-
PriorityAxe
public PriorityAxe() -
PriorityAxe
public PriorityAxe(boolean avoidLoops)
-
-
Method Details
-
isSpecialist
public boolean isSpecialist()Description copied from interface:AxeIs this a specialist axe?A specialist axe can consider every tree in the forest differently every time it is used. A non-specialist axe considers every tree at most once and returns all the trees that are selected.
- Specified by:
isSpecialistin interfaceAxe- Returns:
- true if the axe is specialist
-
select
Description copied from interface:AxeSelect a branch from a list of branches.In an ambiguous forest, some nodes will have more than one possible choice. In any given tree, only one choice may be selected. This function is called to make the selection.
There will always be at least one element in the choices list when the method is called. The method must return at least one.
The first node in the list returned is the choice selected for the tree currently under construction. If only one choice is returned, the node becomes unambiguous on subsequent parses, the same selection will always be used. If additional choices are returned, they will be considered on subsequent parses. Note that if you want the selected choice to be considered on future parses, it must appear in the list twice. It is the only node that may appear twice.
-
wasAmbiguousSelection
public boolean wasAmbiguousSelection()Description copied from interface:AxeWas the previous selection ambiguous?This method asks if the previous selection was ambiguous. If the axe ever indicates that an ambiguous selection was made, the resulting parse is considered ambiguous. For example, the
SequentialAxealways returns true because it treats all choices as equivalent. ThePriorityAxeonly considers a selection ambiguous if there wasn't a uniquely highest priority selection.- Specified by:
wasAmbiguousSelectionin interfaceAxe- Returns:
- true if the choice made was random
-
forArborist
Description copied from interface:AxeWho's using this axe?Do not pass the same axe to more than one
Arborist.- Specified by:
forArboristin interfaceAxe- Parameters:
arborist- theArboristusing this axe.
-