Class FunctionRegistry


  • public class FunctionRegistry
    extends Object
    Function registry. This class will hold references to all the known Functions, and allow the resolution of the correct one given its arguments.
    Author:
    Andrea Leofreddi
    • Method Summary

      Modifier and Type Method Description
      void add​(Function<?> function)
      Add a function to the registry.
      void addAll​(Collection<Function<?>> functions)
      Add all the functions to the registry.
      net.vleo.timel.impl.intermediate.tree.FunctionCall lookup​(net.vleo.timel.impl.parser.tree.AbstractParseTree reference, String function, List<net.vleo.timel.impl.intermediate.tree.AbstractSyntaxTree> arguments)
      Lookup a function for the given arguments.
    • Constructor Detail

      • FunctionRegistry

        public FunctionRegistry()
    • Method Detail

      • add

        public void add​(Function<?> function)
        Add a function to the registry.
        Parameters:
        function - Function to register
      • addAll

        public void addAll​(Collection<Function<?>> functions)
        Add all the functions to the registry.
        Parameters:
        functions - Collections of functions to be registered
      • lookup

        public net.vleo.timel.impl.intermediate.tree.FunctionCall lookup​(net.vleo.timel.impl.parser.tree.AbstractParseTree reference,
                                                                         String function,
                                                                         List<net.vleo.timel.impl.intermediate.tree.AbstractSyntaxTree> arguments)
                                                                  throws ParseException
        Lookup a function for the given arguments.
        Parameters:
        reference - Source reference node
        function - Function to lookup
        arguments - Call arguments
        Returns:
        A FunctionCall applying the given function to the passed arguments (casting them when needed).
        Throws:
        ParseException - When the lookup failed