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 anAssociateTypewith 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 isAssociateTypebut 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.ObjectgetValue()Return the current value of this monotonic function.InequalityTerm[]getVariables()Return the type variables in this inequality term.java.lang.StringgetVerboseString()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 IllegalActionExceptionReturn 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 isAssociateTypebut it has no corresponding field, then returnBaseType.GENERAL. Otherwise, throw an exception.- Specified by:
getValuein interfaceInequalityTerm- Specified by:
getValuein classMonotonicFunction- Returns:
- A Type.
- Throws:
IllegalActionException- If the port type is notBaseType.UNKNOWNorBaseType.GENERALand 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:
getVerboseStringin 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:
getVariablesin interfaceInequalityTerm- Specified by:
getVariablesin classMonotonicFunction- Returns:
- An array of InequalityTerm.
-
-