Community articleevaluate method
Added by IBM contributorIBM on July 26, 2013
Rate this article 1 starsRate this article 2 starsRate this article 3 starsRate this article 4 starsRate this article 5 stars

Description

This method performs the necessary work for your custom-built function. You will have to insert the details of your custom functions within this method.

Method

public void evaluate(
   String thePackageName, 
   String theFunctionName,
   int theFunctionID,
   int theFunctionInstance,
   short theCommand,
   com.PureEdge.xfdl.FormNodeP theForm, 
   com.PureEdge.xfdl.FormNodeP theComputeNode, 
   com.PureEdge.IFSUserDataHolder theFunctionData, 
   com.PureEdge.IFSUserDataHolder theFunctionInstanceData, 
   com.PureEdge.xfdl.FormNodeP[ ] theArgList, 
   com.PureEdge.xfdl.FormNodeP theResult
   ) throws UWIException;


Parameters

ExpressionTypeDescription
thePackageNameStringThe name of the package that contains the function.
theFunctionNameStringThe name of the function.
theFunctionIDintA unique number that can be used to identify the function.
theFunctionInstance intA unique number that differentiates one instance of the function from another instance. See Notes for more information.
theCommandshortThe name of the command for this method to perform. See Notes for more information. Other commands can be found within the manual.
theForm FormNodePThe form that contains the function.
theComputeNodeFormNodePThe node within the form that stores the function. See Notes for more information.
theFunctionDataIFSUserDataHolderReserved. Although this expression is not used, it must be present.
theFunctionInstanceDataIFSUserDataHolderReserved. Although this expression is not used, it must be present.
theArgListFormNodeP [ ]The list of arguments. See Notes for more information.
theResultFormNodePThe FormNodeP object in which you should store the result. Simply use setLiteralEx on this object to store the result.


Returns

Nothing if call is successful or throws a generic exception (UWIException) if an error occurs.

Notes

  • theCommand — the value of theCommand represents the command that evaluate will perform.
    • The value of theCommand depends on the value of the parameter called theFlags in the method called registerFunctionCall.
    • Usually theCommand will be set to FCICOMMAND_RUN. This indicates that a function must be evaluated.
    • Other possible values for theCommand include:
    • FCICOMMAND_INSTANCEDEREGISTER — This constant indicates that evaluate should execute some procedure when an instance of the function has been deregistered.
    • FCICOMMAND_DEREGISTER — This constant indicates that evaluate should execute some procedure when the function has been deregistered.
    • FCICOMMAND_REGISTER — This constant indicates that evaluate should execute some procedure when the function is registered.
    • FCICOMMAND_INSTANCEREGISTER — This constant indicates that evaluate should execute some procedure when an instance of the function is registered.
  • theFunctionInstance — is a unique number that differentiates one instance of the function with another instance. For example, if a form contains two calls to the function testPackage.multiply then two unique values for theFunctionInstance variable will exist.
  • theComputeNode — is the node within the form that contains the function. For example, if you have an item such as:
  •    <LABEL SID = "L1">
          <VALUE COMPUTE = "testPackage.multiply('7', '6')"></VALUE>
       </LABEL>

Then theComputeNode will point to the node that represents the value option.
  • theFunctionInstanceData - is data specific to an instance of a function. It will always be returned when the instance of the function is called. This object is only provided when the FCI_WANTS_INSTANCE_DATA flag is provided during the registerFunctionCall call.
  • theArgList — Each argument's value is stored as a literal within a FormNodeP object. For example, to get the value of the first argument, type the following:
  •    theArgList[0].getLiteralEx(null)

Note: To get the number of arguments in theArgList use: theArgList.length

Example

   public class FciFunctionCall extends com.PureEdge.xfdl.FunctionCallImplBase 
   implements FunctionCall
   {
   public static final int FUNCTION_ID = 1;
      
      /* Additional Code Removed */
      public void evaluate(String thePackageName, 
         String theFunctionName, int theFunctionID, 
         int theFunctionInstance, short theCommand, 
         com.PureEdge.xfdl.FormNodeP theForm, 
         com.PureEdge.xfdl.FormNodeP theComputeNode, 
         com.PureEdge.IFSUserDataHolder theFunctionData, 
         com.PureEdge.IFSUserDataHolder theFunctionInstanceData, 
         com.PureEdge.xfdl.FormNodeP [] theArgList, 
         com.PureEdge.xfdl.FormNodeP theResult) throws UWIException
      {
   /* The first switch in this method is based on theCommand.  The only case
      that we are interested in handling is FCICOMMAND_RUN that indicates
      that we should evaluate a function. */
         switch (theCommand)
         {
         case FunctionCall.FCICOMMAND_RUN:
   /* The second switch is based on theFunctionID that you set for each 
      of your custom functions. This makes it easy for a single FunctionCall
      object to support multiple functions. */
            switch(theFunctionID)
            {
            case FciFunctionCall.FUNCTION_ID:
            /* Insert the Details of your custom function here */
               break;
            }
            break;
   
            default:
            break;
         }
      }
      
      /* Additional code Removed */
   }


Parent topic:
FunctionCall class