/***********************************************************************
 * EqueueNode.m
 *
 * Implementation file for a simple EqueueNode class. This class serves
 * the same function as the Node class from the C++ version, but is
 * equipped with a full set of accessor methods instead of leaving
 * variables public.
 *
 * Written by Paul Bonamy - 9 August 2010
 ***********************************************************************/

#import "EqueueNode.h"

@implementation EqueueNode

/*
 * @synthesize, paired with an @property in the interface, automatically
 * generates setter and getter methods for the specified variables. Note
 * that it is possible to instruct @property and @synthesis to treat a
 * variable as read-only, in which case it will produce the getter, but 
 * not the setter
 */

@synthesize value, next, prev;


/*
 * The init signal in Objective-C serves much the same purpose as a C++
 * constructor, even though it has to be called manually rather than 
 * running automatically. The overall flow of init is as follows:
 *		(1) Make sure anything our parent class needs to init is done
 *		(2) Initialize stuff we're implementing
 * init is expected to return nil, if something goes wrong, or (something
 * like) iself, if all went well. That's why we have the 
 *		if(self = [super init])
 */
-(id) init {
	// NOTE: 'self' in Obj-C serves the same purpose as 'this' in C++/Java
	if(self = [super init]) {
		/*
		 * nil is akin to NULL, excepting that it's possible to send
		 * a message to nil, if you really want to.
		 */
		next = nil;
		prev = nil;
	}
	return self;
}

@end
