Package ptolemy.actor.util
Class ExtractFieldType
- java.lang.Object
-
- ptolemy.data.type.MonotonicFunction
-
- ptolemy.actor.util.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 anAssociateType
with a field for the specified field name, then the function returns the type of that field. If the port type isBaseType.GENERAL
, then returnBaseType.GENERAL
, or if the type isBaseType.UNKNOWN
, then returnBaseType.UNKNOWN
. If the port type isAssociateType
but it has no corresponding field, then returnBaseType.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 Summary
Constructors Constructor Description ExtractFieldType(TypedIOPort port, java.lang.String name)
Construct a new monotonic function.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Object
getValue()
Return the current value of this monotonic function.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.-
Methods inherited from class ptolemy.data.type.MonotonicFunction
getAssociatedObject, initialize, isSettable, isValueAcceptable, setValue, toString
-
-
-
-
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 fromname
- 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 isBaseType.GENERAL
, then returnBaseType.GENERAL
, or if the type isBaseType.UNKNOWN
, then returnBaseType.UNKNOWN
. If the port type isAssociateType
but it has no corresponding field, then returnBaseType.GENERAL
. Otherwise, throw an exception.- Specified by:
getValue
in interfaceInequalityTerm
- Specified by:
getValue
in classMonotonicFunction
- Returns:
- A Type.
- Throws:
IllegalActionException
- If the port type is notBaseType.UNKNOWN
orBaseType.GENERAL
and is not an instance ofAssociateType
.- 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 classMonotonicFunction
- 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 interfaceInequalityTerm
- Specified by:
getVariables
in classMonotonicFunction
- Returns:
- An array of InequalityTerm.
-
-