Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BHoM_Engine: add Query.Hash() extension method #2090

Merged
merged 10 commits into from
Oct 24, 2020
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions BHoM_Engine/BHoM_Engine.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Compute\ExecutionSpeed.cs" />
<Compile Include="Query\GroupByType.cs" />
<Compile Include="Query\Hash.cs" />
<Compile Include="Query\ObjectsByType.cs" />
<Compile Include="Query\ShallowClone.cs" />
<Compile Include="Query\TryGetValue.cs" />
Expand Down
2 changes: 1 addition & 1 deletion BHoM_Engine/Compute/Hash.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public static partial class Compute
[Input("typeExceptions", "(Optional) e.g. `typeof(Guid)`. Any corresponding type is ignored.")]
[Input("maxNesting", "(Optional) e.g. `100`. If any property is nested into the object over that level, it is ignored.")]
public static string Hash(
this IObject iObj,
IObject iObj,
alelom marked this conversation as resolved.
Show resolved Hide resolved
List<string> propertyNameExceptions = null, //e.g. `Fragments`
List<string> propertyFullNameExceptions = null, //e.g. `BH.oM.Structure.Elements.Bar.Fragments`
List<string> namespaceExceptions = null, //e.g. `BH.oM.Structure`
Expand Down
57 changes: 57 additions & 0 deletions BHoM_Engine/Query/Hash.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/*
* This file is part of the Buildings and Habitats object Model (BHoM)
* Copyright (c) 2015 - 2020, the respective contributors. All rights reserved.
*
* Each contributor holds copyright over their respective contributions.
* The project versioning (Git) records all such contribution source information.
*
*
* The BHoM is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3.0 of the License, or
* (at your option) any later version.
*
* The BHoM is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this code. If not, see <https://www.gnu.org/licenses/lgpl-3.0.html>.
*/

using BH.oM.Base;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Security.Cryptography;
using System.Reflection;
using BH.Engine.Serialiser;
using BH.oM.Reflection.Attributes;
using System.ComponentModel;
using BH.Engine.Base;
using System.Collections;
using System.Data;

namespace BH.Engine.Base
{
public static partial class Query
{
/***************************************************/
/**** Public Methods ****/
/***************************************************/

[Description("Computes a Hash code for the object which depends solely on its properties. The full method with additional options is in `Compute.Hash()`.")]
[Input("obj", "Objects the hash code should be calculated for.")]
public static string Hash(
this IObject iObj)
alelom marked this conversation as resolved.
Show resolved Hide resolved
{
return Compute.Hash(iObj);
}

/***************************************************/
}
}