ptolemy.graph
Interface InequalityTerm

All Known Implementing Classes:
AbsoluteValue.FunctionTerm, AbstractActionsAttribute.TypeFunction, AbstractActionsAttribute.TypeFunction, ActorTypeUtil.TypeableSizedArrayVariableTypeTerm, ArrayType.ArrayBottomTypeTerm, ArrayType.ElementTypeTerm, ArrayType.TypeableArrayTypeTerm, ArrayType.TypeableElementTypeTerm, ArrayType.TypeableSizedArrayTypeTerm, Autocorrelation.FunctionTerm, Autocorrelation.FunctionTerm, Autocorrelation.OutputTypeTerm, Autocorrelation.OutputTypeTerm, DotProduct.PortFunction, Expression.OutputTypeFunction, FIR.OutputTypeFunction, FunctionType.FieldTypeTerm, MatrixToSequence.FunctionTerm, MonotonicFunction, RecordDisassembler.PortFunction, RecordType.FieldType, RecordUpdater.FunctionTerm, SequenceToMatrix.FunctionTerm, TypeConstant, TypedIOPort.TypeTerm, UnionDisassembler.PortFunction, UnionType.FieldType, Variable.TypeTerm

public interface InequalityTerm

An interface for a term in an inequality over a CPO. A term is either a constant, a variable, or a function. In some applications, a term may be associated with an Object. For example, the value of the term may represent a certain characteristic of an Object, and it is necessary to get a reference of that Object from a term. This can be done through the getAssociatedObject() method of this interface.

Since:
Ptolemy II 0.2
Version:
$Id: InequalityTerm.java 57040 2010-01-27 20:52:32Z cxh $
Author:
Yuhong Xiong
See Also:
CPO
Accepted Rating:
Green (kienhuis)
Proposed Rating:
Green (yuhong)

Method Summary
 java.lang.Object getAssociatedObject()
          Return the Object associated with this term.
 java.lang.Object getValue()
          Return the value of this term.
 InequalityTerm[] getVariables()
          Return an array of variables contained in this term.
 void initialize(java.lang.Object e)
          Initialize the value of this term to the specified CPO element.
 boolean isSettable()
          Check whether this term can be set to a specific element of the underlying CPO.
 boolean isValueAcceptable()
          Check whether the current value of this term is acceptable, and return true if it is.
 void setValue(java.lang.Object e)
          Set the value of this term to the specified CPO element.
 

Method Detail

getAssociatedObject

java.lang.Object getAssociatedObject()
Return the Object associated with this term. If this term is not associated with a particular Object, or it is not necessary to obtain the reference of the associated Object, this method can return null.

Returns:
The associated Object.

getValue

java.lang.Object getValue()
                          throws IllegalActionException
Return the value of this term. If this term is a constant, return that constant; if this term is a variable, return the current value of that variable; if this term is a function, return the evaluation of that function based on the current value of variables in the function.

Returns:
An Object representing an element in the underlying CPO.
Throws:
IllegalActionException - If the value of this inequality term is not valid.
See Also:
setValue(Object)

getVariables

InequalityTerm[] getVariables()
Return an array of variables contained in this term. If this term is a constant, return an array of size zero; if this term is a variable, return an array of size one that contains this variable; if this term is a function, return an array containing all the variables in the function.

Returns:
An array of InequalityTerms

initialize

void initialize(java.lang.Object e)
                throws IllegalActionException
Initialize the value of this term to the specified CPO element. If this InequalityTerm is a simple variable that can be set to any CPO element, set the value of the variable to the specified argument. In this case, this method is equivalent to setValue() with the same argument. In some applications, this term is a structured object that only part of it is a simple variable. In this case, set that variable part to the specified argument.

Parameters:
e - An Object representing an element in the underlying CPO.
Throws:
IllegalActionException - If this term is not a variable.

isSettable

boolean isSettable()
Check whether this term can be set to a specific element of the underlying CPO. Only variable terms are settable, constant and function terms are not.

Returns:
True if this term is a variable; false otherwise.

isValueAcceptable

boolean isValueAcceptable()
Check whether the current value of this term is acceptable, and return true if it is.

Returns:
True if the current value is acceptable.

setValue

void setValue(java.lang.Object e)
              throws IllegalActionException
Set the value of this term to the specified CPO element. Only terms consisting of a single variable can have their values set.

Parameters:
e - An Object representing an element in the underlying CPO.
Throws:
IllegalActionException - If this term is not a variable.
See Also:
getValue()