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

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

public class Unary
extends AbstractFunction

Unary abstract function implementation.

See Also:
Application, NAry

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
Unary(String name, AbstractType inty, AbstractType outy, String[] lookup)
           
Unary(String name, AbstractType intype, Map map)
          Builds mapping 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

Unary

public Unary(String name,
             AbstractType intype,
             Map map)
Builds mapping for top from rest of map.
Parameters:
map - A mapping from abstract values to the arrays of abstract values.

Unary

public Unary(String name,
             AbstractType inty,
             AbstractType outy,
             String[] lookup)
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.