
com.alibaba.qlexpress4.runtime.operator.unary.MinusMinusSuffixUnaryOperator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of qlexpress4 Show documentation
Show all versions of qlexpress4 Show documentation
QLExpress is a powerful, lightweight, dynamic language for the Java platform aimed at improving
developers’ productivity in different business scenes.
The newest version!
package com.alibaba.qlexpress4.runtime.operator.unary;
import com.alibaba.qlexpress4.QLPrecedences;
import com.alibaba.qlexpress4.exception.ErrorReporter;
import com.alibaba.qlexpress4.runtime.LeftValue;
import com.alibaba.qlexpress4.runtime.Value;
import com.alibaba.qlexpress4.runtime.operator.base.BaseUnaryOperator;
import com.alibaba.qlexpress4.runtime.operator.number.NumberMath;
/**
* @author bingo
*/
public class MinusMinusSuffixUnaryOperator extends BaseUnaryOperator {
private static final MinusMinusSuffixUnaryOperator INSTANCE = new MinusMinusSuffixUnaryOperator();
private MinusMinusSuffixUnaryOperator() {
}
public static MinusMinusSuffixUnaryOperator getInstance() {
return INSTANCE;
}
@Override
public String getOperator() {
return "--";
}
@Override
public int getPriority() {
return QLPrecedences.UNARY_SUFFIX;
}
@Override
public Object execute(Value value, ErrorReporter errorReporter) {
Object operand = value.get();
if (!(operand instanceof Number)) {
throw buildInvalidOperandTypeException(value, errorReporter);
}
Number result = NumberMath.subtract((Number)operand, 1);
if (value instanceof LeftValue) {
((LeftValue)value).set(result, errorReporter);
}
return result;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy