ilog.rules.factory

Class IlrFunctionFactory

  • java.lang.Object
    • ilog.rules.factory.IlrFunctionFactory
  • All Implemented Interfaces:
    ilog.rules.factory.IlrFunctionElement, ilog.rules.factory.IlrRulesetElement, java.io.Serializable


    public class IlrFunctionFactory
    extends java.lang.Object
    implements java.io.Serializable, ilog.rules.factory.IlrFunctionElement
    Function definition of the rule language.

    Warning: Serialized objects of this class will not be compatible with future releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of IBM Decision Server.

    See Also:
    Serialized Form
    • Method Summary

      Methods 
      Modifier and Type Method and Description
      void addArgument(IlrVariable argument)
      Adds a formal argument to the function.
      void addStatement(IlrStatement statement)
      Adds an action to the function.
      java.util.Enumeration enumerateArguments()
      Gets an enumeration to visit all the arguments of the function.
      java.util.Enumeration enumerateStatements()
      Gets an enumeration to visit all the actions of the function.
      static java.lang.String formatIdentifier(java.lang.String name, java.lang.Class[] argtypes)
      Formats a function identifier from its name and its argument.
      static java.lang.String formatIdentifier(java.lang.String name, IlrType[] argtypes)
      Formats a function identifier from its name and its arguments.
      static java.lang.String formatSignature(java.lang.String name, java.lang.Class[] argtypes, java.lang.Class returnType)
      Formats a function signature using its name, its argument types, and the return type.
      static java.lang.String formatSignature(java.lang.String name, IlrType[] argtypes, IlrType returnType)
      Formats a function signature using its name, its argument types, and the return type.
      static java.lang.String formatSignature(java.lang.String name, java.lang.String[] argtypes, java.lang.String returnType)
      Formats a function signature using its name, its argument types, and the return type.
      int getArgumentCount()
      Gets the number of arguments in the function.
      IlrVariable[] getArguments()
      Gets the arguments of the function.
      java.lang.String getFormalComment()
      Gets the formal comment of the function.
      java.lang.String getIdentifier()
      Gets the identifier of the function.
      java.lang.String getName()
      Gets the fully qualified name of the function.
      IlrPackageFactory getPackage()
      Returns the package in which the function is defined.
      java.lang.String getShortName()
      Gets the short name of the function.
      java.lang.String getSignature()
      Gets the signature of the function.
      int getStatementCount()
      Gets the number of actions.
      IlrStatement[] getStatements()
      Gets the actions of the function.
      IlrType getXOMReturnType()
      Gets the return type of the function.
      boolean hasArgument(java.lang.String name)
      Checks to see if the argument is already defined.
      boolean isVoidFunction()
      Tests if the function returns void.
      boolean match(java.lang.Class[] callTypes)
      Tests if the function accepts the types of arguments.
      boolean match(IlrValue[] arguments)
      Tests if the function accepts the values as arguments.
      void removeArgument(IlrVariable argument)
      Removes a formal argument from the rule.
      void removeStatement(IlrStatement statement)
      Removes a statement from the rule.
      void setArguments(IlrVariable[] arguments)
      Sets the arguments of the function.
      void setFormalComment(java.lang.String formalComment)
      Sets the formal comment of the function.
      void setName(java.lang.String name)
      Sets the fully qualified name of the function to the given parameter.
      void setStatements(IlrStatement[] statements)
      Sets the statements of the function.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • IlrFunctionFactory

        public IlrFunctionFactory(IlrReflect reflect,
                          IlrPackageFactory pkg,
                          java.lang.String definitionName)
        Constructs a function factory using a function name. The function package is the one specified. If null, the function is considered to belong to the default package. The argument list initially is empty. The function returns void.
        Parameters:
        reflect - A reflect.
        pkg - The package to which the function belongs.
        definitionName - The name of the function.
      • IlrFunctionFactory

        public IlrFunctionFactory(IlrReflect reflect,
                          IlrPackageFactory pkg,
                          java.lang.String definitionName,
                          java.lang.Class returnType)
        Constructs a function factory using a function name and its return type. The function package is the one specified. If null, the function is considered to belong to the default package. The argument list initially is empty.
        Parameters:
        reflect - A reflect.
        pkg - The package to which the function belongs.
        definitionName - The name of the function.
        returnType - The return type of the function.
      • IlrFunctionFactory

        public IlrFunctionFactory(java.lang.String definitionName,
                          IlrPackageFactory pkg,
                          IlrType returnType)
        Constructs a function factory using a function name and its return type. The function package is the one specified. If null, the function is considered to belong to the default package. The argument list initially is empty.
        Parameters:
        definitionName - The name of the function.
        pkg - The package to which the function belongs.
        returnType - The return type of the function.
    • Method Detail

      • getName

        public java.lang.String getName()
        Gets the fully qualified name of the function.
        Returns:
        The fully qualified name of the function.
      • getShortName

        public java.lang.String getShortName()
        Gets the short name of the function.
        Returns:
        The short name of the function.
      • setName

        public void setName(java.lang.String name)
        Sets the fully qualified name of the function to the given parameter. The method computes the function short name by taking the identifier after the last '.' character.
        Parameters:
        name - The name of the function.
      • getFormalComment

        public java.lang.String getFormalComment()
        Gets the formal comment of the function.
        Returns:
        The formal comment of the function.
      • setFormalComment

        public void setFormalComment(java.lang.String formalComment)
        Sets the formal comment of the function.
        Parameters:
        formalComment - The formal comment of the function.
      • getXOMReturnType

        public IlrType getXOMReturnType()
        Gets the return type of the function.
        Returns:
        The type of the function.
      • getIdentifier

        public java.lang.String getIdentifier()
        Gets the identifier of the function. It is computed by appending the function short name with the argument type, as follows: function-name(arg-type1, ..., arg-typen)
        Returns:
        The function identifier.
      • getSignature

        public java.lang.String getSignature()
        Gets the signature of the function. The signature is formed by the return type name followed by the function signature.
        Returns:
        The function signature.
      • isVoidFunction

        public boolean isVoidFunction()
        Tests if the function returns void.
        Returns:
        true if the function return type is a void type.
      • match

        public boolean match(IlrValue[] arguments)
        Tests if the function accepts the values as arguments.
        Parameters:
        arguments - The arguments passed to the function.
        Returns:
        true if the function accepts the arguments.
      • match

        public boolean match(java.lang.Class[] callTypes)
        Tests if the function accepts the types of arguments.
        Parameters:
        callTypes - The argument types passed to the function.
        Returns:
        true if the function accepts the argument types.
      • hasArgument

        public final boolean hasArgument(java.lang.String name)
        Checks to see if the argument is already defined.
        Parameters:
        name - The argument to be checked.
      • addArgument

        public final void addArgument(IlrVariable argument)
        Adds a formal argument to the function. The argument passed as the argument becomes the last argument of the function.
        Parameters:
        argument - The argument to be added.
      • removeArgument

        public final void removeArgument(IlrVariable argument)
        Removes a formal argument from the rule.
        Parameters:
        argument - The argument to be removed.
      • getArgumentCount

        public final int getArgumentCount()
        Gets the number of arguments in the function.
        Returns:
        The number of arguments in the function.
      • getArguments

        public final IlrVariable[] getArguments()
        Gets the arguments of the function.
        Returns:
        An array of IlrVariable representing the arguments.
      • setArguments

        public final void setArguments(IlrVariable[] arguments)
        Sets the arguments of the function.
        Parameters:
        arguments - The arguments to be set.
      • enumerateArguments

        public final java.util.Enumeration enumerateArguments()
        Gets an enumeration to visit all the arguments of the function.
        Returns:
        An enumeration.
      • addStatement

        public final void addStatement(IlrStatement statement)
        Adds an action to the function. The action becomes the last action of the function.
        Parameters:
        statement - The action to be added.
      • removeStatement

        public final void removeStatement(IlrStatement statement)
        Removes a statement from the rule.
        Parameters:
        statement - The statement to be removed.
      • getStatementCount

        public final int getStatementCount()
        Gets the number of actions.
        Returns:
        The number of actions.
      • getStatements

        public final IlrStatement[] getStatements()
        Gets the actions of the function.
        Returns:
        The actions of the function.
      • setStatements

        public final void setStatements(IlrStatement[] statements)
        Sets the statements of the function.
        Parameters:
        statements - The statements to be set.
      • enumerateStatements

        public final java.util.Enumeration enumerateStatements()
        Gets an enumeration to visit all the actions of the function.
        Returns:
        An enumeration of the function actions.
      • formatIdentifier

        public static java.lang.String formatIdentifier(java.lang.String name,
                                        IlrType[] argtypes)
        Formats a function identifier from its name and its arguments.
        Parameters:
        name - The function name.
        argtypes - The argument types.
        Returns:
        The identifier.
      • formatIdentifier

        public static java.lang.String formatIdentifier(java.lang.String name,
                                        java.lang.Class[] argtypes)
        Formats a function identifier from its name and its argument.
        Parameters:
        name - The function name.
        argtypes - The argument types.
        Returns:
        The identifier.
      • formatSignature

        public static java.lang.String formatSignature(java.lang.String name,
                                       java.lang.String[] argtypes,
                                       java.lang.String returnType)
        Formats a function signature using its name, its argument types, and the return type.
        Parameters:
        name - The function name.
        argtypes - The argument types.
        returnType - The return type.
        Returns:
        The identifier.
      • formatSignature

        public static java.lang.String formatSignature(java.lang.String name,
                                       IlrType[] argtypes,
                                       IlrType returnType)
        Formats a function signature using its name, its argument types, and the return type.
        Parameters:
        name - The function name.
        argtypes - The argument types.
        returnType - The return type.
        Returns:
        The identifier.
      • formatSignature

        public static java.lang.String formatSignature(java.lang.String name,
                                       java.lang.Class[] argtypes,
                                       java.lang.Class returnType)
        Formats a function signature using its name, its argument types, and the return type.
        Parameters:
        name - The function name.
        argtypes - The argument types.
        returnType - The return type.
        Returns:
        The identifier.
      • getPackage

        public IlrPackageFactory getPackage()
        Returns the package in which the function is defined.
        Returns:
        The package that contains the function.

© Copyright IBM Corp. 1987, 2017