flowGraphDataConnection.d.ts 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. import type { FlowGraphBlock } from "./flowGraphBlock";
  2. import { FlowGraphConnection, FlowGraphConnectionType } from "./flowGraphConnection";
  3. import type { FlowGraphContext } from "./flowGraphContext";
  4. import { RichType } from "./flowGraphRichTypes";
  5. /**
  6. * @experimental
  7. * Represents a connection point for data.
  8. * An unconnected input point can have a default value.
  9. * An output point will only have a value if it is connected to an input point. Furthermore,
  10. * if the point belongs to a "function" node, the node will run its function to update the value.
  11. */
  12. export declare class FlowGraphDataConnection<T> extends FlowGraphConnection<FlowGraphBlock, FlowGraphDataConnection<T>> {
  13. /**
  14. * the type of the data in this block
  15. */
  16. richType: RichType<T>;
  17. /**
  18. * Create a new data connection point.
  19. * @param name
  20. * @param connectionType
  21. * @param ownerBlock
  22. * @param richType
  23. */
  24. constructor(name: string, connectionType: FlowGraphConnectionType, ownerBlock: FlowGraphBlock,
  25. /**
  26. * the type of the data in this block
  27. */
  28. richType: RichType<T>);
  29. /**
  30. * An output data block can connect to multiple input data blocks,
  31. * but an input data block can only connect to one output data block.
  32. * @returns true if the connection is singular
  33. */
  34. _isSingularConnection(): boolean;
  35. /**
  36. * Set the value of the connection in a specific context.
  37. * @param value the value to set
  38. * @param context the context to which the value is set
  39. */
  40. setValue(value: T, context: FlowGraphContext): void;
  41. /**
  42. * Connect this point to another point.
  43. * @param point the point to connect to.
  44. */
  45. connectTo(point: FlowGraphDataConnection<T>): void;
  46. private _getValueOrDefault;
  47. /**
  48. * Gets the value of the connection in a specific context.
  49. * @param context the context from which the value is retrieved
  50. * @returns the value of the connection
  51. */
  52. getValue(context: FlowGraphContext): T;
  53. /**
  54. * @returns class name of the object.
  55. */
  56. getClassName(): string;
  57. /**
  58. * Serializes this object.
  59. * @param serializationObject the object to serialize to
  60. */
  61. serialize(serializationObject?: any): void;
  62. /**
  63. * Parses a data connection from a serialized object.
  64. * @param serializationObject the object to parse from
  65. * @param ownerBlock the block that owns the connection
  66. * @returns the parsed connection
  67. */
  68. static Parse(serializationObject: any, ownerBlock: FlowGraphBlock): FlowGraphDataConnection<any>;
  69. }