Skip to content

Commit

Permalink
code aligned to the changes in Reflection_Engine
Browse files Browse the repository at this point in the history
  • Loading branch information
pawelbaran authored and al-fisher committed Nov 11, 2021
1 parent 7b76ef8 commit 3186555
Showing 1 changed file with 31 additions and 2 deletions.
33 changes: 31 additions & 2 deletions UI_Engine/Query/Items.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@

using BH.Adapter;
using BH.Engine.Reflection;
using BH.oM.Base;
using BH.oM.Reflection.Attributes;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Reflection;

Expand All @@ -36,13 +37,17 @@ public static partial class Query
/**** Public Methods ****/
/***************************************************/

[Description("Extracts all BHoM methods to be grouped as Engine items in the UI (combined group of all 5 basic Engine classes).")]
[Output("items", "All BHoM methods to be grouped as Engine items.")]
public static IEnumerable<MethodBase> EngineItems()
{
return Engine.Reflection.Query.BHoMMethodList().Where(x => x.IsExposed());
}

/***************************************************/

[Description("Extracts all BHoM methods to be grouped as Create items in the UI.")]
[Output("items", "All BHoM methods to be grouped as Create items.")]
public static IEnumerable<MethodBase> CreateItems()
{
return Engine.Reflection.Query.BHoMMethodList()
Expand All @@ -51,6 +56,8 @@ public static IEnumerable<MethodBase> CreateItems()

/***************************************************/

[Description("Extracts all BHoM methods to be grouped as Compute items in the UI.")]
[Output("items", "All BHoM methods to be grouped as Compute items.")]
public static IEnumerable<MethodBase> ComputeItems()
{
return Engine.Reflection.Query.BHoMMethodList()
Expand All @@ -59,6 +66,8 @@ public static IEnumerable<MethodBase> ComputeItems()

/***************************************************/

[Description("Extracts all BHoM methods to be grouped as Convert items in the UI.")]
[Output("items", "All BHoM methods to be grouped as Convert items.")]
public static IEnumerable<MethodBase> ConvertItems()
{
return Engine.Reflection.Query.BHoMMethodList()
Expand All @@ -67,6 +76,8 @@ public static IEnumerable<MethodBase> ConvertItems()

/***************************************************/

[Description("Extracts all BHoM methods to be grouped as Modify items in the UI.")]
[Output("items", "All BHoM methods to be grouped as Modify items.")]
public static IEnumerable<MethodBase> ModifyItems()
{
return Engine.Reflection.Query.BHoMMethodList()
Expand All @@ -75,6 +86,8 @@ public static IEnumerable<MethodBase> ModifyItems()

/***************************************************/

[Description("Extracts all BHoM methods to be grouped as Query items in the UI.")]
[Output("items", "All BHoM methods to be grouped as Query items.")]
public static IEnumerable<MethodBase> QueryItems()
{
return Engine.Reflection.Query.BHoMMethodList()
Expand All @@ -83,6 +96,8 @@ public static IEnumerable<MethodBase> QueryItems()

/***************************************************/

[Description("Extracts all BHoM type constructors to be grouped as Create Adapter items in the UI.")]
[Output("items", "All BHoM type constructors to be grouped as Create Adapter items.")]
public static IEnumerable<MethodBase> AdapterConstructorItems()
{
return Engine.Reflection.Query.AdapterTypeList()
Expand All @@ -93,6 +108,8 @@ public static IEnumerable<MethodBase> AdapterConstructorItems()

/***************************************************/

[Description("Extracts all BHoM type constructors to be grouped as Create Request items in the UI.")]
[Output("items", "All BHoM type constructors to be grouped as Create Request items.")]
public static IEnumerable<MethodBase> CreateRequestItems()
{
return BH.Engine.Reflection.Query.BHoMMethodList()
Expand All @@ -104,6 +121,8 @@ public static IEnumerable<MethodBase> CreateRequestItems()

/***************************************************/

[Description("Extracts all BHoM types that implement IRequest interface and have a valid public constructor.")]
[Output("items", "All BHoM types that implement IRequest interface and have a valid public constructor.")]
public static IEnumerable<Type> ConstructableRequestItems()
{
return Engine.Reflection.Query.BHoMTypeList()
Expand All @@ -113,10 +132,12 @@ public static IEnumerable<Type> ConstructableRequestItems()

/***************************************************/

[Description("Extracts all types valid in BHoM.")]
[Output("items", "All types valid in BHoM.")]
public static IEnumerable<Type> TypeItems()
{
return Engine.Reflection.Query.BHoMTypeList()
.Concat(Engine.Reflection.Query.BHoMInterfaceList())
.Concat(Engine.Reflection.Query.BHoMInterfaceTypeList())
.Concat(new List<Type> { typeof(Type), typeof(Enum),
typeof(object), typeof(bool), typeof(byte),
typeof(char), typeof(string),
Expand All @@ -127,6 +148,8 @@ public static IEnumerable<Type> TypeItems()

/***************************************************/

[Description("Extracts all types that have a valid public constructor.")]
[Output("items", "All types that have a valid public constructor.")]
public static IEnumerable<Type> ConstructableTypeItems()
{
return Engine.Reflection.Query.BHoMTypeList()
Expand All @@ -136,6 +159,8 @@ public static IEnumerable<Type> ConstructableTypeItems()

/***************************************************/

[Description("Extracts all enum types valid in BHoM.")]
[Output("items", "All enum types valid in BHoM.")]
public static IEnumerable<Type> EnumItems()
{
return Engine.Reflection.Query.BHoMEnumList()
Expand All @@ -144,13 +169,17 @@ public static IEnumerable<Type> EnumItems()

/***************************************************/

[Description("Extracts names of all BHoM library items.")]
[Output("items", "Names of all BHoM library items.")]
public static List<string> LibraryItems()
{
return Engine.Library.Query.LibraryNames().ToList();
}

/***************************************************/

[Description("Extracts all external methods in BHoM.")]
[Output("items", "All external methods in BHoM.")]
public static List<MethodBase> ExternalItems()
{
return Engine.Reflection.Query.ExternalMethodList();
Expand Down

0 comments on commit 3186555

Please sign in to comment.