PHP Classes
Icontem

File: ListeNode.php


  Search   All class groups All class groups   Latest entries Latest entries   Top 10 charts Top 10 charts   Newsletter Newsletter   Blog Blog   Forums Forums   Help FAQ Help FAQ  
  Login   Register  
Recommend this page to a friend! ReTweet ReTweet Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Oddleif Halvorsen  >  Double Linked List  >  ListeNode.php  
File: ListeNode.php
Role: Class source
Content type: text/plain
Description: The class for the list node
Class: Double Linked List
A double linked list similar to LinkedList in Java
 

Contents

Class file image Download
<?php
/**
 * <p>Title: Double linked list</p>
 * <p>Description: Implementation of a double linked list in PHP</p>
 * @author Oddleif Halvorsen | leif-h@online.no
 * @version 1.2
 */
 
 
class ListNode{
    var 
$previousNode;
    var 
$nextNode//a reference to the next node
    
var $element//the object || value for this node.
    
    /**
     * Constructs a ListNode.
     * @param $element The object/value of the node
     */
    
function ListNode($element NULL){
        
$this->element = &$element;
    }
    
    
/**
     * Sets the reference to the previous node.
     * @param &$node The previous node.
     */
    
function setPrevious($node){
        
$this->previousNode = &$node;
    }
    
    
/**
     * Sets the reference to the next node.
     * @param &$node The next node.
     */
    
function setNext($node){
        
$this->nextNode = &$node;
    }
    
    
/**
     * Returns the reference to the previous node.
     * @return The reference to the previous node.
     */
    
function &getPrevious(){
        return 
$this->previousNode;
    }

    
/**
     * Returns the reference to the next node.
     * @return The reference to the next node.
     */
    
function &getNext(){
        return 
$this->nextNode;
    }

    
/**
     * Returns the object/value of the node
     * @return The object/value of the node
     */
    
function getNodeValue(){
        return 
$this->element;
    }
}
?>

 
  Advertise on this site Advertise on this site   Site map Site map   Statistics Statistics   Site tips Site tips   Privacy policy Privacy policy   Contact Contact  

For more information send a message to :
info at phpclasses dot org.
Copyright (c) Icontem 1999-2009 PHP Classes - PHP Class Scripts
  PHP Book Reviews - Reviews of books and other products