Table of Contents

Class QueryAction<TBeliefSet, TQuery>

Namespace
Aplib.Core.Intent.Actions
Assembly
Aplib.Core.dll

Describes an action that can be executed and guarded with a query that stores a result. The result can be used in the effect.

public class QueryAction<TBeliefSet, TQuery> : Action<TBeliefSet>, ILoggable, IDocumented, IQueryable<TBeliefSet>, IAction<TBeliefSet> where TBeliefSet : IBeliefSet

Type Parameters

TBeliefSet

The belief set of the agent.

TQuery

The type of the query of the action

Inheritance
Action<TBeliefSet>
QueryAction<TBeliefSet, TQuery>
Implements
IQueryable<TBeliefSet>
IAction<TBeliefSet>
Inherited Members
Extension Methods

Constructors

QueryAction(IMetadata, Action<TBeliefSet, TQuery>, Func<TBeliefSet, TQuery?>)

Initializes a new instance of the QueryAction<TBeliefSet, TQuery> class.

public QueryAction(IMetadata metadata, Action<TBeliefSet, TQuery> effect, Func<TBeliefSet, TQuery?> query)

Parameters

metadata IMetadata

Metadata about this action, used to quickly display the action in several contexts.

effect Action<TBeliefSet, TQuery>

The effect of the action.

query Func<TBeliefSet, TQuery>

The query of the action.

QueryAction(Action<TBeliefSet, TQuery>, Func<TBeliefSet, TQuery?>)

Initializes a new instance of the QueryAction<TBeliefSet, TQuery> class.

public QueryAction(Action<TBeliefSet, TQuery> effect, Func<TBeliefSet, TQuery?> query)

Parameters

effect Action<TBeliefSet, TQuery>

The effect of the action.

query Func<TBeliefSet, TQuery>

The query of the action.

Fields

_effect

Gets or sets the effect of the action.

protected readonly Action<TBeliefSet, TQuery> _effect

Field Value

Action<TBeliefSet, TQuery>

_query

Gets or sets the query of the action.

protected readonly Func<TBeliefSet, TQuery?> _query

Field Value

Func<TBeliefSet, TQuery>

_storedQueryResult

Gets or sets the result of the query.

protected TQuery? _storedQueryResult

Field Value

TQuery

Methods

Execute(TBeliefSet)

Executes the action on the specified belief set.

public override void Execute(TBeliefSet beliefSet)

Parameters

beliefSet TBeliefSet

The belief set on which the action is executed.

Query(TBeliefSet)

Queries the environment for the queried item and returns whether the query is not null.

public bool Query(TBeliefSet beliefSet)

Parameters

beliefSet TBeliefSet

The belief set of the agent.

Returns

bool

True if the query is not null; otherwise, false.