Package ptolemy.graph.test
Class TestVariable
- java.lang.Object
-
- ptolemy.graph.test.TestVariable
-
- All Implemented Interfaces:
InequalityTerm
public class TestVariable extends java.lang.Object implements InequalityTerm
A variable InequalityTerm. This class is for testing inequality related classes. The value of this InequalityTerm is a String. 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 TestVariable()Construct a variable InequalityTerm with a null initial value.TestVariable(java.lang.String value)Construct a variable InequalityTerm with the specified initial value.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidfixValue()Disallow the value of this term to be set.java.lang.ObjectgetAssociatedObject()Return the string value.java.lang.StringgetInfo()Return the information of this term.java.lang.ObjectgetValue()Return the String value of this term.InequalityTerm[]getVariables()Return an array of size one.voidinitialize(java.lang.Object e)Set the value of this variable to the specified String.booleanisSettable()Return true.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 variable.voidsetValue(java.lang.Object e)Set the value of this variable to the specified String.java.lang.StringtoString()Override the base class to describe the variable.voidunfixValue()Allow the value of this term to be changed.
-
-
-
Method Detail
-
fixValue
public void fixValue()
Disallow the value of this term to be set.
-
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(variable)_value.- Returns:
- A String
-
getValue
public java.lang.Object getValue()
Return the 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 one. The element of the array is the this reference.- Specified by:
getVariablesin interfaceInequalityTerm- Returns:
- an array of InequalityTerms
-
initialize
public void initialize(java.lang.Object e) throws GraphActionExceptionSet the value of this variable to the specified String.- Specified by:
initializein interfaceInequalityTerm- Parameters:
e- a String- Throws:
GraphActionException- not thrown
-
isSettable
public boolean isSettable()
Return true.- Specified by:
isSettablein interfaceInequalityTerm- Returns:
- true
-
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 variable. If the specified String is null, Set the name to an empty String.- Parameters:
name- The name of this variable.
-
setValue
public void setValue(java.lang.Object e) throws GraphActionExceptionSet the value of this variable to the specified String.- Specified by:
setValuein interfaceInequalityTerm- Parameters:
e- a String- Throws:
GraphActionException- not thrown- See Also:
getValue()
-
toString
public java.lang.String toString()
Override the base class to describe the variable.- Overrides:
toStringin classjava.lang.Object- Returns:
- A string describing the variable.
-
unfixValue
public void unfixValue()
Allow the value of this term to be changed.
-
-