using Facepunch.ActionGraphs; namespace Sandbox.ActionGraphs { internal static class CollectionNodes { [ActionGraphNode( "array.new" ), Pure, Title( "New Array of {T|Type}" ), Icon( "data_array" ), Category( "Collections" ), Tags( "common" )] public static T[] NewArray( int count ) { return count == 0 ? Array.Empty() : new T[count]; } [ActionGraphNode( "list.new" ), Pure, Title( "New List of {T|Type}" ), Icon( "data_array" ), Category( "Collections" ), Tags( "common" )] public static List NewList() { return new List(); } [ActionGraphNode( "list.new" ), Pure, Title( "New List of {T|Type}" ), Icon( "data_array" ), Category( "Collections" ), Tags( "common" )] public static List NewList( params T[] items ) { return new List( items ); } [ActionGraphNode( "set.new" ), Pure, Title( "New Set of {T|Type}" ), Icon( "data_object" ), Category( "Collections" ), Tags( "common" )] public static HashSet NewSet() { return new HashSet(); } [ActionGraphNode( "set.new" ), Pure, Title( "New Set of {T|Type}" ), Icon( "data_object" ), Category( "Collections" ), Tags( "common" )] public static HashSet NewSet( params T[] items ) { return new HashSet( items ); } [ActionGraphNode( "dict.new" ), Pure, Title( "New Dictionary from {TKey|Key} to {TValue|Value}" ), Icon( "toc" ), Category( "Collections" ), Tags( "common" )] public static Dictionary NewDictionary() { return new Dictionary(); } [ActionGraphNode( "list.get" ), Pure, Title( "Get Item" ), Category( "Collections" ), Icon( "logout" ), Tags( "common" )] public static T GetItem( IReadOnlyList list, int index ) { return list[index]; } [ActionGraphNode( "list.set" ), Title( "Set Item" ), Category( "Collections" ), Icon( "login" ), Tags( "common" )] public static void SetItem( IList list, int index, T value ) { list[index] = value; } } }