// ////////////////////////////////////////////////////////
// Copyright (1994) Columbia University
// Department of Biochemistry and Molecular Biophysics
//
// Author: Weider Chang, Ph.D
// ///////////////////////////////////////////////////////

#include "linebuff.h"

@implementation WDCLListOfString

#include "llistcom.m"
#include "itering.m"

- addCopyOfCString:(char *)charptr
{
  if (! _next)
    {
      [self setNextLink:[[[/*[self class] not working */ 
			   /* you can't create drived class 
			      in it's base class */
			     
			   WDCLListOfString alloc] initFromCString: charptr] 
		   setPrevLink: self]];
    }
  else [_next addCopyOfCString:charptr];
  return self;
}

@end


@implementation WDCLineBuffer

- addCopyOfCString:(char *)charptr
{
  if (! _next)
    {
      [self setNextLink:[[[WDCLineBuffer alloc] initFromCString: charptr] 
		   setPrevLink: self]];
    }
  else [_next addCopyOfCString:charptr];
  return self;
}

- deepCopy
{
  id temp=[[WDCLineBuffer alloc] initFromCString:(char*)[self cStringValue]];
  return [temp setNextLink:[[_next deepCopy] setPrevLink:temp]];
}

- selectedDeepCopy
{
  return [self deepCopy];
}

- printForDebugger
{
  [super printForDebugger];
  if (_next) [_next printForDebugger];
  return self;
}

@end
