Class MovAvgModel.AbstractModelParser

  • Enclosing class:
    MovAvgModel

    public abstract static class MovAvgModel.AbstractModelParser
    extends Object
    Abstract class which also provides some concrete parsing functionality.
    • Constructor Detail

      • AbstractModelParser

        public AbstractModelParser()
    • Method Detail

      • parse

        public abstract MovAvgModel parse​(@Nullable
                                          Map<String,​Object> settings,
                                          String pipelineName,
                                          int windowSize)
                                   throws ParseException
        Parse a settings hash that is specific to this model
        Parameters:
        settings - Map of settings, extracted from the request
        pipelineName - Name of the parent pipeline agg
        windowSize - Size of the window for this moving avg
        Returns:
        A fully built moving average model
        Throws:
        ParseException
      • parseDoubleParam

        protected double parseDoubleParam​(@Nullable
                                          Map<String,​Object> settings,
                                          String name,
                                          double defaultValue)
                                   throws ParseException
        Extracts a 0-1 inclusive double from the settings map, otherwise throws an exception
        Parameters:
        settings - Map of settings provided to this model
        name - Name of parameter we are attempting to extract
        defaultValue - Default value to be used if value does not exist in map
        Returns:
        Double value extracted from settings map
        Throws:
        ParseException
      • parseIntegerParam

        protected int parseIntegerParam​(@Nullable
                                        Map<String,​Object> settings,
                                        String name,
                                        int defaultValue)
                                 throws ParseException
        Extracts an integer from the settings map, otherwise throws an exception
        Parameters:
        settings - Map of settings provided to this model
        name - Name of parameter we are attempting to extract
        defaultValue - Default value to be used if value does not exist in map
        Returns:
        Integer value extracted from settings map
        Throws:
        ParseException
      • parseBoolParam

        protected boolean parseBoolParam​(@Nullable
                                         Map<String,​Object> settings,
                                         String name,
                                         boolean defaultValue)
                                  throws ParseException
        Extracts a boolean from the settings map, otherwise throws an exception
        Parameters:
        settings - Map of settings provided to this model
        name - Name of parameter we are attempting to extract
        defaultValue - Default value to be used if value does not exist in map
        Returns:
        Boolean value extracted from settings map
        Throws:
        ParseException