Tabnine Logo
FireCondition
Code IndexAdd Tabnine to your IDE (free)

How to use
FireCondition
in
rocks.inspectit.server.diagnosis.engine.rule

Best Java code snippets using rocks.inspectit.server.diagnosis.engine.rule.FireCondition (Showing top 6 results out of 315)

origin: inspectIT/inspectIT

/**
 * Utility method to create a {@link FireCondition} either from a {@link Rule} annotation or
 * from {@link TagInjection}s. The values defined in the annotation overrules the
 * {@link TagInjection}s.
 *
 * @param rule
 *            The {@link Rule} annotation.
 * @param tagInjections
 *            The list of {@link TagInjection}s to extract a {@link FireCondition}.
 * @return A new {@link FireCondition}
 */
public static FireCondition describeFireCondition(Rule rule, List<TagInjection> tagInjections) {
  if ((rule != null) && ArrayUtils.isNotEmpty(rule.fireCondition())) {
    return new FireCondition(Sets.newHashSet(Arrays.asList(rule.fireCondition())));
  } else {
    Set<String> requiredTypes = new HashSet<>();
    for (TagInjection injection : tagInjections) {
      requiredTypes.add(injection.getType());
    }
    return new FireCondition(requiredTypes);
  }
}
origin: inspectIT/inspectIT

/**
 * Utility method to determine the next executable rules. The next rules are determined by
 * comparing all, so far collected, types of tags in {@link IRuleOutputStorage} and the
 * {@link FireCondition} of each {@link RuleDefinition}.
 *
 * @param availableTagTypes
 *            Set of strings determining the available tag types for input of potential next
 *            rules.
 * @param ruleDefinitions
 *            Set of available rule definitions.
 *
 * @return Collection of {@link RuleDefinition}s.
 * @see rocks.inspectit.server.diagnosis.engine.rule.FireCondition
 * @see RuleDefinition
 * @see IRuleOutputStorage
 */
Collection<RuleDefinition> findNextRules(Set<String> availableTagTypes, Set<RuleDefinition> ruleDefinitions) {
  Set<RuleDefinition> nextRules = new HashSet<>();
  Iterator<RuleDefinition> iterator = ruleDefinitions.iterator();
  while (iterator.hasNext()) {
    RuleDefinition rule = iterator.next();
    if (rule.getFireCondition().canFire(availableTagTypes)) {
      nextRules.add(rule);
    }
  }
  return nextRules;
}
origin: inspectIT/inspectIT

/**
 * {@inheritDoc}
 */
@Override
public int hashCode() {
  final int prime = 31;
  int result = 1;
  result = (prime * result) + ((this.actionMethod == null) ? 0 : this.actionMethod.hashCode());
  result = (prime * result) + ((this.conditionMethods == null) ? 0 : this.conditionMethods.hashCode());
  result = (prime * result) + ((this.description == null) ? 0 : this.description.hashCode());
  result = (prime * result) + ((this.fireCondition == null) ? 0 : this.fireCondition.hashCode());
  result = (prime * result) + ((this.implementation == null) ? 0 : this.implementation.hashCode());
  result = (prime * result) + ((this.name == null) ? 0 : this.name.hashCode());
  result = (prime * result) + ((this.tagInjections == null) ? 0 : this.tagInjections.hashCode());
  result = (prime * result) + ((this.variableInjections == null) ? 0 : this.variableInjections.hashCode());
  return result;
}
origin: inspectIT/inspectIT

Set<String> requiredInputTags = definition.getFireCondition().getTagTypes();
origin: inspectIT/inspectIT

    return false;
} else if (!this.fireCondition.equals(other.fireCondition)) {
  return false;
origin: inspectIT/inspectIT

@Test
public void testWithRuleAnnotation() throws Exception {
  RuleDefinition definition = Rules.define(ValidAndAnnotated.class);
  assertThat(definition.getName(), is("AnnotatedRule"));
  assertThat(definition.getDescription(), is("Description"));
  assertThat(definition.getFireCondition().getTagTypes(), containsInAnyOrder("T1", "T2"));
  // Test tag injections
  TagInjection tagInjection = new TagInjection("T1", ValidAndAnnotated.class.getDeclaredField("t1AsTag"), TagValue.InjectionStrategy.BY_TAG);
  TagInjection tagInjection1 = new TagInjection("T2", ValidAndAnnotated.class.getDeclaredField("t2TagValue"), TagValue.InjectionStrategy.BY_VALUE);
  assertThat(definition.getTagInjections(), is(notNullValue()));
  assertThat(definition.getTagInjections(), containsInAnyOrder(tagInjection, tagInjection1));
  // Test session variables
  SessionVariableInjection s1 = new SessionVariableInjection("baseline", false, ValidAndAnnotated.class.getDeclaredField("baseline"));
  SessionVariableInjection s2 = new SessionVariableInjection("baseline2", true, ValidAndAnnotated.class.getDeclaredField("baseline2"));
  assertThat(definition.getSessionVariableInjections(), containsInAnyOrder(s1, s2));
  // Test action method
  assertThat(definition.getActionMethod(), is(new ActionMethod(ValidAndAnnotated.class.getDeclaredMethod("action"), "T2", Action.Quantity.SINGLE)));
  // Test condition method
  ConditionMethod conditionMethod = new ConditionMethod("myCondition", "No way out", ValidAndAnnotated.class.getDeclaredMethod("condition"));
  assertThat(definition.getConditionMethods(), containsInAnyOrder(conditionMethod));
}
rocks.inspectit.server.diagnosis.engine.ruleFireCondition

Javadoc

Defines the condition, if a rule can be executed or not. The FireCondition basically checks if a predefined set of tag types is already available in the engine.

Most used methods

  • getTagTypes
    Gets #tagTypes.
  • <init>
    Default constructor.
  • canFire
    Checks if all required #tagTypes are satisfied by a provided set of tag types.
  • equals
  • hashCode

Popular in Java

  • Making http requests using okhttp
  • scheduleAtFixedRate (Timer)
  • onCreateOptionsMenu (Activity)
  • getSupportFragmentManager (FragmentActivity)
  • Font (java.awt)
    The Font class represents fonts, which are used to render text in a visible way. A font provides the
  • GridLayout (java.awt)
    The GridLayout class is a layout manager that lays out a container's components in a rectangular gri
  • DecimalFormat (java.text)
    A concrete subclass of NumberFormat that formats decimal numbers. It has a variety of features desig
  • NumberFormat (java.text)
    The abstract base class for all number formats. This class provides the interface for formatting and
  • Executors (java.util.concurrent)
    Factory and utility methods for Executor, ExecutorService, ScheduledExecutorService, ThreadFactory,
  • IOUtils (org.apache.commons.io)
    General IO stream manipulation utilities. This class provides static utility methods for input/outpu
  • Top Vim plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now