Skip to content

BH.oM.Base.ComparisonFunctions

Additional functions that can be specified as delegates and that will be executed while determining the uniqueness of an object, i.e. when comparing and when computing the object Hash.

Class structure

Implemented interfaces and base types

The ComparisonFunctions is inheriting from the following base type(s) and implements the following interfaces:

Properties

Defining properties

The following properties are defined on the class

Name Type Description Quantity
PropertyFullNameModifier Func<string, object, string> This function is executed every time a 'property full name' is considered, and it modifies it.
A property full name is the full property path, e.g. for a property named Position, the full name could be BH.oM.Structure.Elements.Node.Position or BH.oM.Structure.Elements.Bar.StartNode.Position, etc., depending on the object being considered.
First parameter (string): property full name. Second parameter (object): the object holding this property. Return value (string): the modified property name.
Example of property path: if interested in the property Position, the property path can be specified as BH.oM.Structure.Elements.Node.Position or BH.oM.Structure.Elements.Bar.StartNode.Position, etc., depending on the object being considered, or simply as Position if any property named as such is to be matched.
-
PropertyFullNameFilter Func<string, object, bool> A filter function on each 'property full name' being considered during comparison.
A property full name is the full property path, e.g. for a property named Position, the full name could be BH.oM.Structure.Elements.Node.Position or BH.oM.Structure.Elements.Bar.StartNode.Position, etc., depending on the object being considered.
If the Func returns true, the property is skipped (not considered when comparing or computing the Hash).
First parameter (string): property full name. Second parameter (object): the object holding this property. Return value (bool): true if the property is to be skipped, false otherwise.
-
CustomDataKeyFilter Func<string, object, bool> A filter function on CustomData keys. If the Func returns true, the key is skipped (not considered when comparing or computing the Hash).
First parameter (string): Custom Data key. Second parameter (object): the CustomData dictionary. Return value (bool): true if the key is to be skipped, false otherwise.
-
PropertyDisplayNameModifier Func<string, object, string> This function is executed before a 'property full name' is returned as a difference, and it modifies it.
A property full name is the full property path, e.g. for a property named Position, the full name could be BH.oM.Structure.Elements.Node.Position or BH.oM.Structure.Elements.Bar.StartNode.Position, etc., depending on the object being considered.
First parameter (string): property full name. Second parameter (object): the object holding this property. Return value (string): the modified property name.
Example of property path: if interested in the property Position, the property path can be specified as BH.oM.Structure.Elements.Node.Position or BH.oM.Structure.Elements.Bar.StartNode.Position, etc., depending on the object being considered, or simply as Position if any property named as such is to be matched.
-

Code and Schema

C# implementation

C#
public class ComparisonFunctions : BH.oM.Base.IObject

Assembly: BHoM.dll

The C# class definition is available on github:

All history and changes of the class can be found by inspection the history.

JSON Schema implementation

The object is defined as a JSON schema. You can validate a JSON instance against this schema by reference. To do this, use the schema reference below in a validator like this one.

JSON Schema
{
 "$ref" : "https://raw.githubusercontent.com/BHoM/BHoM_JSONSchema/develop/BHoM/ComparisonFunctions.json"
}

The JSON Schema is available on github here: