Package ptolemy.graph.test
Class TestConstant
- java.lang.Object
-
- ptolemy.graph.test.TestConstant
-
- All Implemented Interfaces:
InequalityTerm
public class TestConstant extends java.lang.Object implements InequalityTerm
A constant InequalityTerm. This class is for testing inequality related classes. The value of this InequalityTerm is a String set in the constructor. This term has name, which is used for printing test result.- Since:
- Ptolemy II 0.2
- Version:
- $Id$
- Author:
- Yuhong Xiong
- Pt.AcceptedRating:
- Red (cxh)
- Pt.ProposedRating:
- Red (cxh)
-
-
Constructor Summary
Constructors Constructor Description TestConstant(java.lang.String value)Construct a constant InequalityTerm with a String value.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidfixValue()Do nothing.java.lang.ObjectgetAssociatedObject()Return the string value.java.lang.StringgetInfo()Return the information of this term.java.lang.ObjectgetValue()Return the constant String value of this term.InequalityTerm[]getVariables()Return an array of size zero.voidinitialize(java.lang.Object e)Throw an Exception.booleanisSettable()Return false.booleanisValueAcceptable()Check whether the current value of this term is acceptable, and return true if it is.voidsetName(java.lang.String name)Set the name of this constant.voidsetValue(java.lang.Object e)Throw an Exception.java.lang.StringtoString()Override the base class to describe the constant.voidunfixValue()Do nothing.
-
-
-
Method Detail
-
fixValue
public void fixValue()
Do nothing.
-
getAssociatedObject
public java.lang.Object getAssociatedObject()
Return the string value.- Specified by:
getAssociatedObjectin interfaceInequalityTerm- Returns:
- A String
-
getInfo
public java.lang.String getInfo()
Return the information of this term. The information is a String of the form: name(constant)_value.- Returns:
- A String
-
getValue
public java.lang.Object getValue()
Return the constant String value of this term.- Specified by:
getValuein interfaceInequalityTerm- Returns:
- a String
- See Also:
setValue(Object)
-
getVariables
public InequalityTerm[] getVariables()
Return an array of size zero.- Specified by:
getVariablesin interfaceInequalityTerm- Returns:
- an array of InequalityTerms
-
isSettable
public boolean isSettable()
Return false.- Specified by:
isSettablein interfaceInequalityTerm- Returns:
- false
-
initialize
public void initialize(java.lang.Object e) throws GraphActionExceptionThrow an Exception.- Specified by:
initializein interfaceInequalityTerm- Parameters:
e- An Object representing an element in the underlying CPO.- Throws:
GraphActionException- Always thrown since this term is a constant.
-
isValueAcceptable
public boolean isValueAcceptable()
Check whether the current value of this term is acceptable, and return true if it is. In this class, a value is always acceptable.- Specified by:
isValueAcceptablein interfaceInequalityTerm- Returns:
- True.
-
setName
public void setName(java.lang.String name)
Set the name of this constant. If the specified String is null, Set the name to an empty String.- Parameters:
name- The name of this constant.
-
setValue
public void setValue(java.lang.Object e) throws GraphActionExceptionThrow an Exception.- Specified by:
setValuein interfaceInequalityTerm- Parameters:
e- an Object. Ignored by this method.- Throws:
GraphActionException- always thrown.- See Also:
getValue()
-
toString
public java.lang.String toString()
Override the base class to describe the constant.- Overrides:
toStringin classjava.lang.Object- Returns:
- A string describing the constant
-
unfixValue
public void unfixValue()
Do nothing.
-
-