Class DataTypeObjectEqualityComparator
Stateful comparator for objects with data model-compliant types. This comparator uses dictionaries and lists to detect recursion in objects and types.
Inheritance
Namespace: Nuqleon.DataModel.TypeSystem
Assembly: Nuqleon.DataModel.CompilerServices.dll
Syntax
[KnownType]
public class DataTypeObjectEqualityComparator : Object, IEqualityComparer<object>, IClearable
Constructors
DataTypeObjectEqualityComparator()
Instantiates the comparator.
Declaration
public DataTypeObjectEqualityComparator()
Methods
Clear()
Clears the state in the object for reuse in an object pool.
Declaration
protected void Clear()
Equals(Object, Object)
Checks for value equality of two objects with data model-compliant types.
Declaration
public bool Equals(object x, object y)
Parameters
Type | Name | Description |
---|---|---|
System.Object | x | The first object. |
System.Object | y | The second object. |
Returns
Type | Description |
---|---|
System.Boolean | true if the objects are equal, false otherwise. |
EqualsArray(Object, Object, ArrayDataType, ArrayDataType)
Checks the equality of a pair of objects with array data model types.
Declaration
protected virtual bool EqualsArray(object expected, object actual, ArrayDataType expectedDataType, ArrayDataType actualDataType)
Parameters
Type | Name | Description |
---|---|---|
System.Object | expected | The first object. |
System.Object | actual | The second object. |
ArrayDataType | expectedDataType | The left data type. |
ArrayDataType | actualDataType | The right data type. |
Returns
Type | Description |
---|---|
System.Boolean | true if the objects are equal, false otherwise. |
EqualsCustom(Object, Object, DataType, DataType)
Checks the equality of a pair of objects with custom data model types.
Declaration
protected virtual bool EqualsCustom(object expected, object actual, DataType expectedDataType, DataType actualDataType)
Parameters
Type | Name | Description |
---|---|---|
System.Object | expected | The first object. |
System.Object | actual | The second object. |
DataType | expectedDataType | The left data type. |
DataType | actualDataType | The right data type. |
Returns
Type | Description |
---|---|
System.Boolean | true if the objects are equal, false otherwise. |
EqualsExpression(Object, Object, ExpressionDataType, ExpressionDataType)
Checks the equality of a pair of objects with expression data model types.
Declaration
protected virtual bool EqualsExpression(object expected, object actual, ExpressionDataType expectedDataType, ExpressionDataType actualDataType)
Parameters
Type | Name | Description |
---|---|---|
System.Object | expected | The first object. |
System.Object | actual | The second object. |
ExpressionDataType | expectedDataType | The left data type. |
ExpressionDataType | actualDataType | The right data type. |
Returns
Type | Description |
---|---|
System.Boolean | true if the objects are equal, false otherwise. |
EqualsExtension(Object, Object, DataType, DataType)
Checks the equality of a pair of objects with extension data model types.
Declaration
protected virtual bool EqualsExtension(object expected, object actual, DataType expectedDataType, DataType actualDataType)
Parameters
Type | Name | Description |
---|---|---|
System.Object | expected | The first object. |
System.Object | actual | The second object. |
DataType | expectedDataType | The left data type. |
DataType | actualDataType | The right data type. |
Returns
Type | Description |
---|---|
System.Boolean | true if the objects are equal, false otherwise. |
EqualsFunction(Object, Object, FunctionDataType, FunctionDataType)
Checks the equality of a pair of objects with function data model types.
Declaration
protected virtual bool EqualsFunction(object expected, object actual, FunctionDataType expectedDataType, FunctionDataType actualDataType)
Parameters
Type | Name | Description |
---|---|---|
System.Object | expected | The first object. |
System.Object | actual | The second object. |
FunctionDataType | expectedDataType | The left data type. |
FunctionDataType | actualDataType | The right data type. |
Returns
Type | Description |
---|---|
System.Boolean | true if the objects are equal, false otherwise. |
EqualsPrimitive(Object, Object, PrimitiveDataType, PrimitiveDataType)
Checks the equality of a pair of objects with primitive data model types.
Declaration
protected virtual bool EqualsPrimitive(object expected, object actual, PrimitiveDataType expectedDataType, PrimitiveDataType actualDataType)
Parameters
Type | Name | Description |
---|---|---|
System.Object | expected | The first object. |
System.Object | actual | The second object. |
PrimitiveDataType | expectedDataType | The left data type. |
PrimitiveDataType | actualDataType | The right data type. |
Returns
Type | Description |
---|---|
System.Boolean | true if the objects are equal, false otherwise. |
EqualsQuotation(Object, Object, QuotationDataType, QuotationDataType)
Checks the equality of a pair of objects with quotation data model types.
Declaration
protected virtual bool EqualsQuotation(object expected, object actual, QuotationDataType expectedDataType, QuotationDataType actualDataType)
Parameters
Type | Name | Description |
---|---|---|
System.Object | expected | The first object. |
System.Object | actual | The second object. |
QuotationDataType | expectedDataType | The left data type. |
QuotationDataType | actualDataType | The right data type. |
Returns
Type | Description |
---|---|
System.Boolean | true if the objects are equal, false otherwise. |
EqualsStructural(Object, Object, StructuralDataType, StructuralDataType)
Checks the equality of a pair of objects with structural data model types.
Declaration
protected virtual bool EqualsStructural(object expected, object actual, StructuralDataType expectedDataType, StructuralDataType actualDataType)
Parameters
Type | Name | Description |
---|---|---|
System.Object | expected | The first object. |
System.Object | actual | The second object. |
StructuralDataType | expectedDataType | The left data type. |
StructuralDataType | actualDataType | The right data type. |
Returns
Type | Description |
---|---|
System.Boolean | true if the objects are equal, false otherwise. |
Remarks
If the useStrict flag is not set to true in the constructor, the right data type may have properties that do not exist on the left data type, so long as the right object has default values for these properties.
GetHashCode(Object)
Gets the hash code of an object.
Declaration
public int GetHashCode(object obj)
Parameters
Type | Name | Description |
---|---|---|
System.Object | obj | The object. |
Returns
Type | Description |
---|---|
System.Int32 | The hash code of the object. |
GetHashCodeArray(Object, ArrayDataType)
Gets the hash code of an instance of an array data model type.
Declaration
protected virtual int GetHashCodeArray(object obj, ArrayDataType dataType)
Parameters
Type | Name | Description |
---|---|---|
System.Object | obj | The instance. |
ArrayDataType | dataType | The data model type. |
Returns
Type | Description |
---|---|
System.Int32 | The hash code. |
GetHashCodeCustom(Object, DataType)
Gets the hash code of an instance of a custom data model type.
Declaration
protected virtual int GetHashCodeCustom(object obj, DataType dataType)
Parameters
Type | Name | Description |
---|---|---|
System.Object | obj | The instance. |
DataType | dataType | The data model type. |
Returns
Type | Description |
---|---|
System.Int32 | The hash code. |
GetHashCodeExpression(Object, ExpressionDataType)
Gets the hash code of an instance of an expression data model type.
Declaration
protected virtual int GetHashCodeExpression(object obj, ExpressionDataType dataType)
Parameters
Type | Name | Description |
---|---|---|
System.Object | obj | The instance. |
ExpressionDataType | dataType | The data model type. |
Returns
Type | Description |
---|---|
System.Int32 | The hash code. |
GetHashCodeExtension(Object, DataType)
Gets the hash code of an instance of an extension data model type.
Declaration
protected virtual int GetHashCodeExtension(object obj, DataType dataType)
Parameters
Type | Name | Description |
---|---|---|
System.Object | obj | The instance. |
DataType | dataType | The data model type. |
Returns
Type | Description |
---|---|
System.Int32 | The hash code. |
GetHashCodeFunction(Object, FunctionDataType)
Gets the hash code of an instance of a function data model type.
Declaration
protected virtual int GetHashCodeFunction(object obj, FunctionDataType dataType)
Parameters
Type | Name | Description |
---|---|---|
System.Object | obj | The instance. |
FunctionDataType | dataType | The data model type. |
Returns
Type | Description |
---|---|
System.Int32 | The hash code. |
GetHashCodePrimitive(Object, PrimitiveDataType)
Gets the hash code of an instance of a primitive data model type.
Declaration
protected virtual int GetHashCodePrimitive(object obj, PrimitiveDataType dataType)
Parameters
Type | Name | Description |
---|---|---|
System.Object | obj | The instance. |
PrimitiveDataType | dataType | The data model type. |
Returns
Type | Description |
---|---|
System.Int32 | The hash code. |
GetHashCodeQuotation(Object, QuotationDataType)
Gets the hash code of an instance of a quotation data model type.
Declaration
protected virtual int GetHashCodeQuotation(object obj, QuotationDataType dataType)
Parameters
Type | Name | Description |
---|---|---|
System.Object | obj | The instance. |
QuotationDataType | dataType | The data model type. |
Returns
Type | Description |
---|---|
System.Int32 | The hash code. |
GetHashCodeStructural(Object, StructuralDataType)
Gets the hash code of an instance of a structural data model type.
Declaration
protected virtual int GetHashCodeStructural(object obj, StructuralDataType dataType)
Parameters
Type | Name | Description |
---|---|---|
System.Object | obj | The instance. |
StructuralDataType | dataType | The data model type. |
Returns
Type | Description |
---|---|
System.Int32 | The hash code. |
Remarks
If the useStrict flag is not set to true in the constructor, properties with default values are not included in the hash code value.
Explicit Interface Implementations
IClearable.Clear()
Clears the state in the object for reuse in an object pool.
Declaration
void IClearable.Clear()