Class MultiRule
 java.lang.Object

 org.eclipse.core.runtime.jobs.MultiRule

 All Implemented Interfaces:
ISchedulingRule
public class MultiRule extends Object implements ISchedulingRule
A MultiRule is a compound scheduling rule that represents a fixed group of child scheduling rules. A MultiRule conflicts with another rule if any of its children conflict with that rule. More formally, a compound rule represents a logical intersection of its child rules with respect to theisConflicting
equivalence relation.A MultiRule will never contain other MultiRules as children. If a MultiRule is provided as a child, its children will be added instead.
 Since:
 3.0
 Restriction:
 This class is not intended to be subclassed by clients.


Constructor Summary
Constructors Constructor Description MultiRule(ISchedulingRule[] nestedRules)
Creates a new scheduling rule that composes a set of nested rules.

Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ISchedulingRule
combine(ISchedulingRule[] ruleArray)
Returns a scheduling rule that encompasses all provided rules.static ISchedulingRule
combine(ISchedulingRule rule1, ISchedulingRule rule2)
Returns a scheduling rule that encompasses both provided rules.boolean
contains(ISchedulingRule rule)
Returns whether this scheduling rule completely contains another scheduling rule.ISchedulingRule[]
getChildren()
Returns the child rules within this rule.boolean
isConflicting(ISchedulingRule rule)
Returns whether this scheduling rule is compatible with another scheduling rule.String
toString()



Constructor Detail

MultiRule
public MultiRule(ISchedulingRule[] nestedRules)
Creates a new scheduling rule that composes a set of nested rules. Parameters:
nestedRules
 the nested rules for this compound rule.


Method Detail

combine
public static ISchedulingRule combine(ISchedulingRule[] ruleArray)
Returns a scheduling rule that encompasses all provided rules. The resulting rule may or may not be an instance ofMultiRule
. If all provided rules arenull
then the result will benull
. Parameters:
ruleArray
 An array of scheduling rules, some of which may benull
 Returns:
 a combined scheduling rule, or
null
 Since:
 3.1

combine
public static ISchedulingRule combine(ISchedulingRule rule1, ISchedulingRule rule2)
Returns a scheduling rule that encompasses both provided rules. The resulting rule may or may not be an instance ofMultiRule
. If both provided rules arenull
then the result will benull
. Parameters:
rule1
 a scheduling rule, ornull
rule2
 another scheduling rule, ornull
 Returns:
 a combined scheduling rule, or
null

getChildren
public ISchedulingRule[] getChildren()
Returns the child rules within this rule. Returns:
 the child rules

contains
public boolean contains(ISchedulingRule rule)
Description copied from interface:ISchedulingRule
Returns whether this scheduling rule completely contains another scheduling rule. Rules can only be nested within a thread if the inner rule is completely contained within the outer rule.Implementations of this method must obey the rules of a partial order relation on the set of all scheduling rules. In particular, implementations must be reflexive (a.contains(a) is always true), antisymmetric (a.contains(b) and b.contains(a) iff a.equals(b), and transitive (if a.contains(b) and b.contains(c), then a.contains(c)). Implementations of this method must return
false
when compared to a rule they know nothing about. Specified by:
contains
in interfaceISchedulingRule
 Parameters:
rule
 the rule to check for containment Returns:
true
if this rule contains the given rule, andfalse
otherwise.

isConflicting
public boolean isConflicting(ISchedulingRule rule)
Description copied from interface:ISchedulingRule
Returns whether this scheduling rule is compatible with another scheduling rule. Iftrue
is returned, then no job with this rule will be run at the same time as a job with the conflicting rule. Iffalse
is returned, then the job manager is free to run jobs with these rules at the same time.Implementations of this method must be reflexive, symmetric, and consistent, and must return
false
when compared to a rule they know nothing about.This method must return true if calling
ISchedulingRule.contains(ISchedulingRule)
on the same rule also returns true. This is required because it would otherwise allow two threads to be running concurrently with the same rule. Specified by:
isConflicting
in interfaceISchedulingRule
 Parameters:
rule
 the rule to check for conflicts Returns:
true
if the rule is conflicting, andfalse
otherwise.

