001package jmri.jmrit.logixng.util.parser; 002 003import java.util.List; 004 005import jmri.JmriException; 006import jmri.jmrit.logixng.SymbolTable; 007 008/** 009 * Definition of a function used in expressions. 010 * 011 * @author Daniel Bergqvist 2019 012 */ 013public interface Function { 014 015 /** 016 * Get the module of the function, for example "Math" or "Conversion". 017 * @return the module name 018 */ 019 String getModule(); 020 021 /** 022 * Get the descriptions of the constants in the module. 023 * @return the description of the constants 024 */ 025 String getConstantDescriptions(); 026 027 /** 028 * Get name of the function, for example "sin" or "int" 029 * @return the name 030 */ 031 String getName(); 032 033 /** 034 * Calculate the function 035 * @param symbolTable the symbol table 036 * @param parameterList a list of parameters for the function 037 * @return the result 038 * @throws JmriException in case of an error 039 */ 040 Object calculate(SymbolTable symbolTable, List<ExpressionNode> parameterList) 041 throws JmriException; 042 043 /** 044 * Get the description of the function in Markdown format 045 * @return the description 046 */ 047 String getDescription(); 048 049}