Package ptolemy.data.type
Class MonotonicFunction
- java.lang.Object
-
- ptolemy.data.type.MonotonicFunction
-
- All Implemented Interfaces:
InequalityTerm
- Direct Known Subclasses:
ArrayElementTypeFunction,ArrayOfTypesFunction,ConstructAssociativeType,ExtractFieldType,GLBFunction
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$
- Author:
- Steve Neuendorffer
- Pt.AcceptedRating:
- Red (neuendor)
- Pt.ProposedRating:
- Yellow (neuendor)
-
-
Constructor Summary
Constructors Constructor Description MonotonicFunction()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description java.lang.ObjectgetAssociatedObject()Return null.abstract java.lang.ObjectgetValue()Return the current value of this monotonic function given the current value of the variables returned by getVariables().abstract InequalityTerm[]getVariables()Return the type variables in this inequality term.java.lang.StringgetVerboseString()Return an additional string describing the current value of this function.voidinitialize(java.lang.Object e)Throw an Exception.booleanisSettable()Return false.booleanisValueAcceptable()Return true.voidsetValue(java.lang.Object e)Throw an Exception.java.lang.StringtoString()Override the base class to give a description of this term.
-
-
-
Method Detail
-
getAssociatedObject
public java.lang.Object getAssociatedObject()
Return null.- Specified by:
getAssociatedObjectin interfaceInequalityTerm- Returns:
- null.
-
getValue
public abstract java.lang.Object getValue() throws IllegalActionExceptionReturn the current value of this monotonic function given the current value of the variables returned by getVariables(). Derived classes should implement this method to return the current value of the monotonic function.- Specified by:
getValuein interfaceInequalityTerm- 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. These are the variables on which the value of the function depends. Derived classes should implement this method to return an array of InequalityTerms that this function depends on.- Specified by:
getVariablesin interfaceInequalityTerm- 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 IllegalActionExceptionThrow an Exception. This method cannot be called on a monotonic function term.- Specified by:
initializein interfaceInequalityTerm- 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:
isSettablein interfaceInequalityTerm- 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:
isValueAcceptablein interfaceInequalityTerm- Returns:
- True.
-
setValue
public final void setValue(java.lang.Object e) throws IllegalActionExceptionThrow an Exception. The value of a function term cannot be set.- Specified by:
setValuein interfaceInequalityTerm- 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:
toStringin classjava.lang.Object- Returns:
- A description of this term.
-
-