📄 binaryoperatortoken.java
字号:
package jmathlib.core.tokens;
/**The base class for all binary operators*/
public class BinaryOperatorToken extends OperatorToken
{
/**Default COnstructor - creates an operator with the value set to ' '*/
public BinaryOperatorToken()
{
super(0);
value = ' ';
}
/**Constructor taking the operator and priority
@param _operator = the type of operator
@param _priority = the priority of the operator*/
public BinaryOperatorToken(char _operator, int _priority)
{
/**call the super constructor, type defaults to ttoperator and operands to 2*/
super(_priority);
value = _operator;
}
/**evaluate the operator
@param operands = the operators operands
@return the result as and OperandToken*/
public OperandToken evaluate(Token[] operands)
{
return null;
}
/**Convert the operator to a string*/
public String toString()
{
return String.valueOf(value);
}
/**Checks if an object is equal to this operator
if object is a binary operator then it checks whether they have the
same value otherwise it calls the super classes version
@param object = the object being tested against
@return true if they are equal*/
public boolean equals(Object object)
{
boolean equal = false;
if(object instanceof BinaryOperatorToken)
equal = (value == ((BinaryOperatorToken)object).value);
else
equal = super.equals(object);
return equal;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -