blog
Class AbstractFunctionInterp

java.lang.Object
  extended by blog.AbstractFunctionInterp
All Implemented Interfaces:
FunctionInterp
Direct Known Subclasses:
ConstantInterp, ListInterp, TabularInterp, VectorInRect

public abstract class AbstractFunctionInterp
extends java.lang.Object
implements FunctionInterp

Abstract implementation of FunctionInterp including a getInverseTuples method that always returns null.


Constructor Summary
AbstractFunctionInterp()
           
 
Method Summary
 java.util.Set getInverseArgs(java.util.List args, int argIndex, Type argType, java.lang.Object value)
          Returns the set of values for argument argIndex that, in combination with the given values for the other arguments, yield the given function value.
 java.util.Set getInverseTuples(java.lang.Object value)
          Returns the set of argument tuples that yield the given value, if this set is finite and can be computed easily.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface blog.FunctionInterp
getValue
 

Constructor Detail

AbstractFunctionInterp

public AbstractFunctionInterp()
Method Detail

getInverseTuples

public java.util.Set getInverseTuples(java.lang.Object value)
Returns the set of argument tuples that yield the given value, if this set is finite and can be computed easily. Otherwise returns null.

This default implementation just returns null.

Specified by:
getInverseTuples in interface FunctionInterp
Returns:
Set of List of objects

getInverseArgs

public java.util.Set getInverseArgs(java.util.List args,
                                    int argIndex,
                                    Type argType,
                                    java.lang.Object value)
Returns the set of values for argument argIndex that, in combination with the given values for the other arguments, yield the given function value. If this set cannot be computed straightforwardly, returns null.

This default implementation calls getInverseTuples(value), and if it gets a non-null result, it searches the resulting set for tuples that match args except on argIndex. It returns a set consisting of the values at index argIndex in those tuples.

Specified by:
getInverseArgs in interface FunctionInterp
Parameters:
args - tuple of arguments; the entry at argIndex is ignored
argIndex - index of argument whose possible values are to be returned
argType - type of the argument at index argIndex
value - value of this function