Class VirtualNodeName
Represents the name of a virtual node. This class handles the generation, validation, and comparison of node names.
Inherited Members
Namespace: AkiraNetwork.VirtualStorageLibrary
Assembly: VirtualStorageLibrary.dll
Syntax
public class VirtualNodeName : IEquatable<VirtualNodeName>, IComparable<VirtualNodeName>, IComparable
Constructors
VirtualNodeName(string)
Initializes a new instance of the VirtualNodeName class with the specified name.
Declaration
public VirtualNodeName(string name)
Parameters
Type | Name | Description |
---|---|---|
string | name | The name of the node. |
Properties
IsDot
Indicates whether the node is a single dot representing the current directory.
Declaration
public bool IsDot { get; }
Property Value
Type | Description |
---|---|
bool |
|
IsDotDot
Indicates whether the node is a double dot representing the parent directory.
Declaration
public bool IsDotDot { get; }
Property Value
Type | Description |
---|---|
bool |
|
IsRoot
Indicates whether the node is the root node.
Declaration
public bool IsRoot { get; }
Property Value
Type | Description |
---|---|
bool |
|
Name
Gets the name of the node.
Declaration
public string Name { get; }
Property Value
Type | Description |
---|---|
string | The name of this node. |
Methods
CompareTo(VirtualNodeName?)
Compares this instance with a specified VirtualNodeName.
Declaration
public int CompareTo(VirtualNodeName? other)
Parameters
Type | Name | Description |
---|---|---|
VirtualNodeName | other | The VirtualNodeName to compare with. |
Returns
Type | Description |
---|---|
int | A value indicating the relative order of the instances being compared. |
CompareTo(object?)
Compares this instance with a specified object.
Declaration
public int CompareTo(object? obj)
Parameters
Type | Name | Description |
---|---|---|
object | obj | The object to compare with. |
Returns
Type | Description |
---|---|
int | A value indicating the relative order of the instances being compared. |
Exceptions
Type | Condition |
---|---|
ArgumentException | Thrown when the object is not a VirtualNodeName. |
Equals(VirtualNodeName?)
Determines whether the specified VirtualNodeName is equal to this instance.
Declaration
public bool Equals(VirtualNodeName? other)
Parameters
Type | Name | Description |
---|---|---|
VirtualNodeName | other | The VirtualNodeName to compare with this instance. |
Returns
Type | Description |
---|---|
bool |
|
Equals(object?)
Determines whether the specified object is equal to this instance.
Declaration
public override bool Equals(object? obj)
Parameters
Type | Name | Description |
---|---|---|
object | obj | The object to compare with this instance. |
Returns
Type | Description |
---|---|
bool |
|
Overrides
GenerateNodeName(string)
Generates a new node name using the specified prefix.
Declaration
public static VirtualNodeName GenerateNodeName(string prefix)
Parameters
Type | Name | Description |
---|---|---|
string | prefix | The prefix for the node name. |
Returns
Type | Description |
---|---|
VirtualNodeName | The generated node name. |
Remarks
The current implementation may be improved for better usability, including a possible re-implementation of the node name generation. Users are advised to check for updates in the documentation regularly.
Exceptions
Type | Condition |
---|---|
ArgumentException | Thrown when the prefix is an empty string. |
GetHashCode()
Returns a hash code for this instance.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
int | A hash code for this instance. |
Overrides
IsValidNodeName(VirtualNodeName)
Checks if a node name is valid.
Declaration
public static bool IsValidNodeName(VirtualNodeName nodeName)
Parameters
Type | Name | Description |
---|---|---|
VirtualNodeName | nodeName | The node name to check. |
Returns
Type | Description |
---|---|
bool |
|
ResetCounter()
Resets the counter used for node name generation.
Declaration
public static void ResetCounter()
ToString()
Returns the name of the node as a string.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
string | The name of the node as a string. |
Overrides
Operators
operator ==(VirtualNodeName?, VirtualNodeName?)
Determines whether two VirtualNodeName instances are equal.
Declaration
public static bool operator ==(VirtualNodeName? left, VirtualNodeName? right)
Parameters
Type | Name | Description |
---|---|---|
VirtualNodeName | left | The left VirtualNodeName to compare. |
VirtualNodeName | right | The right VirtualNodeName to compare. |
Returns
Type | Description |
---|---|
bool |
|
implicit operator string(VirtualNodeName)
Implicitly converts a VirtualNodeName to a string.
Declaration
public static implicit operator string(VirtualNodeName nodeName)
Parameters
Type | Name | Description |
---|---|---|
VirtualNodeName | nodeName | The VirtualNodeName to convert. |
Returns
Type | Description |
---|---|
string |
implicit operator VirtualNodeName(string)
Implicitly converts a string to a VirtualNodeName.
Declaration
public static implicit operator VirtualNodeName(string name)
Parameters
Type | Name | Description |
---|---|---|
string | name | The string to convert. |
Returns
Type | Description |
---|---|
VirtualNodeName |
operator !=(VirtualNodeName?, VirtualNodeName?)
Determines whether two VirtualNodeName instances are not equal.
Declaration
public static bool operator !=(VirtualNodeName? left, VirtualNodeName? right)
Parameters
Type | Name | Description |
---|---|---|
VirtualNodeName | left | The left VirtualNodeName to compare. |
VirtualNodeName | right | The right VirtualNodeName to compare. |
Returns
Type | Description |
---|---|
bool |
|