uk.ac.man.cs.rainbow.rapa.abstraction
Class NAry

java.lang.Object
  |
  +--uk.ac.man.cs.rainbow.rapa.data.AbstractFunction
        |
        +--uk.ac.man.cs.rainbow.rapa.abstraction.NAry

public class NAry
extends AbstractFunction

N-ary abstract function implementation.

See Also:
Application, Unary

Inner Class Summary
static class NAry.LengthMismatchException
           
 
Inner classes inherited from class uk.ac.man.cs.rainbow.rapa.data.AbstractFunction
AbstractFunction.UnsupportedTopException, AbstractFunction.WrongNumberOfArgumentsException
 
Fields inherited from class uk.ac.man.cs.rainbow.rapa.data.AbstractFunction
name, numArgs
 
Constructor Summary
NAry(String name, AbstractType[] intys, Map m)
          Builds mappings for top from rest of map.
 
Method Summary
 Value[] eval(Value[] args)
          Evaluate this function according to the free abstraction.
 boolean supportsTop()
          Whether the top of any type may be passed as an argument to the type.
 
Methods inherited from class uk.ac.man.cs.rainbow.rapa.data.AbstractFunction
evaluate, getNumArgs, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

NAry

public NAry(String name,
            AbstractType[] intys,
            Map m)
     throws NAry.LengthMismatchException
Builds mappings for top from rest of map.
Parameters:
name - The name of this function.
intys - Array of abstract input types.
m - A mapping from abstract input values (as arrays) to the arrays of abstract values possible for that set of inputs.
Throws:
NAry.LengthMismatchException - If the size of any input vector is not the same as the size of the vector of input types.
Method Detail

supportsTop

public boolean supportsTop()
Description copied from class: AbstractFunction
Whether the top of any type may be passed as an argument to the type. Currently it is not a good idea to fail to support this unless you can be sure it will never be passed a top...
Overrides:
supportsTop in class AbstractFunction

eval

public Value[] eval(Value[] args)
Description copied from class: AbstractFunction
Evaluate this function according to the free abstraction.
Overrides:
eval in class AbstractFunction
Following copied from class: uk.ac.man.cs.rainbow.rapa.data.AbstractFunction
Parameters:
args - Arguments to the function; may include the top of a type in any position if AbstractFunction.supportsTop() returns true.
Returns:
Array of all possible function results.