org.kie.api.definition.rule.Rule.getPackageName()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(14.5k)|赞(0)|评价(0)|浏览(108)

本文整理了Java中org.kie.api.definition.rule.Rule.getPackageName方法的一些代码示例,展示了Rule.getPackageName的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Rule.getPackageName方法的具体详情如下:
包路径:org.kie.api.definition.rule.Rule
类名称:Rule
方法名:getPackageName

Rule.getPackageName介绍

[英]Returns the package name (namespace) this rule is tied to.
[中]返回与此规则关联的包名(命名空间)。

代码示例

代码示例来源:origin: kiegroup/optaplanner

/**
 * Reward a match by the {@link ConstraintWeight} multiplied with the weightMultiplier for all score levels.
 * @param kcontext never null, the magic variable in DRL
 * @param weightMultiplier at least 0
 */
public void reward(RuleContext kcontext, int weightMultiplier) {
  Rule rule = kcontext.getRule();
  BiConsumer<RuleContext, Integer> matchExecutor = matchExecutorByNumberMap.get(rule);
  if (matchExecutor == null) {
    throw new IllegalStateException("The DRL rule (" + rule.getPackageName() + ":" + rule.getName()
        + ") does not match a @" + ConstraintWeight.class.getSimpleName() + " on the @"
        + ConstraintConfiguration.class.getSimpleName() + " annotated class.");
  }
  matchExecutor.accept(kcontext, weightMultiplier);
}

代码示例来源:origin: kiegroup/optaplanner

/**
 * Reward a match by the {@link ConstraintWeight} multiplied with the weightMultiplier for all score levels.
 * @param kcontext never null, the magic variable in DRL
 * @param weightMultiplier at least 0
 */
public void reward(RuleContext kcontext, BigDecimal weightMultiplier) {
  Rule rule = kcontext.getRule();
  BiConsumer<RuleContext, BigDecimal> matchExecutor = matchExecutorByNumberMap.get(rule);
  if (matchExecutor == null) {
    throw new IllegalStateException("The DRL rule (" + rule.getPackageName() + ":" + rule.getName()
        + ") does not match a @" + ConstraintWeight.class.getSimpleName() + " on the @"
        + ConstraintConfiguration.class.getSimpleName() + " annotated class.");
  }
  matchExecutor.accept(kcontext, weightMultiplier);
}

代码示例来源:origin: kiegroup/optaplanner

/**
 * Reward a match by the {@link ConstraintWeight} multiplied with the weightMultiplier for all score levels.
 * @param kcontext never null, the magic variable in DRL
 * @param weightMultiplier at least 0
 */
public void reward(RuleContext kcontext, double weightMultiplier) {
  Rule rule = kcontext.getRule();
  BiConsumer<RuleContext, Double> matchExecutor = matchExecutorByNumberMap.get(rule);
  if (matchExecutor == null) {
    throw new IllegalStateException("The DRL rule (" + rule.getPackageName() + ":" + rule.getName()
        + ") does not match a @" + ConstraintWeight.class.getSimpleName() + " on the @"
        + ConstraintConfiguration.class.getSimpleName() + " annotated class.");
  }
  matchExecutor.accept(kcontext, weightMultiplier);
}

代码示例来源:origin: kiegroup/optaplanner

/**
 * Reward a match by the {@link ConstraintWeight} multiplied with the weightMultiplier for all score levels.
 * @param kcontext never null, the magic variable in DRL
 * @param weightMultiplier at least 0
 */
public void reward(RuleContext kcontext, BigDecimal weightMultiplier) {
  Rule rule = kcontext.getRule();
  BiConsumer<RuleContext, BigDecimal> matchExecutor = matchExecutorByNumberMap.get(rule);
  if (matchExecutor == null) {
    throw new IllegalStateException("The DRL rule (" + rule.getPackageName() + ":" + rule.getName()
        + ") does not match a @" + ConstraintWeight.class.getSimpleName() + " on the @"
        + ConstraintConfiguration.class.getSimpleName() + " annotated class.");
  }
  matchExecutor.accept(kcontext, weightMultiplier);
}

代码示例来源:origin: kiegroup/optaplanner

/**
 * Reward a match by the {@link ConstraintWeight} multiplied with the weightMultiplier for all score levels.
 * @param kcontext never null, the magic variable in DRL
 * @param weightMultiplier at least 0
 */
public void reward(RuleContext kcontext, long weightMultiplier) {
  Rule rule = kcontext.getRule();
  BiConsumer<RuleContext, Long> matchExecutor = matchExecutorByNumberMap.get(rule);
  if (matchExecutor == null) {
    throw new IllegalStateException("The DRL rule (" + rule.getPackageName() + ":" + rule.getName()
        + ") does not match a @" + ConstraintWeight.class.getSimpleName() + " on the @"
        + ConstraintConfiguration.class.getSimpleName() + " annotated class.");
  }
  matchExecutor.accept(kcontext, weightMultiplier);
}

代码示例来源:origin: kiegroup/optaplanner

/**
 * Reward a match by the {@link ConstraintWeight} multiplied with the weightMultiplier for all score levels.
 * @param kcontext never null, the magic variable in DRL
 * @param weightMultiplier at least 0
 */
public void reward(RuleContext kcontext, int weightMultiplier) {
  Rule rule = kcontext.getRule();
  BiConsumer<RuleContext, Integer> matchExecutor = matchExecutorByNumberMap.get(rule);
  if (matchExecutor == null) {
    throw new IllegalStateException("The DRL rule (" + rule.getPackageName() + ":" + rule.getName()
        + ") does not match a @" + ConstraintWeight.class.getSimpleName() + " on the @"
        + ConstraintConfiguration.class.getSimpleName() + " annotated class.");
  }
  matchExecutor.accept(kcontext, weightMultiplier);
}

代码示例来源:origin: kiegroup/optaplanner

/**
 * Reward a match by the {@link ConstraintWeight} multiplied with the weightMultiplier for all score levels.
 * @param kcontext never null, the magic variable in DRL
 * @param weightMultiplier at least 0
 */
public void reward(RuleContext kcontext, int weightMultiplier) {
  Rule rule = kcontext.getRule();
  BiConsumer<RuleContext, Integer> matchExecutor = matchExecutorByNumberMap.get(rule);
  if (matchExecutor == null) {
    throw new IllegalStateException("The DRL rule (" + rule.getPackageName() + ":" + rule.getName()
        + ") does not match a @" + ConstraintWeight.class.getSimpleName() + " on the @"
        + ConstraintConfiguration.class.getSimpleName() + " annotated class.");
  }
  matchExecutor.accept(kcontext, weightMultiplier);
}

代码示例来源:origin: kiegroup/optaplanner

/**
 * Reward a match by the {@link ConstraintWeight} multiplied with the weightMultiplier for all score levels.
 * @param kcontext never null, the magic variable in DRL
 * @param weightMultiplier at least 0
 */
public void reward(RuleContext kcontext, BigDecimal weightMultiplier) {
  Rule rule = kcontext.getRule();
  BiConsumer<RuleContext, BigDecimal> matchExecutor = matchExecutorByNumberMap.get(rule);
  if (matchExecutor == null) {
    throw new IllegalStateException("The DRL rule (" + rule.getPackageName() + ":" + rule.getName()
        + ") does not match a @" + ConstraintWeight.class.getSimpleName() + " on the @"
        + ConstraintConfiguration.class.getSimpleName() + " annotated class.");
  }
  matchExecutor.accept(kcontext, weightMultiplier);
}

代码示例来源:origin: kiegroup/optaplanner

/**
 * Reward a match by the {@link ConstraintWeight} multiplied with the weightMultiplier for all score levels.
 * @param kcontext never null, the magic variable in DRL
 * @param weightMultiplier at least 0
 */
public void reward(RuleContext kcontext, long weightMultiplier) {
  Rule rule = kcontext.getRule();
  BiConsumer<RuleContext, Long> matchExecutor = matchExecutorByNumberMap.get(rule);
  if (matchExecutor == null) {
    throw new IllegalStateException("The DRL rule (" + rule.getPackageName() + ":" + rule.getName()
        + ") does not match a @" + ConstraintWeight.class.getSimpleName() + " on the @"
        + ConstraintConfiguration.class.getSimpleName() + " annotated class.");
  }
  matchExecutor.accept(kcontext, weightMultiplier);
}

代码示例来源:origin: kiegroup/optaplanner

/**
 * Reward a match by the {@link ConstraintWeight} multiplied with the weightMultiplier for all score levels.
 * @param kcontext never null, the magic variable in DRL
 * @param weightMultiplier at least 0
 */
public void reward(RuleContext kcontext, double weightMultiplier) {
  Rule rule = kcontext.getRule();
  BiConsumer<RuleContext, Double> matchExecutor = matchExecutorByNumberMap.get(rule);
  if (matchExecutor == null) {
    throw new IllegalStateException("The DRL rule (" + rule.getPackageName() + ":" + rule.getName()
        + ") does not match a @" + ConstraintWeight.class.getSimpleName() + " on the @"
        + ConstraintConfiguration.class.getSimpleName() + " annotated class.");
  }
  matchExecutor.accept(kcontext, weightMultiplier);
}

代码示例来源:origin: kiegroup/optaplanner

/**
 * Reward a match by the {@link ConstraintWeight} multiplied with the weightMultiplier for all score levels.
 * @param kcontext never null, the magic variable in DRL
 * @param weightMultiplier at least 0
 */
public void reward(RuleContext kcontext, int weightMultiplier) {
  Rule rule = kcontext.getRule();
  BiConsumer<RuleContext, Integer> matchExecutor = matchExecutorByNumberMap.get(rule);
  if (matchExecutor == null) {
    throw new IllegalStateException("The DRL rule (" + rule.getPackageName() + ":" + rule.getName()
        + ") does not match a @" + ConstraintWeight.class.getSimpleName() + " on the @"
        + ConstraintConfiguration.class.getSimpleName() + " annotated class.");
  }
  matchExecutor.accept(kcontext, weightMultiplier);
}

代码示例来源:origin: kiegroup/optaplanner

/**
 * Reward a match by the {@link ConstraintWeight} multiplied with the weightMultiplier for all score levels.
 * @param kcontext never null, the magic variable in DRL
 * @param weightMultiplier at least 0
 */
public void reward(RuleContext kcontext, BigDecimal weightMultiplier) {
  Rule rule = kcontext.getRule();
  BiConsumer<RuleContext, BigDecimal> matchExecutor = matchExecutorByNumberMap.get(rule);
  if (matchExecutor == null) {
    throw new IllegalStateException("The DRL rule (" + rule.getPackageName() + ":" + rule.getName()
        + ") does not match a @" + ConstraintWeight.class.getSimpleName() + " on the @"
        + ConstraintConfiguration.class.getSimpleName() + " annotated class.");
  }
  matchExecutor.accept(kcontext, weightMultiplier);
}

代码示例来源:origin: kiegroup/optaplanner

/**
 * Reward a match by the {@link ConstraintWeight} multiplied with the weightMultiplier for all score levels.
 * @param kcontext never null, the magic variable in DRL
 * @param weightMultiplier at least 0
 */
public void reward(RuleContext kcontext, long weightMultiplier) {
  Rule rule = kcontext.getRule();
  BiConsumer<RuleContext, Long> matchExecutor = matchExecutorByNumberMap.get(rule);
  if (matchExecutor == null) {
    throw new IllegalStateException("The DRL rule (" + rule.getPackageName() + ":" + rule.getName()
        + ") does not match a @" + ConstraintWeight.class.getSimpleName() + " on the @"
        + ConstraintConfiguration.class.getSimpleName() + " annotated class.");
  }
  matchExecutor.accept(kcontext, weightMultiplier);
}

代码示例来源:origin: kiegroup/optaplanner

/**
 * Reward a match by the {@link ConstraintWeight} multiplied with the weightMultiplier for all score levels.
 * @param kcontext never null, the magic variable in DRL
 * @param weightMultiplier at least 0
 */
public void reward(RuleContext kcontext, long weightMultiplier) {
  Rule rule = kcontext.getRule();
  BiConsumer<RuleContext, Long> matchExecutor = matchExecutorByNumberMap.get(rule);
  if (matchExecutor == null) {
    throw new IllegalStateException("The DRL rule (" + rule.getPackageName() + ":" + rule.getName()
        + ") does not match a @" + ConstraintWeight.class.getSimpleName() + " on the @"
        + ConstraintConfiguration.class.getSimpleName() + " annotated class.");
  }
  matchExecutor.accept(kcontext, weightMultiplier);
}

代码示例来源:origin: kiegroup/optaplanner

/**
 * Reward a match by the {@link ConstraintWeight} multiplied with the specific weightMultiplier per score level.
 * Slower than {@link #reward(RuleContext, BigDecimal)}.
 * @param kcontext never null, the magic variable in DRL
 * @param hardWeightMultiplier at least 0
 * @param softWeightMultiplier at least 0
 */
public void reward(RuleContext kcontext, BigDecimal hardWeightMultiplier, BigDecimal softWeightMultiplier) {
  Rule rule = kcontext.getRule();
  BiConsumer<RuleContext, HardSoftBigDecimalScore> matchExecutor = matchExecutorByScoreMap.get(rule);
  if (matchExecutor == null) {
    throw new IllegalStateException("The DRL rule (" + rule.getPackageName() + ":" + rule.getName()
        + ") does not match a @" + ConstraintWeight.class.getSimpleName() + " on the @"
        + ConstraintConfiguration.class.getSimpleName() + " annotated class.");
  }
  matchExecutor.accept(kcontext, HardSoftBigDecimalScore.of(hardWeightMultiplier, softWeightMultiplier));
}

代码示例来源:origin: kiegroup/optaplanner

/**
 * Reward a match by the {@link ConstraintWeight} multiplied with the specific weightMultiplier per score level.
 * Slower than {@link #reward(RuleContext, int)}.
 * @param kcontext never null, the magic variable in DRL
 * @param hardWeightsMultiplier elements at least 0
 * @param softWeightsMultiplier elements at least 0
 */
public void reward(RuleContext kcontext, int[] hardWeightsMultiplier, int[] softWeightsMultiplier) {
  Rule rule = kcontext.getRule();
  BiConsumer<RuleContext, BendableScore> matchExecutor = matchExecutorByScoreMap.get(rule);
  if (matchExecutor == null) {
    throw new IllegalStateException("The DRL rule (" + rule.getPackageName() + ":" + rule.getName()
        + ") does not match a @" + ConstraintWeight.class.getSimpleName() + " on the @"
        + ConstraintConfiguration.class.getSimpleName() + " annotated class.");
  }
  matchExecutor.accept(kcontext, BendableScore.of(hardWeightsMultiplier, softWeightsMultiplier));
}

代码示例来源:origin: kiegroup/optaplanner

/**
 * Reward a match by the {@link ConstraintWeight} multiplied with the specific weightMultiplier per score level.
 * Slower than {@link #reward(RuleContext, BigDecimal)}.
 * @param kcontext never null, the magic variable in DRL
 * @param hardWeightsMultiplier elements at least 0
 * @param softWeightsMultiplier elements at least 0
 */
public void reward(RuleContext kcontext, BigDecimal[] hardWeightsMultiplier, BigDecimal[] softWeightsMultiplier) {
  Rule rule = kcontext.getRule();
  BiConsumer<RuleContext, BendableBigDecimalScore> matchExecutor = matchExecutorByScoreMap.get(rule);
  if (matchExecutor == null) {
    throw new IllegalStateException("The DRL rule (" + rule.getPackageName() + ":" + rule.getName()
        + ") does not match a @" + ConstraintWeight.class.getSimpleName() + " on the @"
        + ConstraintConfiguration.class.getSimpleName() + " annotated class.");
  }
  matchExecutor.accept(kcontext, BendableBigDecimalScore.of(hardWeightsMultiplier, softWeightsMultiplier));
}

代码示例来源:origin: kiegroup/optaplanner

private ConstraintMatchTotal findConstraintMatchTotal(RuleContext kcontext) {
  Rule rule = kcontext.getRule();
  String constraintPackage = rule.getPackageName();
  String constraintName = rule.getName();
  String constraintId = constraintPackage + "/" + constraintName;
  return constraintMatchTotalMap.computeIfAbsent(constraintId,
      k -> new ConstraintMatchTotal(constraintPackage, constraintName, null, zeroScore));
}

代码示例来源:origin: kiegroup/optaplanner

@Override
public void configureConstraintWeight(Rule rule, Score_ constraintWeight) {
  if (constraintWeight.getInitScore() != 0) {
    throw new IllegalStateException("The initScore (" + constraintWeight.getInitScore() + ") must be 0.");
  }
  if (constraintMatchEnabled) {
    String constraintPackage = rule.getPackageName();
    String constraintName = rule.getName();
    String constraintId = constraintPackage + "/" + constraintName;
    constraintMatchTotalMap.put(constraintId,
        new ConstraintMatchTotal(constraintPackage, constraintName, constraintWeight, zeroScore));
  }
}

代码示例来源:origin: kiegroup/optaplanner

protected Rule mockRule(String ruleName) {
  Rule rule = mock(Rule.class);
  when(rule.getPackageName()).thenReturn(getClass().getPackage().getName());
  when(rule.getName()).thenReturn(ruleName);
  return rule;
}

相关文章