Click or drag to resize

PushdownAutomatonT Class

A simple Pushdown Automaton with states as objects. If your state classes have an empty constructor, the state machine can register the states automatically when needed (using PushStateAutoTState and ChangeStateAutoTState). If not you should register the states yourself using RegisterStateTypeTState or RegisterStateType(Type, FuncIPdaStateT) and use the regular. The machine will automatically pool the states so you don't have to worry about it. Whether or popping the last state is valid is up to your design.
Inheritance Hierarchy
SystemObject
  Archon.SwissArmyLib.AutomataPushdownAutomatonT

Namespace:  Archon.SwissArmyLib.Automata
Assembly:  Archon.SwissArmyLib (in Archon.SwissArmyLib.dll) Version: 1.0.0.0 (1.0.0.0)
Syntax
C#
public class PushdownAutomaton<T>
Request Example View Source

Type Parameters

T
The type of the context.

The PushdownAutomatonT type exposes the following members.

Constructors
Properties
  NameDescription
Public propertyContext
A shared context which all states have access to.
Public propertyCurrentState
The active state.
Top
Methods
  NameDescription
Public methodChangeStateTState
Replaces the active state with another state, without notifying the underlying state.
Public methodChangeStateAutoTState
Replaces the active state with another state, without notifying the underlying state. If the state is not registered, it will automatically be and its empty constructor will be used to create the instances.
Public methodEquals
Determines whether the specified Object is equal to the current Object.
(Inherited from Object.)
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodGetHashCode
Serves as a hash function for a particular type.
(Inherited from Object.)
Public methodGetType
Gets the type of the current instance.
(Inherited from Object.)
Public methodIsRegisteredTState
Checks whether a state type is registered in the machine.
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodPopAll
Pops all states in the stack.
Public methodPopState
Pops the current state and resumes the underlying state.
Public methodPushStateTState
Pushes a state to the top of the stack and pauses the underlying state.
Public methodPushStateAutoTState
Pushes a state to the top of the stack and pauses the underlying state. If the state is not registered, it will automatically be and its empty constructor will be used to create the instances.
Public methodPushStateSilentlyTState
Pushes a state to the top of the stack without notifying the underlying state.
Public methodPushStateSilentlyAutoTState
Pushes a state to the top of the stack without notifying the underlying state. If the state is not registered, it will automatically be and its empty constructor will be used to create the instances.
Public methodRegisterStateType(Type, FuncIPdaStateT)
Registers a state type in the machine. A pool for the type will be created which uses the given creationMethod to create new instance when needed.
Public methodRegisterStateTypeTState
Registers a state type in the machine. A pool for the type will be created that will use the empty constructor.
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Public methodUpdate
Call this every time the machine should update. Eg. every frame.
Top
See Also