internal override Metastructure MetaVarUnify(LogicVariable l, PrologContext context) { if (DelayedGoal != null) { context.WakeUpGoal(DelayedGoal); } return(MakeSuspension(null, FrozenGoal)); }
internal override Metastructure MetaMetaUnify(Metastructure theirMetaStructure, PrologContext context) { var s = theirMetaStructure as Suspension; if (s == null) throw new ArgumentTypeException("MetaMetaUnify", "theirMetaStructure", theirMetaStructure, typeof(Suspension)); if (context != s.context) throw new ArgumentException("Can't unify suspended goals across PrologContexts."); context.WakeUpGoal(CombineGoals(DelayedGoal, s.DelayedGoal)); return MakeSuspension(null, CombineGoals(FrozenGoal, s.FrozenGoal)); }
/// <summary> /// Merge the information from two Metastructures into one new metastructure. /// </summary> /// <param name="theirMetaStructure">The Metastructure to merge with.</param> /// <param name="context">Context in which to execute suspended goals.</param> /// <returns>The merged Metastructure.</returns> public Metastructure MetaMetaUnify(Metastructure theirMetaStructure, PrologContext context) { if (theirMetaStructure == null) { throw new ArgumentTypeException("MetaMetaUnify", "theirMetaStructure", theirMetaStructure, typeof(Metastructure)); } if (context != theirMetaStructure.Context) { throw new ArgumentException("Can't unify suspended goals across PrologContexts."); } context.WakeUpGoal(CombineGoals(DelayedGoal, theirMetaStructure.DelayedGoal)); return(MakeSuspension(null, CombineGoals(FrozenGoal, theirMetaStructure.FrozenGoal))); }
internal override Metastructure MetaMetaUnify(Metastructure theirMetaStructure, PrologContext context) { var s = theirMetaStructure as Suspension; if (s == null) { throw new ArgumentTypeException("MetaMetaUnify", "theirMetaStructure", theirMetaStructure, typeof(Suspension)); } if (context != s.context) { throw new ArgumentException("Can't unify suspended goals across PrologContexts."); } context.WakeUpGoal(CombineGoals(DelayedGoal, s.DelayedGoal)); return(MakeSuspension(null, CombineGoals(FrozenGoal, s.FrozenGoal))); }
/// <summary> /// Called after the variable bound to this Metastructure is unified with an unbound variable /// that is not (itself) bound to a Metastructure. /// </summary> /// <param name="l">The logic variable with which to Unify.</param> /// <param name="context">Context in which to execute suspended goals.</param> /// <returns>The Metastructure to bind to the newly aliased variables.</returns> public Metastructure MetaVarUnify(LogicVariable l, PrologContext context) { if (DelayedGoal != null) context.WakeUpGoal(DelayedGoal); return MakeSuspension(null, FrozenGoal); }
/// <summary> /// Called after the variable bound to this Metastructure is unified with a non-variable term. /// </summary> /// <param name="value">The term to which to unify</param> /// <param name="contextOfBinding">Context in which to execute suspended goals.</param> public void MetaTermUnify(object value, PrologContext contextOfBinding) { Debug.Assert(contextOfBinding == Context, "Delayed goal woken in a different context than it was created in."); contextOfBinding.WakeUpGoal(CombineGoals(DelayedGoal, FrozenGoal)); }
/// <summary> /// Merge the information from two Metastructures into one new metastructure. /// </summary> /// <param name="theirMetaStructure">The Metastructure to merge with.</param> /// <param name="context">Context in which to execute suspended goals.</param> /// <returns>The merged Metastructure.</returns> public Metastructure MetaMetaUnify(Metastructure theirMetaStructure, PrologContext context) { if (theirMetaStructure == null) throw new ArgumentTypeException("MetaMetaUnify", "theirMetaStructure", theirMetaStructure, typeof(Metastructure)); if (context != theirMetaStructure.Context) throw new ArgumentException("Can't unify suspended goals across PrologContexts."); context.WakeUpGoal(CombineGoals(DelayedGoal, theirMetaStructure.DelayedGoal)); return MakeSuspension(null, CombineGoals(FrozenGoal, theirMetaStructure.FrozenGoal)); }
public override void MetaTermUnify(object value, PrologContext contextOfBinding) { System.Diagnostics.Debug.Assert(contextOfBinding == context, "Delayed goal woken in a different context than it was created in."); contextOfBinding.WakeUpGoal(CombineGoals(DelayedGoal, FrozenGoal)); }