delimitertoken.java
来自「JAVA 数学程序库 提供常规的数值计算程序包」· Java 代码 · 共 58 行
JAVA
58 行
package jmathlib.core.tokens;
import jmathlib.core.constants.TokenConstants;
/*Class used to represent delimiter tokens such as ( ) and ,*/
public class DelimiterToken extends OperandToken implements TokenConstants
{
/**Character representing the delimiter*/
public char value;
private String wordValue;
/**param _value = the value of the delimiter as a char*/
public DelimiterToken(char _value)
{
super(0); //, "Delimiter");
value = _value;
wordValue = "";
}
/**param _value = the value of the delimiter as a string*/
public DelimiterToken(String _value)
{
super(0); //, "Delimiter");
value = '-';
wordValue = _value;
}
/**Evaluate the delimiter, just returns the object itself
@param operands = the delimiters operands
@return the delimter token as an OperandToken*/
public OperandToken evaluate(Token[] operands)
{
return this;
}
/**@return the value of the delimiter as a string*/
public String toString()
{
return String.valueOf(value) + wordValue;
}
/**Checks if this operand is a numeric value
@return true if this is a number, false if it's
an algebraic expression*/
public boolean isNumeric()
{
return true;
}
//accessor functions
/**@return the value of wordValue*/
public String getWordValue()
{
return wordValue;
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?