package com.jfireel.expression.node.impl;

import com.jfireel.expression.node.CalculateNode;
import com.jfireel.expression.token.Operator;
import com.jfireel.expression.token.TokenType;

import java.util.Map;

public class OperatorNode implements CalculateNode {
	private Operator operatorType;

	public OperatorNode(Operator operatorType) {
		this.operatorType = operatorType;
	}

	// 操作符节点不会有计算动作
	@Override
	public Object calculate(Map<String, Object> variables) {
		throw new UnsupportedOperationException();
	}

	@Override
	public TokenType type() {
		return operatorType;
	}

	@Override
	public String literals() {
		return operatorType.getLiterals();
	}

	@Override
	public String toString() {
		return literals();
	}
}
