Exemplo n.º 1
0
		/// <summary>
		/// Schedule all implications that are listening the facts in the fact base
		/// except if no new fact of the listening type where asserted in the previous iteration.
		/// </summary>
		/// <param name="positiveImplications">Null if it is the first iteration, else en ArrayList of positive implications of current iteration.</param>
		/// <param name="IB">The current ImplicationBase.</param>
		public void Schedule(IList<Implication> positiveImplications, ImplicationBase implicationBase) {
			if (positiveImplications == null) {
				// schedule all implications
				foreach(Implication implication in implicationBase) Schedule(implication);
			}
			else {
				foreach(Implication positiveImplication in positiveImplications) {
					if (positiveImplication.Action != ImplicationAction.Retract) {
						// for positive implications, schedule only the implications
						// relevant to the newly asserted facts.
						IList<Implication> listeningImplications = implicationBase.GetListeningImplications(positiveImplication.Deduction);
						if (listeningImplications != null)
							foreach(Implication implication in listeningImplications)
								Schedule(implication);
					}
					else {
						// for negative implications, schedule only the implications
						// that can potentially assert a fact of same type that was retracted
						foreach(Implication implication in implicationBase)
							if (implication.Deduction.Type == positiveImplication.Deduction.Type)
								Schedule(implication);
					}
					
					// schedule implications potentially pre-condition unlocked
					foreach(Implication implication in implicationBase.GetPreconditionChildren(positiveImplication))
						Schedule(implication);
				}
			}
		}
Exemplo n.º 2
0
 public MutexManager(ImplicationBase ib) : base("Mutex", ib)
 {
 }
Exemplo n.º 3
0
 protected AbstractChainManager(string type, ImplicationBase ib)
 {
     this.type = type;
     this.ib   = ib;
 }
Exemplo n.º 4
0
 public PreconditionManager(ImplicationBase ib) : base("Precondition", ib)
 {
 }