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

com.att.research.xacmlatt.pdp.policy.ExpressionResultBoolean Maven / Gradle / Ivy

There is a newer version: 4.0.0
Show newest version
/*
 *
 *          Copyright (c) 2013,2019  AT&T Knowledge Ventures
 *                     SPDX-License-Identifier: MIT
 */
package com.att.research.xacmlatt.pdp.policy;

import com.att.research.xacml.api.AttributeValue;
import com.att.research.xacml.api.Status;
import com.att.research.xacml.std.StdStatus;
import com.att.research.xacml.std.datatypes.DataTypeBoolean;

/**
 * ExpressionResultBoolean extends {@link com.att.research.xacmlatt.pdp.policy.ExpressionResult} to represent predicates.
 * 
 * @author car
 * @version $Revision: 1.1 $
 */
public class ExpressionResultBoolean extends ExpressionResult {
	private AttributeValue	value;
	public static final ExpressionResultBoolean	ERB_FALSE						= new ExpressionResultBoolean(false);
	public static final ExpressionResultBoolean	ERB_TRUE						= new ExpressionResultBoolean(true);
	
	public ExpressionResultBoolean(Status statusIn) {
		super(statusIn);
	}
	
	public ExpressionResultBoolean(boolean bvalue) {
		super(StdStatus.STATUS_OK);
		this.value	= (bvalue ? DataTypeBoolean.AV_TRUE : DataTypeBoolean.AV_FALSE);
	}
	
	/**
	 * Gets the boolean value of this ExpressionResultBoolean
	 * 
	 * @return the boolean value of this ExpressionResultBoolean
	 */
	public boolean isTrue() {
		if (this.value == null) {
			return false;
		} else {
			return this.value.getValue().booleanValue();
		}
	}

	@Override
	public AttributeValue getValue() {
		return this.value;
	}

	@Override
	public boolean isBag() {
		return false;
	}

	@Override
	public Bag getBag() {
		return null;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy