ptolemy.data.type
Class MonotonicFunction

java.lang.Object
  extended by ptolemy.data.type.MonotonicFunction
All Implemented Interfaces:
InequalityTerm
Direct Known Subclasses:
AbsoluteValue.FunctionTerm, AbstractActionsAttribute.TypeFunction, AbstractActionsAttribute.TypeFunction, ActorTypeUtil.TypeableSizedArrayVariableTypeTerm, Autocorrelation.FunctionTerm, Autocorrelation.FunctionTerm, Autocorrelation.OutputTypeTerm, Autocorrelation.OutputTypeTerm, DotProduct.PortFunction, Expression.OutputTypeFunction, FIR.OutputTypeFunction, MatrixToSequence.FunctionTerm, RecordDisassembler.PortFunction, RecordUpdater.FunctionTerm, SequenceToMatrix.FunctionTerm, UnionDisassembler.PortFunction

public abstract class MonotonicFunction
extends java.lang.Object
implements InequalityTerm

Actors often need to implement monotonic functions as part of the declaration of type constraints. This base class makes it easy to do so. In most cases, it is simply necessary to implement the getValue() and getVariables() abstract methods.

Since:
Ptolemy II 4.0
Version:
$Id: MonotonicFunction.java 57040 2010-01-27 20:52:32Z cxh $
Author:
Steve Neuendorffer
Accepted Rating:
Red (neuendor)
Proposed Rating:
Yellow (neuendor)

Constructor Summary
MonotonicFunction()
           
 
Method Summary
 java.lang.Object getAssociatedObject()
          Return null.
abstract  java.lang.Object getValue()
          Return the result of this monotonic function.
abstract  InequalityTerm[] getVariables()
          Return the type variables in this inequality term.
 java.lang.String getVerboseString()
          Return an additional string describing the current value of this function.
 void initialize(java.lang.Object e)
          Throw an Exception.
 boolean isSettable()
          Return false.
 boolean isValueAcceptable()
          Return true.
 void setValue(java.lang.Object e)
          Throw an Exception.
 java.lang.String toString()
          Override the base class to give a description of this term.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MonotonicFunction

public MonotonicFunction()
Method Detail

getAssociatedObject

public java.lang.Object getAssociatedObject()
Return null.

Specified by:
getAssociatedObject in interface InequalityTerm
Returns:
null.

getValue

public abstract java.lang.Object getValue()
                                   throws IllegalActionException
Return the result of this monotonic function. Derived classes should implement this method to return the current value of the monotonic function.

Specified by:
getValue in interface InequalityTerm
Returns:
A Type.
Throws:
IllegalActionException - Thrown in derived classes if there is a problem getting the value.
See Also:
setValue(Object)

getVariables

public abstract InequalityTerm[] getVariables()
Return the type variables in this inequality term. Derived classes should implement this method to return an array of InequalityTerms that this function depends on.

Specified by:
getVariables in interface InequalityTerm
Returns:
An array of InequalityTerm.

getVerboseString

public java.lang.String getVerboseString()
Return an additional string describing the current value of this function. Subclasses may override this method to give additional information in the toString() method. This method may return null, indicating that no additional information is desired.

Returns:
null.

initialize

public final void initialize(java.lang.Object e)
                      throws IllegalActionException
Throw an Exception. This method cannot be called on a monotonic function term.

Specified by:
initialize in interface InequalityTerm
Parameters:
e - An Object representing an element in the underlying CPO.
Throws:
IllegalActionException - Always thrown.

isSettable

public final boolean isSettable()
Return false. Monotonic Functions are not settable.

Specified by:
isSettable in interface InequalityTerm
Returns:
False.

isValueAcceptable

public boolean isValueAcceptable()
Return true. Monotonic Functions are, by default, always acceptable. This method might be overridden by derived classes.

Specified by:
isValueAcceptable in interface InequalityTerm
Returns:
True.

setValue

public final void setValue(java.lang.Object e)
                    throws IllegalActionException
Throw an Exception. The value of a function term cannot be set.

Specified by:
setValue in interface InequalityTerm
Parameters:
e - An Object representing an element in the underlying CPO.
Throws:
IllegalActionException - Always thrown.
See Also:
getValue()

toString

public java.lang.String toString()
Override the base class to give a description of this term.

Overrides:
toString in class java.lang.Object
Returns:
A description of this term.