Class FirstOfGoalStructure<TBeliefSet>
- Namespace
- Aplib.Core.Desire.GoalStructures
- Assembly
- Aplib.Core.dll
Represents a goal structure that will complete if any one of its children completes.
public class FirstOfGoalStructure<TBeliefSet> : GoalStructure<TBeliefSet>, IGoalStructure<TBeliefSet>, ICompletable, ILoggable, IDocumented, IDisposable where TBeliefSet : IBeliefSet
Type Parameters
TBeliefSet
The beliefset of the agent.
- Inheritance
-
GoalStructure<TBeliefSet>FirstOfGoalStructure<TBeliefSet>
- Implements
-
IGoalStructure<TBeliefSet>
- Inherited Members
- Extension Methods
Remarks
The children of this goal structure will be executed in the order they are given.
Constructors
FirstOfGoalStructure(params IGoalStructure<TBeliefSet>[])
Initializes a new instance of the FirstOfGoalStructure<TBeliefSet> class.
public FirstOfGoalStructure(params IGoalStructure<TBeliefSet>[] children)
Parameters
children
IGoalStructure<TBeliefSet>[]The children of the goal structure.
FirstOfGoalStructure(IMetadata, params IGoalStructure<TBeliefSet>[])
Initializes a new instance of the FirstOfGoalStructure<TBeliefSet> class.
public FirstOfGoalStructure(IMetadata metadata, params IGoalStructure<TBeliefSet>[] children)
Parameters
metadata
IMetadataMetadata about this GoalStructure, used to quickly display the goal in several contexts.
children
IGoalStructure<TBeliefSet>[]The children of the goal structure.
Methods
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public void Dispose()
Dispose(bool)
Disposes of the goal structure.
protected virtual void Dispose(bool disposing)
Parameters
disposing
boolWhether we are actually disposing.
GetCurrentGoal(TBeliefSet)
Gets the current goal using the given IBeliefSet.
public override IGoal<TBeliefSet> GetCurrentGoal(TBeliefSet beliefSet)
Parameters
beliefSet
TBeliefSetThe belief set of the agent.
Returns
- IGoal<TBeliefSet>
The current goal to be fulfilled.
GetLogChildren()
Gets the children of the loggable object.
public override IEnumerable<ILoggable> GetLogChildren()
Returns
- IEnumerable<ILoggable>
The children of the loggable object.
Reset()
Resets the goal structure to its initial state.
public override void Reset()
UpdateStatus(TBeliefSet)
Updates the status of the FirstOfGoalStructure<TBeliefSet>. The goal structure status is set to:
- SuccessWhen any one of its children is successful.
- FailureWhen all children fail.
- UnfinishedOtherwise.
public override void UpdateStatus(TBeliefSet beliefSet)
Parameters
beliefSet
TBeliefSetThe belief set of the agent.