SIMPOL Documentation

dnode

Description

This type is used in the implementation of a doubly-linked list and by itself provides a doubly-linked ring. The nodes can be traversed in both directions from the head of the list to the tail, and back. The most useful characteristic of this component is that it can be added to an existing type to provide list functionality to the type. The way to do that, is to assign the containing object to the __ when creating the dnode object. This allows access back from the object included in a larger type to the containing type.

Type Tags

None

Object Value

Objects of type dnode have no value, and it is an error to try to get or set this value.

dnode.new()

Description

Creates a new dnode object.

Prototype

dnode.new ()

Parameters

None

Properties

PropertyTypeDescription
_type(*) This property is provided for use by the user to attach any object of any type to the type in which this property is provided.
__type(*) This property is provided for use by the user to attach any object of any type to the type in which this property is provided. It has the additional feature of being marked with the resolve keyword, so that object resolution can continue down this property.
nextdnode This holds a reference to either the next dnode in the list, or else to .nul.
prevdnode This holds a reference to either the previous dnode in the list, or else to .nul.
typetype Specifies the dnode type object.

Methods

insertafter()

Description

Inserts the calling node after the node passed as the parameter in the target ring or list. If the calling node is part of a ring of multiple nodes then the whole ring is added with the ring being broken between the calling node and the node pointed to by its next. If, for example, there are two rings of nodes: a, b, c (, a, b, …) and d, e, f (, d, e, …). If the call: b.insertafter(e) is made, then the result will be: d, e, c, a, b, f (, d, e, c, …).

Prototype

dnodevar.insertafter ( dnode node )

Parameters
ParameterDefault valueType nameDescription
nodeNonednode Specifies the node after which the calling node (and the remainder of the nodes that form part of the ring or list) should be placed.

insertbefore()

Description

Inserts the calling node before the node passed as the parameter in the target ring or list. If the calling node is part of a ring of multiple nodes then the whole ring is added with the ring being broken between the calling node and the node pointed to by its prev. If, for example, there are two rings of nodes: a, b, c (, a, b, …) and d, e, f (, d, e, …). If the call: b.insertbefore(e) is made, then the result will be: d, c, a, b, e, f (, d, c, a, …).

Prototype

dnodevar.insertbefore ( dnode node )

Parameters
ParameterDefault valueType nameDescription
nodeNonednode Specifies the node before which the calling node (and the remainder of the nodes that form part of the ring or list) should be placed.

remove()

Description

This removes one or more nodes from a chain of nodes. If no parameter is passed, it removes only the calling node. If another node in the same chain is passed, then all nodes between the node passed as the parameter and the calling node will be removed into a separate ring.

Prototype

dnodevar.remove ( dnode removestart )

Parameters
ParameterDefault valueType nameDescription
removestart.nuldnode This is the starting node to define the chain of nodes to be removed into a new ring. If this is not passed, then only the calling node will be removed.