com.flagstone.transform.action
Class NewFunction2.Builder

java.lang.Object
  extended by com.flagstone.transform.action.NewFunction2.Builder
Enclosing class:
NewFunction2

public static final class NewFunction2.Builder
extends Object

The Builder class is used to generate a new NewFunction2 object using a small set of convenience methods.


Constructor Summary
NewFunction2.Builder()
           
 
Method Summary
 NewFunction2.Builder addAction(Action action)
          Add an action to the list of actions that will make up the body of the function.
 NewFunction2.Builder addArgument(String argName)
          Add the name of an argument to the list of arguments that will be passed to the function.
 NewFunction2.Builder addArgument(String argName, int index)
          Add the name of an argument and the number of the register where it will be stored to the list of arguments that will be passed to the function.
 NewFunction2.Builder allocate(int count)
          Set the number of registers to allocate for the function.
 NewFunction2 build()
          Generate an NewFunction2 using the parameters defined in the Builder.
 NewFunction2.Builder optimize(NewFunction2.Optimization opt)
          Add an Optimization to be used by the function.
 NewFunction2.Builder setName(String aString)
          Set the name of the function.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NewFunction2.Builder

public NewFunction2.Builder()
Method Detail

setName

public NewFunction2.Builder setName(String aString)
Set the name of the function. Must not be null or an empty string. The name defaults to an empty string so this method is not needed to define methods.

Parameters:
aString - the name of the function.
Returns:
this object.

allocate

public NewFunction2.Builder allocate(int count)
Set the number of registers to allocate for the function.

Parameters:
count - the number of registers. Must be in the range 0..255.
Returns:
this object.

optimize

public NewFunction2.Builder optimize(NewFunction2.Optimization opt)
Add an Optimization to be used by the function.

Parameters:
opt - an Optimization used to speed up the function execution.
Returns:
this object.

addArgument

public NewFunction2.Builder addArgument(String argName)
Add the name of an argument to the list of arguments that will be passed to the function. Must not be null or an empty string.

Parameters:
argName - the name of the argument.
Returns:
this object.

addArgument

public NewFunction2.Builder addArgument(String argName,
                                        int index)
Add the name of an argument and the number of the register where it will be stored to the list of arguments that will be passed to the function. The name must not be null or an empty string and the register number must be in the range 0..255. If the number is set to zero then the argument will not be stored in a register.

Parameters:
argName - the name of the argument.
index - the register number.
Returns:
this object.

addAction

public NewFunction2.Builder addAction(Action action)
Add an action to the list of actions that will make up the body of the function. Must not be null.

Parameters:
action - the action to add to the function body.
Returns:
this object.

build

public NewFunction2 build()
Generate an NewFunction2 using the parameters defined in the Builder.

Returns:
an initialized NewFunction2 object.


Copyright © 2002-2010 Flagstone Software Ltd.. All Rights Reserved.