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.Object
getAssociatedObject()
Return null.abstract java.lang.Object
getValue()
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.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.
-
-
-
Method Detail
-
getAssociatedObject
public java.lang.Object getAssociatedObject()
Return null.- Specified by:
getAssociatedObject
in interfaceInequalityTerm
- Returns:
- null.
-
getValue
public abstract java.lang.Object getValue() throws IllegalActionException
Return 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:
getValue
in 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:
getVariables
in 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 IllegalActionException
Throw an Exception. This method cannot be called on a monotonic function term.- Specified by:
initialize
in 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:
isSettable
in 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:
isValueAcceptable
in interfaceInequalityTerm
- 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 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:
toString
in classjava.lang.Object
- Returns:
- A description of this term.
-
-