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

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

GH_Path

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

GH_Path

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

GH_Path

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

Properties

DebuggerDisplay

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

Indices

#
public int[] Indices { get; set; }
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.

InternalPath

#
[EditorBrowsable(EditorBrowsableState.Never)] [Browsable(false)] public int[] InternalPath { get; set; }
obsoleteThis property has been replaced by the Indices property
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.

Length

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

Valid

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

Indexers

Dimension

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

Methods

AppendElement

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

Compare

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

CompareTo

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

CullElement

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

CullFirstElement

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

Format

#
public string Format(string format_provider, string separator)
Format a path.
format_provider (string)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 (string)Character to use for element separators. The default separator is a semi-colon.
Formatted string.

FromString

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

GetHashCode

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

Increment

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

Increment

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

IsAncestor

#
public bool IsAncestor(GH_Path potential_ancestor, ref int additional_generations)
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.
potential_ancestor (GH_Path)Parental path to test.
additional_generations (ref int)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

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

IsCoincident

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

PrependElement

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

Read

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

SplitPathLikeString

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

ToString

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

ToString

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

Write

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

Operators