/// <summary> /// Increment the instance counter for this sort. /// </summary> /// <returns>The incremented count</returns> public static int GetNextId(Symbol sort) { if (sort == null) { throw new ArgumentNullException("sort"); } int newId = PeekNextId(sort); InterpretationContext.GetCurrentContext().ResetId(sort, newId); return(newId); }
/// <summary> /// Return the next available instance counter for this type and sort (without changing state). /// </summary> /// <note>This is used by parameter generation when a new instance may appear as an action argument.</note> /// <returns>The incremented count</returns> public static int PeekNextId(Symbol sort) { if (sort == null) { throw new ArgumentNullException("sort"); } int newId; return((InterpretationContext.GetCurrentContext().IdPool.TryGetValue(sort, out newId)) ? newId + 1 : 1); }
/// <summary> /// Called internally to distinguish between reserve elements that are part of state and /// those in the background set of values. Not used directly in models. /// </summary> public override void FinalizeImport() { InterpretationContext.GetCurrentContext().EnsureId(this.objectId); }
/// <summary> /// Returns the interpretation of the term <paramref name="t"/> in the current context. /// </summary> /// <param name="t"></param> /// <returns></returns> public static IComparable InterpretTerm(Term t) { return(InterpretationContext.GetCurrentContext().InterpretTerm(t)); }