com.att.research.xacmlatt.pdp.policy.CombiningElement Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of xacml-pdp Show documentation
Show all versions of xacml-pdp Show documentation
ATT reference implementation of XACML PDP engine
The newest version!
/*
*
* Copyright (c) 2013,2019 AT&T Knowledge Ventures
* SPDX-License-Identifier: MIT
*/
package com.att.research.xacmlatt.pdp.policy;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import com.att.research.xacmlatt.pdp.eval.Evaluatable;
import com.att.research.xacmlatt.pdp.eval.EvaluationContext;
import com.att.research.xacmlatt.pdp.eval.EvaluationException;
import com.att.research.xacmlatt.pdp.eval.EvaluationResult;
/**
* CombiningElement wraps an {@link com.att.research.xacmlatt.pdp.eval.Evaluatable} with a set of
* {@link com.att.research.xacmlatt.pdp.policy.TargetedCombinerParameter}s for use with a
* {@link com.att.research.xacmlatt.pdp.policy.CombiningAlgorithm} to get a combined {@link com.att.research.xacmlatt.pdp.eval.EvaluationResult}
*
* @author car
* @version $Revision: 1.1 $
*
* @param the java class extending Evaluatable
of the objects to be combined
*/
public class CombiningElement {
private T evaluatable;
private List targetedCombinerParameters;
/**
* Creates a new CombiningElement
with the given Evaluatable
and List
of
* TargetedCombinerParameter
.
*
* @param evaluatableIn the Evaluatable
* @param targetedCombinerParametersIn the List
of TargetedCombinerParameter
s.
*/
public CombiningElement(T evaluatableIn, Collection targetedCombinerParametersIn) {
this.evaluatable = evaluatableIn;
if (targetedCombinerParametersIn != null) {
this.targetedCombinerParameters = new ArrayList<>();
this.targetedCombinerParameters.addAll(targetedCombinerParametersIn);
}
}
/**
* Gets the Evaluatable
for this CombiningElement
.
*
* @return the Evaluatable
for this CombiningElement
*/
public T getEvaluatable() {
return this.evaluatable;
}
/**
* Gets an Iterator
over the TargetedCombinerParameters
for this
* CombiningElement
.
*
* @return an Iterator
over the TargetedCombinerParameters
for this CombiningElement
*/
public Iterator getTargetedCombinerParameters() {
return (this.targetedCombinerParameters == null ? null : this.targetedCombinerParameters.iterator());
}
/**
* Evaluates this CombiningElement
in the given {@link com.att.research.xacmlatt.pdp.eval.EvaluationContext}.
*
* @param evaluationContext the EvaluationContext
* @return the {@link com.att.research.xacmlatt.pdp.eval.EvaluationResult} from the Evaluatable
* @throws EvaluationException if there is an error in the evaluate
method of the Evaluatable
*/
public EvaluationResult evaluate(EvaluationContext evaluationContext) throws EvaluationException {
return this.getEvaluatable().evaluate(evaluationContext);
}
}