Examples of EvaluationResult


Examples of com.sun.xacml.cond.EvaluationResult

        // Get the list of attribute finders who are registered with this particular attribute.
        List<PIPAttributeFinder> finders = attrFinders.get(attributeId.toString());

        if (finders == null || finders.size() == 0) {
            log.info("No attribute designators defined for the attribute " + attributeId.toString());
            return new EvaluationResult(BagAttribute.createEmptyBag(attributeType));
        }

        List<AttributeValue> attrBag = new ArrayList<AttributeValue>();
        EvaluationResult subject = null;
        String subjectId = null;
        EvaluationResult resource = null;
        String resourceId = null;

        try {
            subject = context.getSubjectAttribute(new URI(StringAttribute.identifier), new URI(
                    "urn:oasis:names:tc:xacml:1.0:subject:subject-id"), subjectCategory);
            if (subject.getAttributeValue().isBag()) {
                BagAttribute attr = (BagAttribute) subject.getAttributeValue();
                for (Iterator iterator = attr.iterator(); iterator.hasNext();) {
                    AttributeValue val = (AttributeValue) iterator.next();
                    subjectId = val.encode();
                    if (log.isDebugEnabled()) {
                        log.debug(String.format("Finding attributes for the subject %1$s",
                                subjectId));
                    }
                    break;
                }

            }

            resource = context.getResourceAttribute(new URI(StringAttribute.identifier), new URI(
                    "urn:oasis:names:tc:xacml:1.0:resource:resource-id"), null);
            if (resource.getAttributeValue().isBag()) {
                BagAttribute attr = (BagAttribute) resource.getAttributeValue();
                for (Iterator iterator = attr.iterator(); iterator.hasNext();) {
                    AttributeValue val = (AttributeValue) iterator.next();
                    resourceId = val.encode();
                    if (log.isDebugEnabled()) {
                        log.debug(String.format("Finding attributes for the resource %1$s",
                                resourceId));
                    }
                    break;
                }

            }

            for (Iterator iterator = finders.iterator(); iterator.hasNext();) {
                PIPAttributeFinder pipAttributeFinder = (PIPAttributeFinder) iterator.next();
                if (log.isDebugEnabled()) {
                    log.debug(String.format(
                            "Finding attributes with the PIP attribute handler %1$s",
                            pipAttributeFinder.getClass()));
                }
                Set<String> attrs = pipAttributeFinder.getAttributeValues(subjectId, resourceId,
                        attributeId.toString());
                if (attrs != null) {
                    for (Iterator iterAttr = attrs.iterator(); iterAttr.hasNext();) {
                        final String attr = (String) iterAttr.next();
                        AttributeValue attribute = getAttribute(attr, attributeType.toString());
                        attrBag.add(attribute);
                    }
                }
            }

        } catch (Exception e) {
            log.error("Error occured while finding attributes via PIP", e);
            return new EvaluationResult(BagAttribute.createEmptyBag(attributeType));
        }

        return new EvaluationResult(new BagAttribute(attributeType, attrBag));
    }
View Full Code Here

Examples of de.jungblut.classification.eval.Evaluator.EvaluationResult

  @Override
  public void onIterationFinished(int iteration, double cost,
      DoubleVector currentWeights) {
    if (iteration % runInterval == 0) {
      A classifier = mapper.mapWeights(currentWeights);
      EvaluationResult testEval = Evaluator.testClassifier(classifier,
          split.getTestFeatures(), split.getTestOutcome());
      EvaluationResult trainEval = Evaluator.testClassifier(classifier,
          split.getTrainFeatures(), split.getTrainOutcome());
      onResult(iteration, cost, trainEval, testEval);
      print(iteration, cost, trainEval, testEval);
    }
  }
View Full Code Here

Examples of flex.tools.debugger.cli.ExpressionCache.EvaluationResult

  EvaluationResult evalExpression(ValueExp expr) { return evalExpression(expr, true); }

  EvaluationResult evalExpression(ValueExp expr, boolean displayExceptions)
  {
    /* now we go off and evaluate the expression */
    EvaluationResult result = null;
    try
    {
      result = m_exprCache.evaluate(expr);
    }
    catch(NoSuchVariableException nsv)
View Full Code Here

Examples of org.eclipse.core.expressions.EvaluationResult

  public final boolean isEnabled(IEvaluationContext context) {
    final CommandLegacyActionWrapper action = getAction();
    if (enabledWhenExpression != null) {
      try {
        final EvaluationResult result = enabledWhenExpression
            .evaluate(context);
        if (result == EvaluationResult.TRUE) {
          updateDelegate(action, context);
          return (action == null)
              || action.isEnabledDisregardingCommand();
View Full Code Here

Examples of org.eclipse.core.expressions.EvaluationResult

  }
 
  protected EvaluationResult evaluateAnd(IEvaluationContext scope) throws CoreException {
    if (fExpressions == null)
      return EvaluationResult.TRUE;
    EvaluationResult result= EvaluationResult.TRUE;
    for (Iterator iter= fExpressions.iterator(); iter.hasNext();) {
      Expression expression= (Expression)iter.next();
      result= result.and(expression.evaluate(scope));
      // keep iterating even if we have a not loaded found. It can be
      // that we find a false which will result in a better result.
      if (result == EvaluationResult.FALSE)
        return result;
    }
View Full Code Here

Examples of org.eclipse.core.expressions.EvaluationResult

  }
 
  protected EvaluationResult evaluateOr(IEvaluationContext scope) throws CoreException {
    if (fExpressions == null)
      return EvaluationResult.TRUE;
    EvaluationResult result= EvaluationResult.FALSE;
    for (Iterator iter= fExpressions.iterator(); iter.hasNext();) {
      Expression expression= (Expression)iter.next();
      result= result.or(expression.evaluate(scope));
      if (result == EvaluationResult.TRUE)
        return result;
    }
    return result;
  }
View Full Code Here

Examples of org.eclipse.core.expressions.EvaluationResult

 
  public EvaluationResult evaluate(IEvaluationContext context) throws CoreException {
    long start= 0;
    if (Expressions.TRACING)
      start= System.currentTimeMillis();
    EvaluationResult result= evaluateAnd(context);
    if (Expressions.TRACING) {
      System.out.println("[Enablement Expression] - evaluation time: " + //$NON-NLS-1$
        (System.currentTimeMillis() - start) + " ms."); //$NON-NLS-1$
    }
    return result;
View Full Code Here

Examples of org.eclipse.core.expressions.EvaluationResult

          if (col instanceof List)
            return evaluateAnd(new DefaultVariable(context, ((List)col).get(0)));
          // fall through
        default:
          IteratePool iter= new IteratePool(context, col.iterator());
          EvaluationResult result= fOperator == AND ? EvaluationResult.TRUE : EvaluationResult.FALSE;
          while (iter.hasNext()) {
            iter.next();
            switch(fOperator) {
              case OR:
                result= result.or(evaluateAnd(iter));
                if (result == EvaluationResult.TRUE)
                  return result;
                break;
              case AND:
                result= result.and(evaluateAnd(iter));
                if (result != EvaluationResult.TRUE)
                  return result;
                break;
            }
          }
          return result;
      }
    } else {
      IIterable iterable= Expressions.getAsIIterable(var, this);
      if (iterable == null)
        return EvaluationResult.NOT_LOADED;
      int count= 0;
      IteratePool iter= new IteratePool(context, iterable.iterator());
      EvaluationResult result= fOperator == AND ? EvaluationResult.TRUE : EvaluationResult.FALSE;
      while (iter.hasNext()) {
        iter.next();
        count++;
        switch(fOperator) {
          case OR:
            result= result.or(evaluateAnd(iter));
            if (result == EvaluationResult.TRUE)
              return result;
            break;
          case AND:
            result= result.and(evaluateAnd(iter));
            if (result != EvaluationResult.TRUE)
              return result;
            break;
        }
      }
View Full Code Here

Examples of org.eclipse.core.expressions.EvaluationResult

    return false;
  }

  public final EvaluationResult evaluate(final IEvaluationContext context)
      throws CoreException {
    final EvaluationResult result = super.evaluate(context);
    if (result == EvaluationResult.FALSE) {
      return result;
    }

    final Object variable = context
View Full Code Here

Examples of org.eclipse.core.expressions.EvaluationResult

    return false;
  }

  public final EvaluationResult evaluate(final IEvaluationContext context)
      throws CoreException {
    final EvaluationResult result = super.evaluate(context);
    if (result == EvaluationResult.FALSE) {
      return result;
    }

    // Check the action sets.
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.