Class AStringLeaf
Unit
classwork
Declaration
type AStringLeaf = class(ABinaryLeaf)
Description
This class represents a node in a binary tree that keeps the string used to define its sort key. As with ABinaryLeaf, instances of AStringLeaf use the hash value of a given string, as calculated by Charstring.hashValueOf, to determine their sort key.
Hierarchy
Overview
Fields
Methods
Description
Fields
|
myName: string; |
Stores the string used to generate the sort key for the node
|
Methods
|
constructor named(const thisKey: string); override; |
Construct a new node that uses the hash value of the specified string as its sort key.
The implementation of this method is identical to that provided by ABinaryLeaf.withSortKey, except that thisKey is stored internally by the node. The string can be retrieved by calling AStringLeaf.name.
|
|
function init: boolean; override; |
Initializer
|
|
function shallowCopyFrom(const Other: AnObject): boolean; override; |
Construct a shallow copy of the other object.
This method overrides the behavior inherited from ABinaryLeaf.shallowCopyFrom: it calls that method, then checks to see whether Other is an instance of AStringLeaf. If so, it copies the value of AStringLeaf.name from Other to Self , overwriting the value in Self .
Note that this method does NOT copy any sibling or child nodes and so cannot be used to create a full copy of any descendant of ANode. Likewise, it does NOT copy the left or right subtrees and so cannot be used to create a full copy of any descendant of ABinaryLeaf. The copy will NOT be automatically placed in the binary tree to which Other belongs, if any, but the caller is free to do so, so long as the node's sort key does not match one that already exists in the tree.
|
|
function selfStreamingLength: TStreamIOSize; override; |
Calculate the number of bytes required to stream the node.
This method builds upon the behavior inherited from ABinaryLeaf.selfStreamingLength; it calls the inherited routine, then calculates the number of bytes required to write its name and adds that to the result, which is then returned to the user.
|
|
function toString: AnsiString; override; |
Construct and return a string representation of the node, suitable for printing to a text-based console or device.
In accordance with the criteria described by APrintingObject.toString, this method returns a string which contains the index of the node and the string used to define its sort key. The format of the string returned is controlled by stlfStringRepresentation.
|
|
function name: string; override; |
Retrieve the name of the node. This is the string that was used at construction time to generate the sort key of the node.
|
Generated by PasDoc 0.13.0 on 2015-06-23 19:40:11
|