SunTM's XACML Implementation for JavaTM

com.sun.xacml.cond
Class NOfFunction

java.lang.Object
  extended bycom.sun.xacml.cond.FunctionBase
      extended bycom.sun.xacml.cond.NOfFunction
All Implemented Interfaces:
Function

public class NOfFunction
extends FunctionBase

A class that implements the n-of function. It requires at least one argument. The first argument must be an integer and the rest of the arguments must be booleans. If the number of boolean arguments that evaluate to true is at least the value of the first argument, the function returns true. Otherwise, it returns false (or indeterminate, as described in the next paragraph.

This function evaluates the arguments one at a time, starting with the first one. As soon as the result of the function can be determined, evaluation stops and that result is returned. During this process, if any argument evaluates to indeterminate, an indeterminate result is returned.

Since:
1.0

Field Summary
static String NAME_N_OF
          Standard identifier for the n-of function.
 
Fields inherited from class com.sun.xacml.cond.FunctionBase
FUNCTION_NS
 
Constructor Summary
NOfFunction(String functionName)
          Creates a new NOfFunction object.
 
Method Summary
 void checkInputs(List inputs)
          Default handling of input checking.
 void checkInputsNoBag(List inputs)
          Default handling of input checking.
 EvaluationResult evaluate(List inputs, EvaluationCtx context)
          Evaluate the function, using the specified parameters.
static Set getSupportedIdentifiers()
          Returns a Set containing all the function identifiers supported by this class.
 
Methods inherited from class com.sun.xacml.cond.FunctionBase
evalArgs, getFunctionId, getFunctionName, getIdentifier, getReturnType, getReturnTypeAsString, makeProcessingError, returnsBag
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NAME_N_OF

public static final String NAME_N_OF
Standard identifier for the n-of function.

See Also:
Constant Field Values
Constructor Detail

NOfFunction

public NOfFunction(String functionName)
Creates a new NOfFunction object.

Parameters:
functionName - the standard XACML name of the function to be handled by this object, including the full namespace
Throws:
IllegalArgumentException - if the function is unknown
Method Detail

getSupportedIdentifiers

public static Set getSupportedIdentifiers()
Returns a Set containing all the function identifiers supported by this class.

Returns:
a Set of Strings

evaluate

public EvaluationResult evaluate(List inputs,
                                 EvaluationCtx context)
Evaluate the function, using the specified parameters.

Parameters:
inputs - a List of Evaluatable objects representing the arguments passed to the function
context - an EvaluationCtx so that the Evaluatable objects can be evaluated
Returns:
an EvaluationResult representing the function's result

checkInputs

public void checkInputs(List inputs)
                 throws IllegalArgumentException
Description copied from class: FunctionBase
Default handling of input checking. This does some simple checking based on the type of constructor used. If you need anything more complex, or if you used the simple constructor, then you must override this method.

Specified by:
checkInputs in interface Function
Overrides:
checkInputs in class FunctionBase
Parameters:
inputs - a List> of Evaluatables
Throws:
IllegalArgumentException - if the inputs won't work

checkInputsNoBag

public void checkInputsNoBag(List inputs)
                      throws IllegalArgumentException
Description copied from class: FunctionBase
Default handling of input checking. This does some simple checking based on the type of constructor used. If you need anything more complex, or if you used the simple constructor, then you must override this method.

Specified by:
checkInputsNoBag in interface Function
Overrides:
checkInputsNoBag in class FunctionBase
Parameters:
inputs - a List> of Evaluatables
Throws:
IllegalArgumentException - if the inputs won't work

Sun's XACML Implementation Version 1.2

Copyright 2003-2004 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.

Sun, Sun Microsystems, the Sun Logo, and Java are trademarks or registered trademarks of Sun Microsystems, Inc. in the US and other countries.