Class Atom
Implements an Atom. Atoms can be used to signal Cortex.Net that some observable data source has been observed or changed. And Cortex.Net will signal the atom whenever it is used or no longer in use.
Namespace: Cortex.Net.Core
Assembly: Cortex.Net.dll
Syntax
public class Atom : object, IAtom, IObservable, IDependencyNode
Properties
| Improve this Doc View SourceIsBeingObserved
Gets or sets a value indicating whether the observable is being observed. An observable is being observed when at least one derivation actually accesses its value.
Declaration
public bool IsBeingObserved { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsPendingUnobservation
Gets or sets a value indicating whether this atom is pending Unobservation.
Declaration
public bool IsPendingUnobservation { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
LastAccessedBy
Gets or sets the Id of the derivation run that last accessed this observable. If this Id equals the RunId of the current derivation the dependency is already established.
Declaration
public int LastAccessedBy { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
LowestObserverState
Gets or sets the lowest DerivationState on any of it's observers.
Declaration
public DerivationState LowestObserverState { get; set; }
Property Value
Type | Description |
---|---|
DerivationState |
Name
Gets the Name of the Atom instance.
Declaration
public string Name { get; }
Property Value
Type | Description |
---|---|
System.String |
Observers
Gets the Observers.
Declaration
public ISet<IDerivation> Observers { get; }
Property Value
Type | Description |
---|---|
ISet<IDerivation> |
SharedState
Gets the Shared State of all the nodes in the dependency graph.
Declaration
public ISharedState SharedState { get; }
Property Value
Type | Description |
---|---|
ISharedState |
Methods
| Improve this Doc View SourceOnBecomeObserved()
Method that triggers event BecomeObserved.
Declaration
public void OnBecomeObserved()
OnBecomeUnobserved()
Method that triggers event BecomeUnobserved.
Declaration
public void OnBecomeUnobserved()
ReportChanged()
Invoke this method after this atom has changed to signal Cortex.Net that all its observers should invalidate.
Declaration
public void ReportChanged()
ReportObserved()
Invoke this method to notify Cortex.Net that your atom has been used somehow.
Declaration
public bool ReportObserved()
Returns
Type | Description |
---|---|
System.Boolean | Returns true if there is currently a reactive context. |
ToString()
Returns the name of this Atom.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
System.String | The name of the Atom. |
Events
| Improve this Doc View SourceBecomeObserved
Event that will fire after the Atom has become observed.
Declaration
public event EventHandler BecomeObserved
Event Type
Type | Description |
---|---|
EventHandler |
BecomeUnobserved
Event that will fire after the observable has become unobserved.
Declaration
public event EventHandler BecomeUnobserved
Event Type
Type | Description |
---|---|
EventHandler |