GH_Path

References
[DebuggerDisplay("{DebuggerDisplay}")] public class GH_Path : IComparable<GH_Path>, IComparer<GH_Path>, GH_ISerializable
Describes the path in structure space of a data item or a list of items. A path consists of a series of integers, each one of which represents an index in a branch structure.

Constructors

GH_Path

#
Default constructor, creates a path with zero elements.
public GH_Path()

GH_Path

#
Creates an exact copy of another path.
public GH_Path(
GH_Path
Other
Path to copy, cannot be null.
)
ArgumentNullExceptionThrown if Other is a null reference

GH_Path

#
Creates a new path with a single element.
public GH_Path(
index
The index of the first element.
)

GH_Path

#
Creates a new path from a series of elements.
public GH_Path(
params int[]
args
The index values of this path, if null, an empty path is created.
)

Properties

DebuggerDisplay

#
Gets the debugger display string for this Path instance.
[EditorBrowsable(EditorBrowsableState.Never)] [Browsable(false)] public string DebuggerDisplay { get; }

Indices

#
Gets or sets the entire index space; the path that identifies an element in structure space. You should not change the index space when the path is used inside a structure since it will invalidate the sort order. If you don't know what you're doing, for Pete's sake don't touch this.
public int[] Indices { get; set; }

InternalPath

#
Gets or sets the entire index space; the path that identifies an element in structure space. You should not change the index space when the path is used inside a structure since it will invalidate the sort order. If you don't know what you're doing, for Pete's sake don't touch this.
[EditorBrowsable(EditorBrowsableState.Never)] [Browsable(false)] public int[] InternalPath { get; set; }
obsoleteThis property has been replaced by the Indices property

Length

#
Returns the number of dimensions in the path.
public int Length { get; }

Valid

#
Gets whether this path is valid. Invalid paths either have no elements or negative elements.
public bool Valid { get; }

Indexers

Dimension

#
Gets or sets the value of the path at the given dimension index.
[Browsable(false)] public int this[
index
Index of dimension.
] { get; set; }

Methods

AppendElement

#
Create a new path by appending a new index value to this path.
public GH_Path AppendElement(
index
Index value to append.
)

Compare

#
Compare two paths. This function determines the Sorting behaviour of paths.
public int Compare()

CompareTo

#
Compare this path to another path. This function determines the Sorting behaviour of paths.
public int CompareTo(
other
)

CullElement

#
Removes the last index value from the path. If the path is already empty, nothing will happen.
public GH_Path CullElement()

CullFirstElement

#
Removes the first index value from the path. If the path is already empty, nothing will happen.
public GH_Path CullFirstElement()

Format

#
Format a path.
public string Format(
format_provider,
The string describing the format. You are allowed to use {0} as a format placeholder. The placeholder will be filled up with a semi-colon separated list: 0;0;2;4
separator
Character to use for element separators. The default separator is a semi-colon.
)
Formatted string.

FromString

#
Try to deserialize a GH_Path from a String.
public bool FromString()

GetHashCode

#
Specialized Hash code pattern.
public override int GetHashCode()

Increment

#
Increment a specific index in this path by one.
public GH_Path Increment(
index,
Index to increment. Valis indices are (-Length+1) to (Length-1).
offset
Amount to increment.
)
A new path with incremented index.

Increment

#
Increment a specific index in this path by one.
public GH_Path Increment(
index
Index to increment. Valid indices are (-Length+1) to (Length-1).
)
A new path with incremented index.

IsAncestor

#
Test another path to see if it is an ancestor of this path. For a path to be considered an ancestor, it must share the initial dimensions.
public bool IsAncestor(
potential_ancestor,
Parental path to test.
ref int
additional_generations
This value will hold the number of generations between parent and child path.
)
True if other overlaps completely with this path while being at least one element shorter.

IsCoincident

#
Test to see if this path is coincident with another path.
public bool IsCoincident(
other
Path to compare to.
)
True if both paths are coincident (identical), false if not.

IsCoincident

#
Test to see if this path is coincident with set of integers.
public bool IsCoincident(
params int[]
index_list
Integers to compare to.
)
True if both paths are coincident (identical), false if not.

PrependElement

#
Create a new path by prepending a new index value to this path.
public GH_Path PrependElement(
index
Index value to prepend.
)

Read

#
Read this path from an archive.
public bool Read(
reader
Object to read with.
)
True on success, false on failure.
Read

SplitPathLikeString

#
Try to split up a path-like formatted string "{A;B;C}(i)" into component parts.
public static bool SplitPathLikeString(
s,
String to parse.
ref string[]
path_segments,
Output - Strings inside the path portion of s.
ref string
index_segment
Output - String inside the index portion of s.
)
True on success, false on failure.

ToString

#
Concatenates the indices in the path.
public override string ToString()
Object.ToString

ToString

#
Concatenates the indices in the path.
public string ToString(
includeBrackets
If True, brackets will be prepended and appended to the path string.
)

Write

#
Write this path to an archive.
public bool Write(
writer
Object to write with.
)
True on success, false on failure.
Write

Operators