Package ptolemy.data.ontologies
Class ConceptFunction
- java.lang.Object
-
- ptolemy.data.ontologies.ConceptFunction
-
- Direct Known Subclasses:
ApplyBinaryFunctionToMultipleArguments
,ConceptFromRecordField
,ConstPropagationAbsIntLessThan
,ConstPropagationAbsIntMathFunctions
,ConstPropagationMathFunctions
,ExpressionConceptFunction
,MonotonicityConceptFunction
,MultiplyOrDivideUnitConcepts
,ProductLatticeDerivedConceptFunction
,ProductLatticeWrapperConceptFunction
,RecordFromIndividualConcepts
public abstract class ConceptFunction extends java.lang.Object
The base class for concept functions that are used for ontology constraints. A concept function is a function over a set of concept values in an ontology. It takes a list of input concepts from specified ontologies and returns an output concept from a specified ontology. The concept inputs and outputs need not necessarily be from the same ontology. Derived classes must implement the protected _evaluateFunction method to provide the output concept given an input array of concepts.- Since:
- Ptolemy II 10.0
- Version:
- $Id$
- Author:
- Charles Shelton
- Pt.AcceptedRating:
- Red (cshelton)
- Pt.ProposedRating:
- Green (cshelton)
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.List<Ontology>
_argumentDomainOntologies
The list of ontologies that specify the domain for each input argument to the concept function.protected java.lang.String
_name
The name of the concept function.protected boolean
_numArgsIsFixed
Flag that indicates whether or not the number of arguments for this concept function is fixed or variable.protected Ontology
_outputRangeOntology
The ontology that specifies the range of concepts that can be output by this concept function.
-
Constructor Summary
Constructors Constructor Description ConceptFunction(java.lang.String name, boolean numArgsIsFixed, java.util.List<Ontology> argumentDomainOntologies, Ontology outputRangeOntology)
Create the concept function with the number of arguments it takes and the ontologies from which input and output concepts can be taken.ConceptFunction(java.lang.String name, int numArgs, Ontology inputOutputOntology)
Create the concept function where all arguments and output values are drawn from the same ontology.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract Concept
_evaluateFunction(java.util.List<Concept> argValues)
Return the output of the concept function based on the concept inputs.Concept
evaluateFunction(java.util.List<Concept> argValues)
Return the output of the concept function based on the concept inputs.java.util.List<Ontology>
getArgumentDomainOntologies()
Return the array of ontologies that represent the domains for the input arguments to the concept function.java.lang.String
getName()
Return the name of the concept function.int
getNumberOfArguments()
Return the number of input arguments for this concept function, or -1 if the concept function can take a variable number of arguments.Ontology
getOutputRangeOntology()
Return the ontology that represents the range of concepts that can be output by this concept function.boolean
isMonotonic()
Determine whether the concept function is monotonic over the ontology for the output range and all the inputs that are also in that same ontology.boolean
isNumberOfArgumentsFixed()
Return true if this concept function has a fixed number of arguments, false otherwise.java.lang.String
toString()
Return a string representing the name of this concept function.
-
-
-
Field Detail
-
_argumentDomainOntologies
protected java.util.List<Ontology> _argumentDomainOntologies
The list of ontologies that specify the domain for each input argument to the concept function. The size of this list indicates the number of arguments for the function if it has a fixed argument list.
-
_name
protected java.lang.String _name
The name of the concept function.
-
_numArgsIsFixed
protected boolean _numArgsIsFixed
Flag that indicates whether or not the number of arguments for this concept function is fixed or variable.
-
_outputRangeOntology
protected Ontology _outputRangeOntology
The ontology that specifies the range of concepts that can be output by this concept function.
-
-
Constructor Detail
-
ConceptFunction
public ConceptFunction(java.lang.String name, boolean numArgsIsFixed, java.util.List<Ontology> argumentDomainOntologies, Ontology outputRangeOntology) throws IllegalActionException
Create the concept function with the number of arguments it takes and the ontologies from which input and output concepts can be taken.- Parameters:
name
- The name of the concept function.numArgsIsFixed
- True if the number of arguments for this function is fixed and cannot change, false otherwise.argumentDomainOntologies
- The list of ontologies that represent the concept domain for each input concept argument.outputRangeOntology
- The ontology that represents the range of output concepts for this concept function.- Throws:
IllegalActionException
- If the output ontology is null.
-
ConceptFunction
public ConceptFunction(java.lang.String name, int numArgs, Ontology inputOutputOntology) throws IllegalActionException
Create the concept function where all arguments and output values are drawn from the same ontology.- Parameters:
name
- The name of the concept function.numArgs
- The number of arguments for this function, if this number is fixed, and -1 otherwise.inputOutputOntology
- The ontology that represents the domain and range for this concept function.- Throws:
IllegalActionException
- If the output ontology is null, or numArgs is invalid.
-
-
Method Detail
-
evaluateFunction
public Concept evaluateFunction(java.util.List<Concept> argValues) throws IllegalActionException
Return the output of the concept function based on the concept inputs.- Parameters:
argValues
- The list of concept inputs to the function.- Returns:
- The concept output result of the function.
- Throws:
IllegalActionException
- If there is an error with the input argument array or evaluating the function.
-
getArgumentDomainOntologies
public java.util.List<Ontology> getArgumentDomainOntologies()
Return the array of ontologies that represent the domains for the input arguments to the concept function.- Returns:
- The array of ontologies that represent the domains for the input arguments to the concept function.
-
getName
public java.lang.String getName()
Return the name of the concept function.- Returns:
- The name of the concept function.
-
getNumberOfArguments
public int getNumberOfArguments()
Return the number of input arguments for this concept function, or -1 if the concept function can take a variable number of arguments.- Returns:
- The number of arguments taken as input for this function.
-
getOutputRangeOntology
public Ontology getOutputRangeOntology()
Return the ontology that represents the range of concepts that can be output by this concept function.- Returns:
- The ontology that represents the range of concepts that can be output by this concept function.
-
isMonotonic
public boolean isMonotonic()
Determine whether the concept function is monotonic over the ontology for the output range and all the inputs that are also in that same ontology. Some of the input arguments to the function might be in other domain ontologies that are not the same as the output ontology range, so those arguments are not considered for determining monotonicity.- Returns:
- true if the concept function is monotonic, false otherwise.
-
isNumberOfArgumentsFixed
public boolean isNumberOfArgumentsFixed()
Return true if this concept function has a fixed number of arguments, false otherwise.- Returns:
- True if the function has a fixed number of arguments, false otherwise.
-
toString
public java.lang.String toString()
Return a string representing the name of this concept function.- Overrides:
toString
in classjava.lang.Object
- Returns:
- A string representing the name of this concept function.
-
_evaluateFunction
protected abstract Concept _evaluateFunction(java.util.List<Concept> argValues) throws IllegalActionException
Return the output of the concept function based on the concept inputs. Derived classes must implement this method to provide the definition of the concept function.- Parameters:
argValues
- The list of concept inputs to the function.- Returns:
- The concept output result of the function.
- Throws:
IllegalActionException
- If there is an error evaluating the function.
-
-