Class DeterministicResolver

  • All Implemented Interfaces:
    com.yahoo.component.Component, com.yahoo.component.Deconstructable, Comparable<com.yahoo.component.Component>

    public class DeterministicResolver
    extends Resolver
    A resolver which
    • Always chooses the last alternative of any Choice
    • Always maps values to placeholders in the order they are listed in the map definition of any MapChoice
    This is useful for testing.

    The id of this if native.deterministic

    Author:
    bratseth
    • Constructor Detail

      • DeterministicResolver

        public DeterministicResolver()
      • DeterministicResolver

        protected DeterministicResolver​(String id)
    • Method Detail

      • resolve

        public void resolve​(Choice choice,
                            Query query,
                            Result result,
                            Resolution resolution)
        Chooses the last alternative of any choice
        Overrides:
        resolve in class Resolver
        Parameters:
        choice - the choice to resolve
        query - the query for which this should be resolved, typically used to extract features
        result - the result for which this should be resolved, typically used to extract features
        resolution - the set of resolutions made so far, to which this should be added: resolution.addChoiceResolution(choice,chosenAlternativeIndex)
      • resolve

        public void resolve​(MapChoice choice,
                            Query query,
                            Result result,
                            Resolution resolution)
        Chooses a mapping which is always by the literal order given in the source template
        Overrides:
        resolve in class Resolver
        Parameters:
        choice - the choice to resolve
        query - the query for which this should be resolved, typically used to extract features
        result - the result for which this should be resolved, typically used to extract features
        resolution - the set of resolutions made so far, to which this should be added: resolution.addMapChoiceResolution(choice,chosenMapping)