Class ExtractFieldType

  • All Implemented Interfaces:
    InequalityTerm

    public class ExtractFieldType
    extends MonotonicFunction
    A partial monotonic function of the given port that returns a type associated with the given field name, to be found in the type definition of the port.

    The getValue() method is used to get the current value of the function. If the port type is an AssociateType with a field for the specified field name, then the function returns the type of that field. If the port type is BaseType.GENERAL, then return BaseType.GENERAL, or if the type is BaseType.UNKNOWN, then return BaseType.UNKNOWN. If the port type is AssociateType but it has no corresponding field, then return BaseType.GENERAL. Otherwise, the getValue() method throws an exception, which makes the function partial.

    Since:
    Ptolemy II 10.0
    Version:
    $Id$
    Author:
    Edward A. Lee, Marten Lohstroh
    Pt.AcceptedRating:
    Red
    Pt.ProposedRating:
    Red (marten)
    • Constructor Detail

      • ExtractFieldType

        public ExtractFieldType​(TypedIOPort port,
                                java.lang.String name)
        Construct a new monotonic function.
        Parameters:
        port - The port of which the type is extracted the field from
        name - The name of the field of interest
    • Method Detail

      • getValue

        public java.lang.Object getValue()
                                  throws IllegalActionException
        Return the current value of this monotonic function. Specifically, this is a function of one variable, the type variable of the given port. If the port type is BaseType.GENERAL, then return BaseType.GENERAL, or if the type is BaseType.UNKNOWN, then return BaseType.UNKNOWN. If the port type is AssociateType but it has no corresponding field, then return BaseType.GENERAL. Otherwise, throw an exception.
        Specified by:
        getValue in interface InequalityTerm
        Specified by:
        getValue in class MonotonicFunction
        Returns:
        A Type.
        Throws:
        IllegalActionException - If the port type is not BaseType.UNKNOWN or BaseType.GENERAL and is not an instance of AssociateType.
        See Also:
        MonotonicFunction.setValue(Object)
      • getVerboseString

        public java.lang.String getVerboseString()
        Return an additional string describing the current value of this function.
        Overrides:
        getVerboseString in class MonotonicFunction
        Returns:
        null.
      • getVariables

        public InequalityTerm[] getVariables()
        Return the type variables in this inequality term. If the type of the input port is not declared, return a one element array containing the inequality term representing the type of the port; otherwise, return an empty array.
        Specified by:
        getVariables in interface InequalityTerm
        Specified by:
        getVariables in class MonotonicFunction
        Returns:
        An array of InequalityTerm.