Arena
1.0
A content management system
|
A binary tree. More...
Public Member Functions | |
def | __init__ |
Constructor. | |
def | init |
Initializer. | |
def | __del__ |
Destructor. | |
def | fetch |
Fetch the node with the specified key from the tree. More... | |
def | has |
Determine whether or not the specified key exists within the tree. More... | |
def | insert |
Insert the specified item into the tree. More... | |
def | delete |
Delete the specified item from the tree. More... | |
def | writeTo |
Write the tree and its nodes to the specified stream. More... | |
def | readFrom |
Read the tree from the specified stream. More... | |
def | toString |
Return a string representation of the binary tree. More... | |
def | printTo |
Print a string representation of the tree and its nodes to the specified stream. More... | |
def | census |
Retrieve the number of items in the tree. More... | |
def | keys |
Retrieve a list of keys for the item in the tree. More... | |
def | __len__ |
Return the number of items in the tree. More... | |
def | __getitem__ |
Get value of the specified item from the binary tree. More... | |
def | __delitem__ |
Delete the specified field. More... | |
def | __contains__ |
Determine whether or not the specified key exists in the binary tree. More... | |
def | __iter__ |
Iterate over the items in the tree. More... | |
Public Member Functions inherited from Library.Base.Classwork.AnObject | |
def | init |
Initialize a new object instance. More... | |
def | __init__ |
Construct and initialize a new instance of AnObject. More... | |
def | __del__ |
Destroy the object instance. More... | |
def | displayName |
Construct a "pretty" display name for the class instance, based on the name of its class. More... | |
def | implements |
Determine whether the class instance is related to the specified class. More... | |
def | toString |
Return a string representation of the class, suitable for output to a console or text-based device. More... | |
def | __str__ |
Return a string representation of the class. More... | |
def | classname |
Return the name of the class from which the instance was created. More... | |
def | name |
Return the name of the class. More... | |
Public Member Functions inherited from Library.String.Utilities.IsPrintable | |
def | toString |
Return a string representation of the class conveniently. More... | |
def | __str__ |
Return a string representation of the class. More... | |
def | printTo |
Print a string representation of the class to the specified stream. More... | |
Public Member Functions inherited from Library.IO.Streams.IsStreamable | |
def | writeTo |
Write class instance data to the specified stream. More... | |
def | readFrom |
Read class instance data from the specified stream. More... | |
A binary tree.
def Library.Memory.BinaryTrees.ABinaryTree.__contains__ | ( | Self, | |
key | |||
) |
Determine whether or not the specified key exists in the binary tree.
This routine is provided for convenience, so that access to the items in the binary tree can be programmed as though the tree was a native Python dictionary object.
def Library.Memory.BinaryTrees.ABinaryTree.__delitem__ | ( | Self, | |
key | |||
) |
Delete the specified field.
This routine is provided for convenience, so that access to the items in the tree can be programmed as though the tree was a native Python dictionary object.
def Library.Memory.BinaryTrees.ABinaryTree.__getitem__ | ( | Self, | |
key | |||
) |
Get value of the specified item from the binary tree.
This routine is provided for convenience, so that access to the items in the tree can be programmed as though it was a native Python dictionary object.
def Library.Memory.BinaryTrees.ABinaryTree.__iter__ | ( | Self | ) |
Iterate over the items in the tree.
This method allows an instance of of a binary tree to be used as part of a for..in
statement.
def Library.Memory.BinaryTrees.ABinaryTree.__len__ | ( | Self | ) |
Return the number of items in the tree.
This method allows the len()
function to be used on an instance of the tree.
def Library.Memory.BinaryTrees.ABinaryTree.census | ( | Self | ) |
Retrieve the number of items in the tree.
def Library.Memory.BinaryTrees.ABinaryTree.delete | ( | Self, | |
thisKey | |||
) |
Delete the specified item from the tree.
If a node with thisKey
is found within the tree, it is removed from the tree and discarded. The left and right subtrees of the affected node are re-inserted into the tree. However, the index values of each node are not updated; this means that a tree from which nodes have been removed may show gaps when it is serialized.
def Library.Memory.BinaryTrees.ABinaryTree.fetch | ( | Self, | |
thisKey | |||
) |
Fetch the node with the specified key from the tree.
If a node that has thisKey
is found within the tree, a reference to it is returned; otherwise, this routine returns None
.
def Library.Memory.BinaryTrees.ABinaryTree.has | ( | Self, | |
thisKey | |||
) |
Determine whether or not the specified key exists within the tree.
def Library.Memory.BinaryTrees.ABinaryTree.insert | ( | Self, | |
ThisItem | |||
) |
Insert the specified item into the tree.
If ThisItem
has a key that already exists within the tree, this routine will return False
and no insertion will take place (in other words, duplicate sort keys are not allowed). Otherwise, the routine inserts the node and returns True
.
def Library.Memory.BinaryTrees.ABinaryTree.keys | ( | Self | ) |
Retrieve a list of keys for the item in the tree.
def Library.Memory.BinaryTrees.ABinaryTree.printTo | ( | Self, | |
Dest | |||
) |
Print a string representation of the tree and its nodes to the specified stream.
def Library.Memory.BinaryTrees.ABinaryTree.readFrom | ( | Self, | |
Source | |||
) |
Read the tree from the specified stream.
The base implementation of this routine does nothing; it is meant to be overridden by descendant classes.
def Library.Memory.BinaryTrees.ABinaryTree.toString | ( | Self | ) |
Return a string representation of the binary tree.
The representation returned is constructed using the format specified by #btStringRepresentationPlural or #btStringRepresentationSingular, depending on how many nodes are contained within the tree.
def Library.Memory.BinaryTrees.ABinaryTree.writeTo | ( | Self, | |
Dest | |||
) |
Write the tree and its nodes to the specified stream.