All Downloads are FREE. Search and download functionalities are using the official Maven repository.

panda.el.opt.logic.NullableOpt Maven / Gradle / Ivy

Go to download

Panda Core is the core module of Panda Framework, it contains commonly used utility classes similar to apache-commons.

There is a newer version: 1.8.0
Show newest version
package panda.el.opt.logic;

import java.util.Queue;

import panda.el.ELContext;
import panda.el.opt.AbstractOpt;

public class NullableOpt extends AbstractOpt {

	private Object right;

	@Override
	public int getPriority() {
		return 7;
	}

	@Override
	public void wrap(Queue rpn) {
		right = rpn.poll();
	}

	@Override
	public Object calculate(ELContext ec) {
		try {
			return calculateItem(ec, right);
		}
		catch (Throwable e) {
			return null;
		}
	}

	@Override
	public String operator() {
		return "!!";
	}

}