Difference between revisions of "API Tree"

From Flowcode Help
Jump to navigationJump to search
(XML import of API auto-gen)
 
 
(9 intermediate revisions by 2 users not shown)
Line 1: Line 1:
wiki page name
+
<sidebar>API Contents</sidebar>
==Tree==
+
Data-tree traversal type routines
 +
 
 +
 
 +
__TOC__
 +
 
 +
==Functions provided for this class==
 +
{|
 +
|-
 +
|width="35%"|[[API Tree.GetValue|GetValue]]
 +
|Gets the value of the given object, if available
 +
|-
 +
|width="35%"|[[API Tree.GetName|GetName]]
 +
|Gets the name of the given object
 +
|-
 +
|width="35%"|[[API Tree.GetPath|GetPath]]
 +
|Gets the full '.' separated name of the given object
 +
|-
 +
|width="35%"|[[API Tree.GetSubValue|GetSubValue]]
 +
|Gets the value of a named sub-item of the given object, if available
 +
|-
 +
|width="35%"|[[API Tree.Traverse|Traverse]]
 +
|Updates the object to step depth-first through the tree
 +
|-
 +
|width="35%"|[[API Tree.StepNext|StepNext]]
 +
|Updates the object to point to the next (younger) sibling
 +
|-
 +
|width="35%"|[[API Tree.StepNamedNext|StepNamedNext]]
 +
|Updates the object to point to the next (younger) sibling matching the name
 +
|-
 +
|width="35%"|[[API Tree.StepNamedIndex|StepNamedIndex]]
 +
|Updates the object to point to the Nth next (younger) sibling matching the name
 +
|-
 +
|width="35%"|[[API Tree.StepLast|StepLast]]
 +
|Updates the object to point to the last (elder) sibling
 +
|-
 +
|width="35%"|[[API Tree.StepParent|StepParent]]
 +
|Updates the object to point to its parent object
 +
|-
 +
|width="35%"|[[API Tree.StepRoot|StepRoot]]
 +
|Updates the object to point to the root of the tree
 +
|-
 +
|width="35%"|[[API Tree.StepChildHead|StepChildHead]]
 +
|Updates the object to point to the head (eldest) child
 +
|-
 +
|width="35%"|[[API Tree.StepChildTail|StepChildTail]]
 +
|Updates the object to point to the tail (youngest) child
 +
|-
 +
|width="35%"|[[API Tree.StepChildPath|StepChildPath]]
 +
|Updates the object to point to the '.' separated named child path
 +
|-
 +
|width="35%"|[[API Tree.CountChildren|CountChildren]]
 +
|Returns the number of immediate children present for the object
 +
|-
 +
|width="35%"|[[API Tree.CheckChildren|CheckChildren]]
 +
|Returns true if the object has children, else false
 +
|-
 +
|width="35%"|[[API Tree.CountNamedChildren|CountNamedChildren]]
 +
|Returns the number of immediate children present for the object
 +
|-
 +
|width="35%"|[[API Tree.CheckParent|CheckParent]]
 +
|Returns true if the object has a parent, else false if it is the root
 +
|-
 +
|width="35%"|[[API Tree.StepSubHead|StepSubHead]]
 +
|Updates the object to point to the head (eldest) attribute, if any
 +
|-
 +
|width="35%"|[[API Tree.StepSubTail|StepSubTail]]
 +
|Updates the object to point to the tail (youngest) attribute, if any
 +
|-
 +
|width="35%"|[[API Tree.StepSubName|StepSubName]]
 +
|Updates the object to point to the named attribute, if any
 +
|-
 +
|width="35%"|[[API Tree.GetCopy|GetCopy]]
 +
|Creates a copy of the handle and returns the copy
 +
|}
 +
 
 +
 
 +
==Examples==
 +
 
 +
Here is an example program to step through the components in the current project and count the number of 5mm LEDs in the project.
 +
 
 +
We begin by initialising the traversal handle to this which is the root of the panel.
 +
 
 +
We then step through the panel objects using the Tree.Traverse function using this as the root.
 +
 
 +
The Tree.GetName function allows us to collect the name of the component the handle variable is currently pointing to.
 +
 
 +
If the name matches the string "led_5mm" then we increment the counter to count the number of LED components.
 +
 
 +
{{Fcfile|CountComponent.fcfx|Tree Traverse Demo}}
  
Data-tree traversal type routines
 
----
 
===Functions provided for this class===
 
{||-|[[API Tree.GetValue|GetValue]]|Gets the value of the given object, if available|-|[[API Tree.GetName|GetName]]|Gets the name of the given object|-|[[API Tree.GetPath|GetPath]]|Gets the full '.' separated name of the given object|-|[[API Tree.GetSubValue|GetSubValue]]|Gets the value of a named sub-item of the given object, if available|-|[[API Tree.Traverse|Traverse]]|Updates the object to step depth-first through the tree|-|[[API Tree.StepNext|StepNext]]|Updates the object to point to the next (younger) sibling|-|[[API Tree.StepNamedNext|StepNamedNext]]|Updates the object to point to the next (younger) sibling matching the name|-|[[API Tree.StepNamedIndex|StepNamedIndex]]|Updates the object to point to the Nth next (younger) sibling matching the name|-|[[API Tree.StepLast|StepLast]]|Updates the object to point to the last (elder) sibling|-|[[API Tree.StepParent|StepParent]]|Updates the object to point to its parent object|-|[[API Tree.StepRoot|StepRoot]]|Updates the object to point to the root of the tree|-|[[API Tree.StepChildHead|StepChildHead]]|Updates the object to point to the head (eldest) child|-|[[API Tree.StepChildTail|StepChildTail]]|Updates the object to point to the tail (youngest) child|-|[[API Tree.StepChildPath|StepChildPath]]|Updates the object to point to the '.' separated named child path|-|[[API Tree.CountChildren|CountChildren]]|Returns the number of immediate children present for the object|-|[[API Tree.CheckChildren|CheckChildren]]|Returns true if the object has children, else false|-|[[API Tree.CountNamedChildren|CountNamedChildren]]|Returns the number of immediate children present for the object|-|[[API Tree.CheckParent|CheckParent]]|Returns true if the object has a parent, else false if it is the root|-|[[API Tree.StepSubHead|StepSubHead]]|Updates the object to point to the head (eldest) attribute, if any|-|[[API Tree.StepSubTail|StepSubTail]]|Updates the object to point to the tail (youngest) attribute, if any|-|[[API Tree.StepSubName|StepSubName]]|Updates the object to point to the named attribute, if any|-|[[API Tree.GetCopy|GetCopy]]|Creates a copy of the handle and returns the copy|}
 
  
===Examples===
+
==See also==
 +
''<span style="color:red;">No additional information</span>''

Latest revision as of 11:58, 10 February 2016

<sidebar>API Contents</sidebar> Data-tree traversal type routines


Functions provided for this class

GetValue Gets the value of the given object, if available
GetName Gets the name of the given object
GetPath Gets the full '.' separated name of the given object
GetSubValue Gets the value of a named sub-item of the given object, if available
Traverse Updates the object to step depth-first through the tree
StepNext Updates the object to point to the next (younger) sibling
StepNamedNext Updates the object to point to the next (younger) sibling matching the name
StepNamedIndex Updates the object to point to the Nth next (younger) sibling matching the name
StepLast Updates the object to point to the last (elder) sibling
StepParent Updates the object to point to its parent object
StepRoot Updates the object to point to the root of the tree
StepChildHead Updates the object to point to the head (eldest) child
StepChildTail Updates the object to point to the tail (youngest) child
StepChildPath Updates the object to point to the '.' separated named child path
CountChildren Returns the number of immediate children present for the object
CheckChildren Returns true if the object has children, else false
CountNamedChildren Returns the number of immediate children present for the object
CheckParent Returns true if the object has a parent, else false if it is the root
StepSubHead Updates the object to point to the head (eldest) attribute, if any
StepSubTail Updates the object to point to the tail (youngest) attribute, if any
StepSubName Updates the object to point to the named attribute, if any
GetCopy Creates a copy of the handle and returns the copy


Examples

Here is an example program to step through the components in the current project and count the number of 5mm LEDs in the project.

We begin by initialising the traversal handle to this which is the root of the panel.

We then step through the panel objects using the Tree.Traverse function using this as the root.

The Tree.GetName function allows us to collect the name of the component the handle variable is currently pointing to.

If the name matches the string "led_5mm" then we increment the counter to count the number of LED components.

FC6 Icon.png Tree Traverse Demo


See also

No additional information