Class 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)
    • 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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • MonotonicFunction

        public MonotonicFunction()
    • Method Detail

      • 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 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. 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 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.
      • 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.