ArrowDependencies

Release:

4.6 •  5.0 •  5.1 •  5.2 •  5.3 •  5.4 •  6.0 •  6.1 •  6.2 •  6.3 •  6.4 •  6.5 •  6.6 •  7.0 •  7.1 •  7.2

new to Analytica 7.2

ArrowDependencies(diagram, source, target, browseOnly, useACPsettings)

Explains why an arrow appears (or would appear) on an influence diagram. A single arrow between two module nodes, or between a variable and a module, can stand for many underlying dependencies between objects nested inside those modules, and the diagram itself gives no way to see which ones. ArrowDependencies lists them, using exactly the same logic that decides which arrows are drawn (the logic behind GetArrowsOnDiagram()), so the answer is always consistent with the diagram.

ArrowDependencies is a struct. Calling it constructs an instance whose Dependencies member is a list of ArrowDependency struct instances, one per underlying dependency.

All parameters are optional:

  • «diagram»: The module whose diagram is being examined. When omitted, it is taken to be the module that contains «source» (or «target»).
  • «source», «target»: Nodes on that diagram -- a variable, module or alias node -- that restrict the result to the arrow(s) leaving «source» and/or entering «target». When both are omitted, every arrow on the diagram is covered. Pass either an identifier or a Handle.
  • «browseOnly», «useACPsettings»: Same meaning as in GetArrowsOnDiagram. When «browseOnly» is true, arrows hidden in browse mode are reported as hidden.

Hidden arrows

Because the purpose is to follow the dependencies between modules, a dependency is reported even when its arrow is not drawn. This happens when a node style turns off Show input arrows or Show output arrows (on the node, or on the object inside the module), when the diagram's arrow preferences exclude arrows to or from indexes, functions, buttons or modules (or dynamic and check arrows), when the source or target node is hidden, when the arrow object itself is hidden (through its arrow style or ChangeNodeVisibility), or in browse mode. Such entries have IsHidden set, and HiddenBy says what suppresses the arrow.

ArrowDependency

Each element of Dependencies is an ArrowDependency struct instance with these members:

  • SourceNode, TargetNode: Handles to the arrow's endpoint nodes on the diagram. Null for a remote-link arrowhead (the little arrowhead beside a node that stands for a dependency on something not on this diagram).
  • Source, Target: Handles to the actual objects whose dependency causes the arrow. When a module node stands in for an object nested inside it, these differ from the node.
  • Kind: What kind of dependency it is: 'Definition', 'Dynamic', 'Check', 'Display' (an arrow drawn by the user that is not a true dependency), 'Domain', 'Assignment' or 'StickyArrow'.
  • SourcePath, TargetPath: The containment path from the node down to the object, as a list of handles [node, ..., object]. It has a single element when the node is the object itself. An alias on the path appears as the alias object followed by its original, so you can tell when an arrow exists only because of an alias.
  • IsDisplayOnly: True when the arrow is a display-only arrow drawn by the user rather than a true dependency.
  • IsHidden: True when the arrow for this dependency is not drawn on the diagram.
  • HiddenBy: When IsHidden is true, text saying what suppresses the arrow (a node style, a diagram preference, a hidden node or arrow, or browse mode). Otherwise Null.

Examples

Suppose the diagram of module D shows an arrow from module A to module B. To see which dependencies cause it:

ArrowDependencies(D, A, B)->Dependencies

might return three ArrowDependency instances, showing that Y in B depends on X in A and on X2 inside the submodule A1 of A, and that Y2 in submodule B1 also depends on X2:

ArrowDependency(SourceNode: A, TargetNode: B, Source: X, Target: Y, Kind: 'Definition', SourcePath: [A, X], TargetPath: [B, Y], IsDisplayOnly: False, IsHidden: False, HiddenBy: Null)
ArrowDependency(SourceNode: A, TargetNode: B, Source: X2, Target: Y, Kind: 'Definition', SourcePath: [A, A1, X2], TargetPath: [B, Y], ...)
ArrowDependency(SourceNode: A, TargetNode: B, Source: X2, Target: Y2, Kind: 'Definition', SourcePath: [A, A1, X2], TargetPath: [B, B1, Y2], ...)

Every arrow into B, from whatever node:

ArrowDependencies(Target: B)->Dependencies

A library whose node style hides its output arrows still reports the modules that use its functions, marked as hidden:

Var d := ArrowDependencies(Source: Function_library) Do d->Dependencies[1]->HiddenBy
→ 'Node style: the source node's 'show output arrows' is off'

The result converts directly to JSON with MakeJSON, which is convenient when the information is consumed by an assistant or a script:

MakeJSON(ArrowDependencies(D, A, B))

Where this appears in the user interface

On a diagram, hovering over a module node shows the inputs and outputs icons whenever arrows enter or leave it, drawn or hidden. Clicking one opens an outline: the top level lists the node at the other end of each arrow, expanding it walks down the containment hierarchy to the objects whose dependencies cause the arrow, and expanding one of those lists the objects it feeds ("→ Y") or is fed by ("X →"). Entries whose arrow is not drawn are labeled, for example (hidden by node style). Clicking a name navigates to that object; the expand and collapse buttons act on their own.

History

Introduced in Analytica 7.2.

See Also

Comments
Loading comments...