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

com.evuv.expressions.NotExpression Maven / Gradle / Ivy

The newest version!
package com.evuv.expressions;

import java.util.LinkedList;
import java.util.List;
import java.util.Map;

import com.evuv.exceptions.EventBindingException;


public class NotExpression implements Expression, BindedExpression {

	protected Expression node;

	public NotExpression(){}
	public NotExpression(Expression node) {
		this.node = node;
	}

	@SuppressWarnings("unchecked")
	@Override
	public Boolean getValue() {
		return !((BindedExpression)node).getValue();
	}

	@SuppressWarnings("rawtypes")
	@Override
	public Expression getLeft() {
		return node;
	}

	@SuppressWarnings({ "rawtypes", "unchecked" })
	@Override
	public void setLeft(Expression left) {
		this.node = left;
		
	}

	@SuppressWarnings("rawtypes")
	@Override
	public Expression getRight() {
		return node;
	}

	@SuppressWarnings({ "rawtypes", "unchecked" })
	@Override
	public void setRight(Expression right) {
		this.node = right;
	}
	
	@Override
	public List toFlatExression() {
		List res = new LinkedList();
		List nodeExpr = node.toFlatExression();
		if (nodeExpr != null ) {
			res.addAll(nodeExpr);
		}
		return res;
	}
	
	@SuppressWarnings("unchecked")
	@Override
	public NotExpression bind(Map event) throws EventBindingException {
		BindedExpression newNode = node.bind(event);
		return new NotExpression((Expression)newNode);
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy