Examples of Rule


Examples of com.eclipsesource.tabris.passepartout.Rule

  @Test
  public void testPicksComplientRule() {
    InstructionExtractor extractor = new InstructionExtractor( createEnvironment( new Bounds( 0, 0, 100, 100 ) ) );
    Instruction instruction = PassePartout.columns( 5 );
    Rule rule = PassePartout.when( PassePartout.minWidth( PassePartout.px( 90 ) ) ).then( instruction );
    List<Rule> rules = new ArrayList<Rule>();
    rules.add( rule );

    List<Instruction> instructions = extractor.extract( rules );
View Full Code Here

Examples of com.founder.fix.bpmn2extensions.sqlmappingconfig.Rule

    scriptLanguageMgmt.setVariable("parameter", persistentObject);
    // 设置数据库操作对象
    scriptLanguageMgmt.setVariable("sqlCommand", sqlCommand);

    // 获取指定的规则
    Rule rule = processEngineConfiguration.getRule(statement);
    // 获取规则执行的执行类,如果有执行类则优先执行执行类,没有的话执行脚本。
    String classPath = rule.getClassPath();

    if (StringUtil.isNotEmpty(classPath)) {

      LOG.debug("规则: {} 开始执行,规则执行类为: {}", statement, classPath);

      Class<?> classObj = processEngineConfiguration.getRuleClass(rule.getId());
      if (classObj != null) {
        try {
          InsertRulesScript insertRulesScript = (InsertRulesScript) classObj.newInstance();
          insertRulesScript.execute(persistentObject, sqlCommand, processEngineConfiguration);
        } catch (Exception e) {

          LOG.error("规则: " + statement + " 执行出错,规则执行类为: " + classPath + ",错误信息: " + e.getMessage(), e);

          throw new FixFlowException(ExceptionCode.RULEEXCEPTION_CLASSEXEC, e, statement, classPath, e.getMessage());

        }
      } else {

        LOG.error("规则解释类:" + classPath + " 未找到.");

        throw new FixFlowClassLoadingException(ExceptionCode.CLASSLOADEXCEPTION_RULECLASS, classPath);

      }
    } else {
      String ruleText = rule.getSqlValue();
      if (StringUtil.isNotEmpty(ruleText)) {
        try {

          scriptLanguageMgmt.execute(rule.getSqlValue());

        } catch (Exception e) {

          LOG.error("规则: " + statement + " 执行出错,错误信息: " + e.getMessage() + "\n 规则内容: \n" + rule.getSqlValue(), e);

          throw new FixFlowException(ExceptionCode.RULEEXCEPTION_RULESCRIPTEXEC, e, statement, e.getMessage());

        }
View Full Code Here

Examples of com.github.jknack.antlr4ide.lang.Rule

public class ParseTreeNodeTest {

  @Test
  public void parserRuleSource() {
    Rule element = createMock(ParserRule.class);
    expect(element.getName()).andReturn("rule");

    Object[] mocks = {element };

    replay(mocks);
View Full Code Here

Examples of com.google.caja.parser.quasiliteral.Rule

        UriFetcher.NULL_NETWORK, mq);
    return new ExpressionSanitizerCaja(mgr, null) {
      @Override
      protected Rewriter newES53Rewriter(ModuleManager mgr) {
        return new Rewriter(mq, true, true) {{
          addRule(new Rule() {
            @Override
            @RuleDescription(
                name="passthru",
                synopsis="Pass through input vacuously 'expanded'",
                reason="Dummy rule for testing")
View Full Code Here

Examples of com.google.gwt.dev.cfg.Rule

            "No rules are defined, so no substitution can occur", null);
        return null;
      }

      for (Iterator<Rule> iter = rules.iterator(); iter.hasNext();) {
        Rule rule = iter.next();

        // Branch the logger.
        //
        TreeLogger branch = Messages.TRACE_CHECKING_RULE.branch(logger, rule,
            null);

        if (rule.isApplicable(branch, genCtx, typeName)) {
          // See if this rule has already been used. This is needed to prevent
          // infinite loops with 'when-assignable' conditions.
          //
          if (!usedRules.contains(rule)) {
            usedRules.add(rule);
            Messages.TRACE_RULE_MATCHED.log(logger, null);

            // Invoke the rule.
            //
            return rule.realize(logger, genCtx, typeName);

          } else {
            // We are skipping this rule because it has already been used
            // in a previous iteration.
            //
View Full Code Here

Examples of com.google.javascript.jscomp.CheckConformance.Rule

    private Rule createRule(AbstractCompiler compiler, Requirement requirement)
        throws InvalidRequirementSpec {
      try {
        Class<Rule> custom = getRuleClass(requirement.getJavaClass());
        Constructor<?> ctor = getRuleConstructor(custom);
        Rule rule;
        try {
          rule = (Rule) (ctor.newInstance(compiler, requirement));
        } catch (InvocationTargetException e) {
          Throwable cause = e.getCause();
          if (cause instanceof InvalidRequirementSpec) {
View Full Code Here

Examples of com.hp.hpl.jena.reasoner.rulesys.Rule

   
    /**
     * Execute a single rule firing.
     */
    public static void execute(RETERuleContext context, boolean isAdd) {
        Rule rule = context.getRule();
        BindingEnvironment env = context.getEnv();
        ForwardRuleInfGraphI infGraph = (ForwardRuleInfGraphI)context.getGraph();
        if (infGraph.shouldTrace()) {
            logger.info("Fired rule: " + rule.toShortString());
        }
        RETEEngine engine = context.getEngine();
        engine.incRuleCount();
        List<Triple> matchList = null;
        if (infGraph.shouldLogDerivations() && isAdd) {
            // Create derivation record
            matchList = new ArrayList<Triple>(rule.bodyLength());
            for (int i = 0; i < rule.bodyLength(); i++) {
                Object clause = rule.getBodyElement(i);
                if (clause instanceof TriplePattern) {
                    matchList.add(env.instantiate((TriplePattern)clause));
                }
            }
        }
        for (int i = 0; i < rule.headLength(); i++) {
            Object hClause = rule.getHeadElement(i);
            if (hClause instanceof TriplePattern) {
                Triple t = env.instantiate((TriplePattern) hClause);
                // Used to filter out triples with literal subjects
                // but this is not necessary
                // if (!t.getSubject().isLiteral()) {
                    // Only add the result if it is legal at the RDF level.
                    // E.g. RDFS rules can create assertions about literals
                    // that we can't record in RDF
                    if (isAdd) {
                        if ( ! context.contains(t) ) {
                            engine.addTriple(t, true);
                            if (infGraph.shouldLogDerivations()) {
                                infGraph.logDerivation(t, new RuleDerivation(rule, t, matchList, infGraph));
                            }
                        }
                    } else {
                        if ( context.contains(t)) {
                            // Remove the generated triple
                            engine.deleteTriple(t, true);
                        }
                    }
              // }
            } else if (hClause instanceof Functor && isAdd) {
                Functor f = (Functor)hClause;
                Builtin imp = f.getImplementor();
                if (imp != null) {
                    imp.headAction(f.getBoundArgs(env), f.getArgLength(), context);
                } else {
                    throw new ReasonerException("Invoking undefined Functor " + f.getName() +" in " + rule.toShortString());
                }
            } else if (hClause instanceof Rule) {
                Rule r = (Rule)hClause;
                if (r.isBackward()) {
                    if (isAdd) {
                        infGraph.addBRule(r.instantiate(env));
                    } else {
                        infGraph.deleteBRule(r.instantiate(env));
                    }
                } else {
                    throw new ReasonerException("Found non-backward subrule : " + r);
                }
            }
View Full Code Here

Examples of com.litecoding.smali2java.parser.Rule

        out.append((char)ch);

      out.append("\n"); //fix for the bug than .end method ends by EOF but not CRLF
      in.close();
   
    Rule classrule = Parser.parse("smali", out.toString());
    SmaliClass smaliClass = (SmaliClass)classrule.accept(new SmaliClassBuilder());
    classes.put(smaliClass.getClassName(), smaliClass);
   
    System.out.println(ClassRenderer.renderObject(smaliClass));
  }
View Full Code Here

Examples of com.netflix.simianarmy.janitor.Rule

        LOGGER.debug(String.format("Checking if resource %s of type %s is a cleanup candidate against %d rules.",
                resource.getId(), resource.getResourceType(), rules.size()));
        // We create a clone of the resource each time when we try the rule. In the first iteration of the rules
        // we identify the rule with the nearest termination date if there is any rule considers the resource
        // as a cleanup candidate. Then the rule is applied to the original resource.
        Rule nearestRule = null;
        if (rules.size() == 1) {
            nearestRule = rules.get(0);
        } else {
            Date nearestTerminationTime = null;
            for (Rule rule : rules) {
                Resource clone = resource.cloneResource();
                if (!rule.isValid(clone) && (nearestTerminationTime == null
                        || nearestTerminationTime.after(clone.getExpectedTerminationTime()))) {
                    nearestRule = rule;
                    nearestTerminationTime = clone.getExpectedTerminationTime();
                }
            }
        }
        if (nearestRule != null && !nearestRule.isValid(resource)) {
            LOGGER.info(String.format("Resource %s is marked as a cleanup candidate.", resource.getId()));
            return false;
        } else {
            LOGGER.info(String.format("Resource %s is not marked as a cleanup candidate.", resource.getId()));
            return true;
View Full Code Here

Examples of com.salas.bb.views.stylesheets.domain.Rule

        Map rules = Parser.parse(text);

        assertEquals(3, rules.size());

        Rule rule;
        rule = (Rule)((Map)rules.get(null)).get(null);
        assertTrue(rule.getColor().equals(Color.decode("#000001")));
        assertNull(rule.getFont());
        assertNull(rule.getIconURL());

        rule = (Rule)((Map)rules.get("e1")).get(null);
        assertTrue(rule.getColor().equals(Color.decode("#000002")));
        assertTrue(rule.getFont().isBold());
        assertNull(rule.getIconURL());

        rule = (Rule)((Map)rules.get("e2")).get("c1");
        assertTrue(rule.getColor().equals(Color.decode("#000003")));
        assertNull(rule.getFont());
        assertNull(rule.getIconURL());

        rule = (Rule)((Map)rules.get(null)).get("c2");
        assertNull(rule.getColor());
        assertNull(rule.getFont());
        assertEquals("theme/icon.gif", rule.getIconURL());
    }
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.