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

org.hisrc.jscm.codemodel.expression.impl.ConditionalExpressionImpl Maven / Gradle / Ivy

The newest version!
package org.hisrc.jscm.codemodel.expression.impl;

import org.hisrc.jscm.codemodel.JSCodeModel;
import org.hisrc.jscm.codemodel.expression.JSAssignmentExpression;
import org.hisrc.jscm.codemodel.expression.JSConditionalExpression;
import org.hisrc.jscm.codemodel.expression.JSExpressionVisitor;
import org.hisrc.jscm.codemodel.expression.JSLogicalORExpression;
import org.hisrc.jscm.codemodel.lang.Validate;

public abstract class ConditionalExpressionImpl extends
		AssignmentExpressionImpl implements JSConditionalExpression {

	public ConditionalExpressionImpl(JSCodeModel codeModel) {
		super(codeModel);
	}

	public static class ConditionalImpl extends ConditionalExpressionImpl
			implements Conditional {

		private final JSLogicalORExpression condition;
		private final JSAssignmentExpression ifTrue;
		private final JSAssignmentExpression ifFalse;

		public ConditionalImpl(JSCodeModel codeModel,
				JSLogicalORExpression condition, JSAssignmentExpression ifTrue,
				JSAssignmentExpression ifFalse) {
			super(codeModel);
			Validate.notNull(condition);
			Validate.notNull(ifTrue);
			this.condition = condition;
			this.ifTrue = ifTrue;
			this.ifFalse = ifFalse;
		}

		public JSLogicalORExpression getCondition() {
			return condition;
		}

		public JSAssignmentExpression getIfTrue() {
			return ifTrue;
		}

		public JSAssignmentExpression getIfFalse() {
			return ifFalse;
		}

		@Override
		public  V acceptExpressionVisitor(
				JSExpressionVisitor visitor) throws E {
			return visitor.visitConditional(this);
		}

	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy