Structures_LinkedList_Single
[ class tree: Structures_LinkedList_Single ] [ index: Structures_LinkedList_Single ] [ all elements ]

Class: Structures_LinkedList_Single

Source Location: /Structures_LinkedList-0.2.2/Structures/LinkedList/Single.php

Class Overview


The Structures_LinkedList_Single class represents a linked list structure composed of Structures_LinkedList_SingleNode objects.


Author(s):

Variables

Methods


Child classes:

Structures_LinkedList_Double
The Structures_LinkedList_Double class represents a linked list structure composed of Structures_LinkedList_DoubleNode objects.
LinkListTester
The Structures_LinkedList_Single class represents a linked list structure composed of Structures_LinkedList_SingleNode objects.

Inherited Variables

Inherited Methods


Class Details

[line 71]
The Structures_LinkedList_Single class represents a linked list structure composed of Structures_LinkedList_SingleNode objects.


[ Top ]


Class Variables

$current =

[line 78]

Current node in the linked list
  • Access: protected



[ Top ]

$messages = array(
        self::ERROR_EMPTY => 'No nodes in this linked list' 
    )

[line 91]

  • Access: public

Type:   mixed


[ Top ]

$root_node =

[line 84]

Root node of the linked list
  • Access: protected



[ Top ]



Method Detail

__construct (Constructor)   [line 103]

Structures_LinkedList_Single __construct( [Structures_LinkedList_SingleNode $root = null])

Structures_LinkedList_Single constructor

Overridden in child classes as:

Structures_LinkedList_Double::__construct()
Structures_LinkedList_Double constructor

Parameters:

Structures_LinkedList_SingleNode   $root   —  root node for the linked list

[ Top ]

__destruct (Destructor)   [line 123]

void __destruct( )

Structures_LinkedList_Single destructor

If we do not destroy all of the references in the linked list, we will quickly run out of memory for large / complex structures.


Overridden in child classes as:

Structures_LinkedList_Double::__destruct()
Structures_LinkedList_Double destructor

[ Top ]

appendNode   [line 300]

bool appendNode( Structures_LinkedList_SingleNode $new_node)

Adds a Structures_LinkedList_SingleNode object to the end of the linked list.
  • Return: Success or failure
  • Access: public

Parameters:

Structures_LinkedList_SingleNode   $new_node   —  New node to append

[ Top ]

current   [line 152]

Structures_LinkedList_SingleNode current( )

Returns the current node in the linked list
  • Return: current node in the linked list
  • Access: public

[ Top ]

deleteNode   [line 397]

null deleteNode( Structures_LinkedList_SingleNode $node)

Deletes a Structures_LinkedList_SingleNode from the list.
  • Access: public

Overridden in child classes as:

Structures_LinkedList_Double::deleteNode()
Deletes a Structures_LinkedList_DoubleNode from the list.

Parameters:

Structures_LinkedList_SingleNode   $node   —  Node to delete.

[ Top ]

end   [line 181]

Structures_LinkedList_SingleNode end( )

Sets the pointer for the linked list to the root node
  • Return: root node in the linked list
  • Access: public

Overridden in child classes as:

Structures_LinkedList_Double::end()
Sets the pointer for the linked list to its last node

[ Top ]

getTailNode   [line 254]

bool getTailNode( )

Returns the tail node of the linked list.

This is an expensive operation!

  • Return: Success or failure
  • Access: protected

Overridden in child classes as:

Structures_LinkedList_Double::getTailNode()
Returns the tail node of the linked list.

[ Top ]

insertNode   [line 328]

bool insertNode( Structures_LinkedList_SingleNode $new_node, Structures_LinkedList_SingleNode $existing_node, [bool $before = false])

Inserts a Structures_LinkedList_SingleNode object into the linked list, based on a reference node that already exists in the list.
  • Return: Success or failure
  • Access: public

Overridden in child classes as:

Structures_LinkedList_Double::insertNode()
Inserts a Structures_LinkedList_DoubleNode object into the linked list, based on a reference node that already exists in the list.

Parameters:

Structures_LinkedList_SingleNode   $new_node   —  New node to add to the list
Structures_LinkedList_SingleNode   $existing_node   —  Reference position node
bool   $before   —  Insert new node before or after the existing node

[ Top ]

key   [line 194]

Structures_LinkedList_SingleNode key( )

Stub for Iterator interface that simply returns the current node
  • Return: current node in the linked list
  • Access: public

Overridden in child classes as:

LinkListTester::key()
LinkListTester::key()

[ Top ]

next   [line 219]

Structures_LinkedList_SingleNode next( )

Sets the pointer for the linked list to the next node and returns that node
  • Return: next node in the linked list
  • Access: public

[ Top ]

prependNode   [line 375]

bool prependNode( Structures_LinkedList_SingleNode $new_node)

Adds a Structures_LinkedList_SingleNode object to the start of the linked list.
  • Return: Success or failure
  • Access: public

Parameters:

Structures_LinkedList_SingleNode   $new_node   —  Node to prepend to the list

[ Top ]

previous   [line 236]

Structures_LinkedList_SingleNode previous( )

Sets the pointer for the linked list to the previous node and returns that node
  • Return: previous node in the linked list
  • Access: public

Overridden in child classes as:

Structures_LinkedList_Double::previous()
Sets the pointer for the linked list to the previous node and returns that node

[ Top ]

rewind   [line 164]

Structures_LinkedList_SingleNode rewind( )

Sets the pointer for the linked list to the root node
  • Return: root node in the linked list
  • Access: public

[ Top ]

valid   [line 206]

Structures_LinkedList_SingleNode valid( )

Stub for Iterator interface that simply returns the current node
  • Return: current node in the linked list
  • Access: public

[ Top ]


Documentation generated on Mon, 11 Mar 2019 15:38:21 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.