Class ParticleAttributeWithHistory<T>
Abstract base class for particle attributes that adds functionality which should be hidden from the algorithm developer, especially the history methods.
Inheritance
Implements
Namespace: AS2.Sim
Assembly: .dll
Syntax
public abstract class ParticleAttributeWithHistory<T> : ParticleAttribute<T>, IReplayHistory
Type Parameters
Name | Description |
---|---|
T | The type of values the attribute stores. |
Constructors
| Edit this page View SourceParticleAttributeWithHistory(Particle, string)
Declaration
public ParticleAttributeWithHistory(Particle p, string name)
Parameters
Type | Name | Description |
---|---|---|
Particle | p | |
string | name |
Fields
| Edit this page View SourcehasIntermediateVal
Flag that indicates whether the intermediate value has been written. Will be reset after each round.
Declaration
protected bool hasIntermediateVal
Field Value
Type | Description |
---|---|
bool |
history
The history of values recorded by this attribute.
Declaration
protected ValueHistory<T> history
Field Value
Type | Description |
---|---|
ValueHistory<T> |
intermediateVal
The value written to the attribute in the move activation phase. This value is not stored in the internal history. It is written during the move phase and serves as previous value during the beep phase.
Declaration
protected T intermediateVal
Field Value
Type | Description |
---|---|
T |
Methods
| Edit this page View SourceContinueTracking()
Resets the marker to track the latest recorded state and to continue evolving as the simulation progresses.
Declaration
public virtual void ContinueTracking()
CutOffAtMarker()
Deletes all recorded states after the currently marked round.
Declaration
public virtual void CutOffAtMarker()
GenerateSaveData()
Implementation of GenerateSaveData().
Declaration
public virtual ParticleAttributeSaveDataBase GenerateSaveData()
Returns
Type | Description |
---|---|
ParticleAttributeSaveDataBase | A serializable representation of the attribute's state. |
GetAttributeType()
Declaration
public virtual Type GetAttributeType()
Returns
Type | Description |
---|---|
Type |
GetFirstRecordedRound()
Returns the first round for which a state has been recorded.
The object cannot be reset to a time before this round.
Declaration
public virtual int GetFirstRecordedRound()
Returns
Type | Description |
---|---|
int | The first round for which a state has been recorded. |
GetMarkedRound()
Returns the round that is currently marked.
If the marker is tracking the object's state, this round will increase every time a new value is recorded.
Declaration
public virtual int GetMarkedRound()
Returns
Type | Description |
---|---|
int | The round that is currently marked. |
GetObjectValue()
Declaration
public virtual object GetObjectValue()
Returns
Type | Description |
---|---|
object |
IsTracking()
Checks whether the object is currently tracking the latest recorded state.
If the object is not tracking, it may not be usable in the regular way until the tracking is continued.
Declaration
public virtual bool IsTracking()
Returns
Type | Description |
---|---|
bool | Whether the marker currently tracks the latest recorded state. |
ResetIntermediateValue()
Declaration
public void ResetIntermediateValue()
RestoreFromSaveData(ParticleAttributeSaveDataBase)
Implementation of RestoreFromSaveData(ParticleAttributeSaveDataBase).
Declaration
public virtual bool RestoreFromSaveData(ParticleAttributeSaveDataBase data)
Parameters
Type | Name | Description |
---|---|---|
ParticleAttributeSaveDataBase | data | A serializable representation of a particle attribute state. |
Returns
Type | Description |
---|---|
bool |
|
SetMarkerToRound(int)
Sets the tracking marker to the specified round, restores the state recorded for that point in time, and stops the marker from tracking the latest round.
The target round must not be earlier than the round returned by GetFirstRecordedRound().
Declaration
public virtual void SetMarkerToRound(int round)
Parameters
Type | Name | Description |
---|---|---|
int | round | The round to which the tracking marker should be set. |
ShiftTimescale(int)
Shifts all records as well as the marker by the specified amount of rounds.
Declaration
public virtual void ShiftTimescale(int amount)
Parameters
Type | Name | Description |
---|---|---|
int | amount | The number of rounds to add to each entry. May be negative. |
StepBack()
Moves the marker one round back and restores the object's recorded state for that round. Also stops it from tracking the last round if it was still tracking.
Must not be called when the marker is already at the first recorded round.
Declaration
public virtual void StepBack()
StepForward()
Moves the marker one round forward and restores the object's recorded state for that round. Also stops it from tracking the last round if it was still tracking.
May be ineffective if the object has a hard limit on the last recorded round.
Declaration
public virtual void StepForward()
ToString_AttributeName()
Declaration
public virtual string ToString_AttributeName()
Returns
Type | Description |
---|---|
string |