Examples of Rule


Examples of gov.nist.scap.xccdf.document.Rule

    }

    int lineLength = longestRuleId + 10;

    for (RuleResult ruleResult : results.getRuleResults()) {
      Rule rule = ruleResult.getRule();

      for (RuleResultRecord record : ruleResult.getRuleResultRecords()) {
        this.printRuleResult(rule, record.getResult().toString(), lineLength);
      }
    }
View Full Code Here

Examples of heart.xtt.Rule

  private static void runRules(Table table, Configuration cs) throws UnsupportedOperationException, NotInTheDomainException{
    ConflictSet conflictSet = new ConflictSet();
    try{
      UncertainTrue finalResult = new UncertainTrue(cs.getUncertainTrueEvaluator().getMinCertainty());
      Rule ruleToFire = null;
      for(Rule rule : table.getRules()){
        Debug.debug(Debug.heartTag, Level.RULES, "Processing rule "+rule.getName()+" (ID: "+rule.getId()+")");
        UncertainTrue partialResult = rule.evaluate(wm,cs.getUncertainTrueEvaluator());
        partialResult.setCertinatyFactor(partialResult.getCertinatyFactor()*rule.getCertaintyFactor());
        //TODO: add satisability threshold, or think how to do this
        if(finalResult.getCertinatyFactor() < partialResult.getCertinatyFactor()){
          finalResult = partialResult;
          ruleToFire = rule;
          conflictSet.clear();
        }else if(finalResult.getCertinatyFactor() == partialResult.getCertinatyFactor()){
          conflictSet.add(ruleToFire, finalResult);
          conflictSet.add(rule, partialResult);
        }
        Debug.debug(Debug.heartTag, Level.RULES, "Finished evaluating rule "+rule.getName()+" (ID: "+rule.getId()+"). "+
        "SATISFIED with ("+partialResult.getCertinatyFactor()+") certainty.");
       
       
      }
     
      //If the conflict set is empty, then fire the ruleToFire
      //Otherwise, launch conflict resolution mechanism
      if(conflictSet.isEmpty()){
        if(ruleToFire != null){
          if(ruleToFire.execute(wm))
            Debug.debug(Debug.heartTag, Level.RULES,
                "Rule "+ruleToFire.getName()+" (ID: "+ruleToFire.getId()+") fired.");
          else
            Debug.debug(Debug.heartTag, Level.RULES,
                "Rule "+ruleToFire.getName()+" (ID: "+ruleToFire.getId()+") execution failed.");
        }else{
          Debug.debug(Debug.heartTag, Level.RULES,
              "No rule to fire in table "+table.getName()+" (ID: "+table.getId()+").");
        }
       
View Full Code Here

Examples of ign.middleman.helpers.Rule

        HttpServletResponse response = createMock(HttpServletResponse.class);
        Middleman middleman = createMock(Middleman.class);
        expect(request.getParameter("url")).andReturn(null).anyTimes();
        expect(request.getParameter("regex")).andReturn(".*tags=foo.*").anyTimes();
        expect(middleman.addRefreshRule(".*tags=foo.*")).andReturn(Collections.singleton(new Rule(".*tags=foo.*")));

        Refresher r = new Refresher();
        r.setMiddleman(middleman);
        replay(request, response, middleman);
        r.doGet(request, response);
View Full Code Here

Examples of io.fabric8.service.jclouds.firewall.Rule

            FirewallManager firewallManager = firewallManagerFactory.getFirewallManager(computeService);
            if (firewallManager.isSupported()) {
                listener.onStateChange("Configuring firewall.");
                String source = getOriginatingIp();

                Rule httpRule = Rule.create().source("0.0.0.0/0").destination(nodeMetadata).port(8181);
                firewallManager.addRules(httpRule);

                if (source != null) {
                    Rule jmxRule = Rule.create().source(source).destination(nodeMetadata).ports(44444, 1099);
                    Rule sshRule = Rule.create().source(source).destination(nodeMetadata).port(8101);
                    Rule zookeeperRule = Rule.create().source(source).destination(nodeMetadata).port(2181);
                    firewallManager.addRules(jmxRule, sshRule, zookeeperRule);
                }
                //We do add the target node public address to the firewall rules, as a way to make things easier in cases
                //where firewall configuration is shared among nodes of the same groups, e.g. EC2.
                if (!Strings.isNullOrEmpty(publicAddress)) {
                    Rule zookeeperFromTargetRule = Rule.create().source(publicAddress + "/32").destination(nodeMetadata).port(2181);
                    firewallManager.addRule(zookeeperFromTargetRule);
                }
            } else {
                listener.onStateChange(String.format("Skipping firewall configuration. Not supported for provider %s", options.getProviderName()));
            }
View Full Code Here

Examples of javax.rules.admin.Rule

        RuleExecutionSet ruleExecutionSet =
            ruleSetProvider.createRuleExecutionSet( in, null );
        List rules = ruleExecutionSet.getRules( );
        assertEquals( "number of rules", 1, rules.size( ) );

        Rule rule01 = ( Rule ) ruleExecutionSet.getRules( ).get( 0 );
        assertEquals( "rule name", "Find Sisters", rule01.getName( ) );
        assertNull( "rule description", rule01.getDescription( ) );
    }
View Full Code Here

Examples of jmathexpr.util.rule.Rule

       
        return result;
    }
   
    private Rule nextRule(boolean justApplied) {
        Rule next;
       
        if (justApplied) {
            lastRule = rule;
        }

        int lastRuleIndex = rules.indexOf(rule);

        if (++lastRuleIndex < rules.size()) {
            next = rules.get(lastRuleIndex);
        } else if (lastRule == null) { // no more rule and no rule matched
            return null;
        } else {
            next = rules.get(0);
        }
       
        next.reset();

        if (rule.equals(lastRule) && !justApplied) {
            return null;
        } else {
            return next;
View Full Code Here

Examples of joshua.decoder.ff.tm.Rule

        computeCost(parentNode, edge, modelCost, models);
      }
     
      //### get hyp string recursively
      StringBuffer res = new StringBuffer();
      Rule rl = edge.getRule();
     
      if (null == rl) { // hyperedges under "goal item" does not have rule
        if (useTreeFormat) {
          //res.append("(ROOT ");
          res.append('(');
          res.append(rootID);
          if (includeAlign) {
            // append "{i-j}"
            res.append('{');
            res.append(parentNode.i);
            res.append('-');
            res.append(parentNode.j);
            res.append('}');
          }
          res.append(' ');
        }
        for (int id = 0; id < edge.getAntNodes().size(); id++) {
          res.append( getChildDerivationState(kbestExtator, edge, id).getHypothesis(symbolTbl,kbestExtator, useTreeFormat, modelCost, models, numNodesAndEdges) );
          if (id < edge.getAntNodes().size()-1) res.append(' ');
        }
        if (useTreeFormat)
          res.append(')');
      } else {
        if (useTreeFormat) {
          res.append('(');
          res.append(rl.getLHS());
          if (includeAlign) {
            // append "{i-j}"
            res.append('{');
            res.append(parentNode.i);
            res.append('-');
            res.append(parentNode.j);
            res.append('}');
          }
          res.append(' ');
        }
        if (!isMonolingual) { // bilingual
          int[] english = rl.getEnglish();
          for (int c = 0; c < english.length; c++) {
            if (symbolTbl.isNonterminal(english[c])) {
              int id = symbolTbl.getTargetNonterminalIndex(english[c]);
              res.append( getChildDerivationState(kbestExtator, edge, id).getHypothesis(symbolTbl, kbestExtator, useTreeFormat, modelCost, models, numNodesAndEdges));
            } else {
              res.append(english[c]);
            }
            if (c < english.length-1) res.append(' ');
          }
        } else { // monolingual
          int[] french = rl.getFrench();
          int nonTerminalID = 0;//the position of the non-terminal in the rule
          for (int c = 0; c < french.length; c++) {
            if (symbolTbl.isNonterminal(french[c])) {
              res.append( getChildDerivationState(kbestExtator, edge, nonTerminalID).getHypothesis(symbolTbl,kbestExtator, useTreeFormat, modelCost, models, numNodesAndEdges));
              nonTerminalID++;
View Full Code Here

Examples of joshua.discriminative.syntax_reorder.HashtableBasedHieroGrammarScorer.Rule

      int[] phrase = (int[])l_init_phrases.get(t);
      for(int n_nts=0; n_nts<=max_num_non_terminals; n_nts++){
        if(bins[phrase[0]][phrase[1]+1][n_nts]!=null){
          for(int t2=0; t2<bins[phrase[0]][phrase[1]+1][n_nts].size(); t2++){
            ArrayList item = (ArrayList) bins[phrase[0]][phrase[1]+1][n_nts].get(t2);
            Rule rule = makeAndScoreRule(align, phrase, item);
            if(rule!=null){
              local_results.add(rule);
            }
          }
        }
      }     
      //distribute the count, normalization
      for(int k=0; k < local_results.size(); k++){
        Rule rl = (Rule)local_results.get(k);
        for(int f=0; f<rl.feat_scores.length; f++)
          rl.feat_scores[f] /= local_results.size();
        rl.print_info(symbolTable);
      }
      l_phrases_and_rules.addAll(local_results);
      //System.out.println("local size " + local_results.size() + " all size " + l_phrases_and_rules.size());
    }
    System.out.println("num of rules and phrases is "  + l_phrases_and_rules.size());
View Full Code Here

Examples of lupos.rif.model.Rule

      }
    return ruleList;
  }

  public Object visit(final RIFRule n, final IRuleNode argu) {
    final Rule rule = new Rule();
    rule.setParent(argu);
    RIFClause clause = null;
    // Wenn Variablen vorhanden
    if (n.f0.which == 0) {
      final List<INode> seq = (List<INode>) n.f0.choice.accept(this, rule);
      for (final INode node : ((List<INode>) seq.get(1).accept(this, rule)))
        rule.addVariable((RuleVariable) node.accept(this, rule));
      clause = (RIFClause) seq.get(3);
    } else
      clause = (RIFClause) n.f0.choice;
    clause.accept(this, rule);
    return rule;
View Full Code Here

Examples of modTransf.engine.Rule

    throws TransformationException
  {
     Iterator iter = rules.iterator();
     while( iter.hasNext() )
     {
       Rule rule = (Rule)iter.next();
       context.enterLocalContext();
      boolean res = false;
      try
      {
         res = rule.isAllowed(args, context);
         System.out.println( rule.getRuleName() + ".isAllowed()-->" + res);
         if(res )
           return true;
      }
      catch(TransformationException ex)
      {
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.