vrdNodeList¶
-
class
vrdNodeList
¶
(Inherits vrdObjectList
)
This class gives access to a collection of nodes.
Operations on this list will directly be executed on the underlying data model.
# We want to reparent node D so that it is on the same hierarchy level as B and has A
# as new parent
a = vrNodeService.findNode('A')
b = vrNodeService.findNode('B')
d = b.children.find('D')
a.children.append(d)
# There's no need to remove d from b's list of children. This is all done automatically
# since a vrdNode can only have a single parent.
# You can check the number of children afterwards.
print(a.children.size()) # this will now be 2
print(b.children.size()) # this will now be 1
Summary¶
- Functions:
- append(value)
- append(values)
- at(i) → vrdNode
- canInsert(value) → bool
- clear()
- contains(value) → bool
- count(value) → integer
- data() → List[vrdNode]
- find(name) → vrdNode
- index(value, start, end) → integer
- insert(i, value)
- insert(i, values)
- move(from, to) → bool
- remove(value) → bool
- removeAll(value) → integer
- removeAt(i) → bool
- size() → integer
Functions¶
-
vrdNodeList.
append
(value)¶ Appends the value to this list.
Parameters: value (vrdNode) – The value to append
-
vrdNodeList.
append
(values)¶ Appends the items of the value list to this list.
Parameters: values (List[vrdNode]) – The values to append
-
vrdNodeList.
at
(i)¶ Get the value at the given index.
Parameters: i (integer) – Returns: i The index of the requested value Return type: vrdNode
-
vrdNodeList.
canInsert
(value)¶ Check, if the given entry can be inserted.
Parameters: value (vrdNode) – Returns: True, if insert is allowed Return type: bool
-
vrdNodeList.
clear
()¶ Removes all items from the list.
-
vrdNodeList.
contains
(value)¶ Check, if an element is already in the list.
Parameters: value (vrdNode) – Returns: True, if the given value is in this list Return type: bool
-
vrdNodeList.
count
(value)¶ Count the occurences of a given vlaue.
Parameters: value (vrdNode) – Returns: The number of times, the value has been found in the list Return type: integer
-
vrdNodeList.
data
()¶ Get all entries of this list.
Returns: List of elements Return type: List[vrdNode]
-
vrdNodeList.
find
(name)¶ Returns first occurrence with given name.
Parameters: name (string) – Name Returns: Return type: vrdNode
-
vrdNodeList.
index
(value, start=0, end=- 1)¶ Returns the index of the given value.
Parameters: - value (vrdNode) – The value to search
- start (integer) – The index to start the search, default is 0
- end (integer) – The index to end the search, default is -1 to search until the end
Returns: The index or -1, if not found
Return type: integer
-
vrdNodeList.
insert
(i, value)¶ Insert a value at a given position.
Parameters: - i (integer) – The position, starting from 0
- value (vrdNode) – The value to be inserted
-
vrdNodeList.
insert
(i, values)¶ Insert values at a given position.
Parameters: - i (integer) – The position, starting from 0
- values (List[vrdNode]) – The values to be inserted
-
vrdNodeList.
move
(from, to)¶ Moves a values inside the list.
Parameters: - from (integer) – The index to move
- to (integer) – The destination index
Returns: True on success, False otherwise
Return type: bool
-
vrdNodeList.
remove
(value)¶ Remove the first occurences of the given value.
Parameters: value (vrdNode) – Returns: True, if the value has been removed Return type: bool
-
vrdNodeList.
removeAll
(value)¶ Remove all occurences of the given value.
Parameters: value (vrdNode) – Returns: The number of value that have been removed Return type: integer
-
vrdNodeList.
removeAt
(i)¶ Remove a value from the list.
Parameters: i (integer) – Index of the value to be removed Returns: True, if the value has been removed Return type: bool
-
vrdNodeList.
size
()¶ Returns: Number of elements in this list. Return type: integer