Class ParameterizedRealizationContext

java.lang.Object
nz.org.riskscape.engine.rl.RealizationContextWrapper
nz.org.riskscape.engine.rl.ParameterizedRealizationContext
All Implemented Interfaces:
nz.org.riskscape.engine.rl.RealizationContext

public class ParameterizedRealizationContext extends nz.org.riskscape.engine.rl.RealizationContextWrapper

Wraps a RealizationContext to add more parameters

  • Constructor Details

    • ParameterizedRealizationContext

      public ParameterizedRealizationContext(nz.org.riskscape.engine.rl.RealizationContext wrapping, Map<String,nz.org.riskscape.rl.ast.Expression> parameters, ParameterizedRealizationContext.Mode mode)
  • Method Details

    • override

      public static ParameterizedRealizationContext override(nz.org.riskscape.engine.rl.RealizationContext wrapping, Map<String,nz.org.riskscape.rl.ast.Expression> params)
      Returns:
      a new ParameterizedRealizationContext that provides new parameters that override whatever might have in been the parent context, e.g. if foo exists in the parent and in params, then the value in params is used.
    • defaults

      public static ParameterizedRealizationContext defaults(nz.org.riskscape.engine.rl.RealizationContext wrapping, Map<String,nz.org.riskscape.rl.ast.Expression> params)
      Returns:
      a new ParameterizedRealizationContext that provides parameters that apply only if the parent does not have them, e.g. if foo exists in the parent and in params, then the value in parent is used.
    • getExpressionRealizer

      public nz.org.riskscape.engine.rl.ExpressionRealizer getExpressionRealizer()
      Specified by:
      getExpressionRealizer in interface nz.org.riskscape.engine.rl.RealizationContext
      Overrides:
      getExpressionRealizer in class nz.org.riskscape.engine.rl.RealizationContextWrapper
    • getParameter

      public Optional<nz.org.riskscape.rl.ast.Expression> getParameter(String parameterName)
      Specified by:
      getParameter in interface nz.org.riskscape.engine.rl.RealizationContext
      Overrides:
      getParameter in class nz.org.riskscape.engine.rl.RealizationContextWrapper
    • getParameterNames

      public Set<String> getParameterNames()
      Specified by:
      getParameterNames in interface nz.org.riskscape.engine.rl.RealizationContext
      Overrides:
      getParameterNames in class nz.org.riskscape.engine.rl.RealizationContextWrapper
    • getUsedParameters

      public Set<String> getUsedParameters()

      Returns the set of parameter names that are specific to this context that have been looked up via getParameter. Note that it does not delegate to the parent context as this method is here for the creator of the context to see whether the parameters it gave were used or not (and so support the reporting of used/unused parameters to the user/modeller)

    • getUnusedParameters

      public Set<String> getUnusedParameters()

      Returns the set of parameter names that are specific to this context that haven't been looked up via getParameter. Note that it does not delegate to the parent context as this method is here for the creator of the context to see whether the parameters it gave were used or not (and so support the reporting of unused parameters to the user/modeller)

    • getDefinedParameters

      public Map<String,nz.org.riskscape.rl.ast.Expression> getDefinedParameters()
      Returns:
      the map of parameters that have been defined specifically in this context, e.g. what we were constructed with. I've added this for unit test assertions, not sure there's any (valid) use for it outside of that.
    • getParameters

      public Map<String,nz.org.riskscape.rl.ast.Expression> getParameters()