Table of Contents

Class Reference

Namespace
EzrSquared.Runtime
Assembly
ezrSquared-lib.dll

A reference to an IEzrObject, with its scope, usable name and more metadata.

public class Reference : IMutable<Reference>
Inheritance
object
Reference
Implements

Remarks

It is recommended to get references from the ReferencePool instead of creating them manually.

Constructors

Reference(IEzrObject?, AccessMod, string)

A reference to an IEzrObject, with its scope, usable name and more metadata.

public Reference(IEzrObject? @object = null, AccessMod accessibilityModifiers = AccessMod.None, string name = "")

Parameters

object IEzrObject

The IEzrObject being referenced.

accessibilityModifiers AccessMod

The accessibility modifiers of the reference.

name string

The name of the reference.

Remarks

It is recommended to get references from the ReferencePool instead of creating them manually.

Fields

AccessibilityModifiers

The accessibility modifiers of the reference. See AccessMod.

public AccessMod AccessibilityModifiers

Field Value

AccessMod

Empty

Static readonly empty reference.

public static readonly Reference Empty

Field Value

Reference

Properties

IsEmpty

Does this reference actually reference anything?

public bool IsEmpty { get; private set; }

Property Value

bool

IsRegistered

Is this reference registered anywhere, except RuntimeResults?

public bool IsRegistered { get; }

Property Value

bool

IsRegisteredIncludingResult

Is this reference registered anywhere, including RuntimeResults?

public bool IsRegisteredIncludingResult { get; }

Property Value

bool

Name

The name of the reference, may be string.Empty.

public string Name { get; private set; }

Property Value

string

Object

The IEzrObject this references.

public IEzrObject Object { get; private set; }

Property Value

IEzrObject

RegisteredContext

The Context in which the reference is defined in. May be null.

public Context? RegisteredContext { get; private set; }

Property Value

Context

RegisteredIn

The number of other objects that have this reference registered.

public int RegisteredIn { get; private set; }

Property Value

int

RegisteredInResult

Is this reference registered in a RuntimeResult?

public bool RegisteredInResult { get; private set; }

Property Value

bool

Methods

DeepCopy(RuntimeResult)

Creates a copy of the reference AND the referenced object, if it is mutable.

public IMutable<Reference>? DeepCopy(RuntimeResult result)

Parameters

result RuntimeResult

Runtime result to return errors in.

Returns

IMutable<Reference>

The copy, or, null if failed.

Remarks

This copy only includes the original's Object, AccessibilityModifiers and Name.

Reset(IEzrObject?, AccessMod, string)

Resets the reference.

public Reference Reset(IEzrObject? @object, AccessMod accessibilityModifiers, string name)

Parameters

object IEzrObject

The IEzrObject being referenced.

accessibilityModifiers AccessMod

The accessibility modifiers of the reference.

name string

The name of the reference.

Returns

Reference

ShallowCopy()

Creates a very shallow copy of the reference.

public Reference ShallowCopy()

Returns

Reference

The copy.

Remarks

This copy only includes the original's Object and AccessibilityModifiers.

UpdateName(string)

Updates the reference with a new Name value.

public void UpdateName(string name)

Parameters

name string

The new name.

UpdateObject(IEzrObject, AccessMod)

Updates the reference with new Object and AccessibilityModifiers values.

public void UpdateObject(IEzrObject @object, AccessMod accessibilityModifiers = AccessMod.None)

Parameters

object IEzrObject

The new object to reference.

accessibilityModifiers AccessMod

The new accessibility modifiers.

UpdateRegister(bool)

Updates the reference with a new RegisteredIn value.

public void UpdateRegister(bool isRegistered)

Parameters

isRegistered bool

Is it an unregister or register operation?

UpdateRegisteredContext(Context?, Context?)

Updates the reference with a new RegisteredContext value.

public void UpdateRegisteredContext(Context? context, Context? releasingContext = null)

Parameters

context Context

The new context.

releasingContext Context

The context that may be deleted after this is called. If the referenced object's creation context matches this, it is updated.

Remarks

This does not actually change the Context this reference is defined in, but it changes the reference to the Context this is defined in.

UpdateResultRegister(bool)

Updates the reference with a new RegisteredInResult value.

public void UpdateResultRegister(bool isRegistered)

Parameters

isRegistered bool

The new value.