C# Класс Prolog.PrologContext

Наследование: IDisposable
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
IndexicalBindingStack object>>.List
Output System.IO.TextWriter
This object

Private Properties

Свойство Тип Описание
AbortWokenGoals void
GetCallArgumentsAsArray object[]
GetStackTop Structure
NewStep void
PrologContext System
PrologContext System
Prove IEnumerable
Prove IEnumerable
ProveAllWokenGoals IEnumerable
ProveWokenGoalsInternal IEnumerable
PushArguments void
PushArguments void
PushGoalStack void
WakeUpGoal void

Открытые методы

Метод Описание
Allocate ( KnowledgeBase kb, object thisValue ) : PrologContext

Gets a context that is currently free to use. Should be relased afterward using ReleaseContext().

Dispose ( ) : void
GetStack ( int frame, int offset ) : object

Reads a value from the stack.

GoalStackGoal ( ushort frame ) : Structure

Returns the goal at the specified position on the stack

GoalStackParent ( ushort frame ) : ushort

Returns the stack position of the parent goal of the goal at the specified position on the stack

IsTrue ( Structure goal ) : bool

Test whether GOAL is provable

IsTrue ( string predicateName ) : bool

Test whether GOAL is provable

MakeFrame ( int size ) : int

Reserve space for a new frame.

MarkTrail ( ) : int

Marks a place on the trail so subsequent bindings can be undone. Present implementation does not actually modify the stack in any way.

PopFrame ( int framePointer ) : void

Resets stack pointer to point at base of old frame.

PopGoalStack ( ) : void

Mark that this is the start of a new clause

Removes the top goal from the goal stack

PrologContext ( KnowledgeBase kb, int stepLimit ) : System

Creates a PrologContext that can for at most the specified number of steps.

Reset ( ) : void
Reset ( object thisValue ) : void

Forcibly clears the execution context.

ResetStackAndProve ( Structure goal ) : IEnumerable

Resets the context (clears stack, etc.) and starts a proof of the specified goal.

ResetStackAndProve ( object goal ) : IEnumerable

Resets the context (clears stack, etc.) and starts a proof of the specified goal.

ResetStepLimit ( ) : void

Renews the step limit (e.g. for when the repl is asking for a new solution.

RestoreVariables ( int savedTrailPointer ) : void

Restores the values of all variables back to the specified position on the trace (i.e. the undo stack).

SaveVariable ( LogicVariable lvar ) : void

Saves the current value of a variable on the trail (i.e. the undo stack).

SetCallArg ( int argumentNumber, object value ) : void

Sets argument for an upcoming call.

SetCurrentRule ( Prolog.KnowledgeBaseEntry rule ) : void

Set the rule currently being tried by the goal at the top of the stack.

SetStack ( int frame, int offset, object value ) : void

Modifies a value from the stack.

StackTrace ( string sourcePath, int lineNumber, string toplevelCommand, bool fullTrace ) : string

Generate a stack trace that's close enough to a normal mono stack dump that the Unity logger will understand it.

TraceOutput ( string format, object arg ) : void

Prints trace information.

UnwindStack ( ushort depth ) : void

Resets the stack to the specified depth.

Приватные методы

Метод Описание
AbortWokenGoals ( int newTracePointer ) : void
GetCallArgumentsAsArray ( int arity ) : object[]
GetStackTop ( bool throwOnEmptyStack ) : Structure
NewStep ( ) : void

Check whether the maximum number of steps has been exceeded. Called when a new step is initiated.

PrologContext ( ) : System
PrologContext ( KnowledgeBase kb ) : System

Creates a PrologContext with PrologContext.DefaultStepLimit

Prove ( Structure goal ) : IEnumerable

Proves the goal in the specified structure.

Prove ( object goal, string badGoalErrorMessage ) : IEnumerable

Proves the specified goal, throwing an exception with badGoalErrorMessage if the goal is ill-formed.

ProveAllWokenGoals ( ) : IEnumerable

Attempts to prove all woken goals, in the order they were woken.

ProveWokenGoalsInternal ( WokenGoal goals, int goalIndex ) : IEnumerable
PushArguments ( IList args ) : void

Copies args to a arguments position for the next stack frame.

PushArguments ( object args ) : void

Copies args to a arguments position for the next stack frame.

PushGoalStack ( Symbol functor, object args, ushort parentFrame ) : void
WakeUpGoal ( Structure goal ) : void

Описание методов

Allocate() публичный статический Метод

Gets a context that is currently free to use. Should be relased afterward using ReleaseContext().
public static Allocate ( KnowledgeBase kb, object thisValue ) : PrologContext
kb KnowledgeBase
thisValue object
Результат PrologContext

Dispose() публичный Метод

public Dispose ( ) : void
Результат void

GetStack() публичный Метод

Reads a value from the stack.
public GetStack ( int frame, int offset ) : object
frame int Base address of stack frame
offset int Offset into stack frame
Результат object

GoalStackGoal() публичный Метод

Returns the goal at the specified position on the stack
public GoalStackGoal ( ushort frame ) : Structure
frame ushort
Результат Structure

GoalStackParent() публичный Метод

Returns the stack position of the parent goal of the goal at the specified position on the stack
public GoalStackParent ( ushort frame ) : ushort
frame ushort
Результат ushort

IsTrue() публичный Метод

Test whether GOAL is provable
public IsTrue ( Structure goal ) : bool
goal Structure Goal to prove
Результат bool

IsTrue() публичный Метод

Test whether GOAL is provable
public IsTrue ( string predicateName ) : bool
predicateName string Name of the predicate to call
Результат bool

MakeFrame() публичный Метод

Reserve space for a new frame.
public MakeFrame ( int size ) : int
size int Number of words needed for frame
Результат int

MarkTrail() публичный Метод

Marks a place on the trail so subsequent bindings can be undone. Present implementation does not actually modify the stack in any way.
public MarkTrail ( ) : int
Результат int

PopFrame() публичный Метод

Resets stack pointer to point at base of old frame.
public PopFrame ( int framePointer ) : void
framePointer int Base of the frame we're popping off
Результат void

PopGoalStack() публичный Метод

Mark that this is the start of a new clause Removes the top goal from the goal stack
public PopGoalStack ( ) : void
Результат void

PrologContext() публичный Метод

Creates a PrologContext that can for at most the specified number of steps.
public PrologContext ( KnowledgeBase kb, int stepLimit ) : System
kb KnowledgeBase
stepLimit int
Результат System

Reset() публичный Метод

public Reset ( ) : void
Результат void

Reset() публичный Метод

Forcibly clears the execution context.
public Reset ( object thisValue ) : void
thisValue object
Результат void

ResetStackAndProve() публичный Метод

Resets the context (clears stack, etc.) and starts a proof of the specified goal.
public ResetStackAndProve ( Structure goal ) : IEnumerable
goal Structure Goal to attempt to prove
Результат IEnumerable

ResetStackAndProve() публичный Метод

Resets the context (clears stack, etc.) and starts a proof of the specified goal.
public ResetStackAndProve ( object goal ) : IEnumerable
goal object Goal to attempt to prove
Результат IEnumerable

ResetStepLimit() публичный Метод

Renews the step limit (e.g. for when the repl is asking for a new solution.
public ResetStepLimit ( ) : void
Результат void

RestoreVariables() публичный Метод

Restores the values of all variables back to the specified position on the trace (i.e. the undo stack).
public RestoreVariables ( int savedTrailPointer ) : void
savedTrailPointer int
Результат void

SaveVariable() публичный Метод

Saves the current value of a variable on the trail (i.e. the undo stack).
public SaveVariable ( LogicVariable lvar ) : void
lvar LogicVariable
Результат void

SetCallArg() публичный Метод

Sets argument for an upcoming call.
public SetCallArg ( int argumentNumber, object value ) : void
argumentNumber int Index of the argument (0=first, 1=second, etc.)
value object Value of the argument
Результат void

SetCurrentRule() публичный Метод

Set the rule currently being tried by the goal at the top of the stack.
public SetCurrentRule ( Prolog.KnowledgeBaseEntry rule ) : void
rule Prolog.KnowledgeBaseEntry the new rule.
Результат void

SetStack() публичный Метод

Modifies a value from the stack.
public SetStack ( int frame, int offset, object value ) : void
frame int Base address of stack frame
offset int Offset into stack frame
value object New value for stack variable
Результат void

StackTrace() публичный Метод

Generate a stack trace that's close enough to a normal mono stack dump that the Unity logger will understand it.
public StackTrace ( string sourcePath, int lineNumber, string toplevelCommand, bool fullTrace ) : string
sourcePath string Path for the source file being loaded.
lineNumber int Current line number in the source file.
toplevelCommand string Original prolog command to output, if stack is empty.
fullTrace bool If true, the complete stack is dumped, otherwise, just the starting frames.
Результат string

TraceOutput() публичный Метод

Prints trace information.
public TraceOutput ( string format, object arg ) : void
format string
arg object
Результат void

UnwindStack() публичный Метод

Resets the stack to the specified depth.
public UnwindStack ( ushort depth ) : void
depth ushort
Результат void

Описание свойств

IndexicalBindingStack публичное свойство

public List> IndexicalBindingStack
Результат object>>.List

Output публичное свойство

The defaultstream to write output to.
public TextWriter,System.IO Output
Результат System.IO.TextWriter

This публичное свойство

The GameObject or Component responsible for initiating the current top-level goal.
public object This
Результат object