Class Path
A Path denotes a particular walk through a graph as defined by a ITraversal.
public class Path : IReadOnlyList<object?>, IReadOnlyCollection<object?>, IEnumerable<object?>, IEnumerable, IEquatable<Path>
- Inheritance
-
Path
- Implements
- Inherited Members
Remarks
In abstraction, any Path implementation maintains two lists: a list of sets of labels and a list of objects. The list of labels are the labels of the steps traversed. The list of objects are the objects traversed.
Constructors
Path(IList<ISet<string>>, IList<object?>)
Initializes a new instance of the Path class.
public Path(IList<ISet<string>> labels, IList<object?> objects)
Parameters
labels
IList<ISet<string>>The labels associated with the path
objects
IList<object>The objects in the Path.
Properties
Count
Gets the number of steps in the path.
public int Count { get; }
Property Value
this[int]
Get the object associated with the specified index into the path.
public dynamic? this[int index] { get; }
Parameters
index
intThe index of the path
Property Value
- dynamic
The object associated with the index of the path
this[string]
Gets the object associated with the particular label of the path.
public object this[string label] { get; }
Parameters
label
stringThe label of the path
Property Value
- object
The object associated with the label of the path
Remarks
If the path has multiple labels of the type, then get a collection of those objects.
Exceptions
- KeyNotFoundException
Thrown if the path does not contain the label.
Labels
Gets an ordered list of the labels associated with the Path.
public IList<ISet<string>> Labels { get; }
Property Value
Objects
Gets an ordered list of the objects in the Path.
public IList<object?> Objects { get; }
Property Value
Methods
ContainsKey(string)
Returns true if the path has the specified label, else return false.
public bool ContainsKey(string key)
Parameters
key
stringThe label to search for.
Returns
- bool
True if the label exists in the path.
Equals(Path?)
public bool Equals(Path? other)
Parameters
other
Path
Returns
Equals(object?)
public override bool Equals(object? obj)
Parameters
obj
object
Returns
GetEnumerator()
public IEnumerator<object> GetEnumerator()
Returns
GetHashCode()
public override int GetHashCode()
Returns
ToString()
public override string ToString()
Returns
TryGetValue(string, out object?)
Tries to get the object associated with the particular label of the path.
public bool TryGetValue(string label, out object? value)
Parameters
Returns
- bool
True, if an object was found for the label.
Remarks
If the path has multiple labels of the type, then get a collection of those objects.