All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.drools.verifier.components.RulePossibility Maven / Gradle / Ivy

There is a newer version: 9.44.0.Final
Show newest version
package org.drools.verifier.components;

import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;

import org.drools.verifier.report.components.Cause;
import org.drools.verifier.report.components.CauseType;

/**
 * Instance of this class represents a possible combination of
 * PatternPosibilities under one Rule. Each possibility returns true if all the
 * PatternPosibilities in the combination are true.
 *
 * @author Toni Rikkola
 */
public class RulePossibility extends VerifierComponent implements
		Serializable, Possibility {
	private static final long serialVersionUID = 8871361928380977116L;

	private static int index = 0;

	private int ruleId;
	private Set items = new HashSet();

	public RulePossibility() {
		super(index++);
	}

	@Override
	public VerifierComponentType getComponentType() {
		return VerifierComponentType.RULE_POSSIBILITY;
	}

	public CauseType getCauseType() {
		return CauseType.RULE_POSSIBILITY;
	}

	public Set getItems() {
		return items;
	}

	public int getAmountOfItems() {
		return items.size();
	}

	public int getRuleId() {
		return ruleId;
	}

	public void setRuleId(int ruleId) {
		this.ruleId = ruleId;
	}

	public void add(PatternPossibility patternPossibility) {
		items.add(patternPossibility);
	}

	@Override
	public String toString() {
		return "RulePossibility from rule: " + ruleName + ", amount of items:"
				+ items.size();
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy