/*
   Node.m

   Copyright (C) 2003

   Author:  Yen-Ju Chen <yjchenx@hotmail.com>

   Rewritten from PlistEditor by Fabien VALLON <fabien@tuxfamily.org>
   (http://gnustep-apps.org/fabien/PlistEditor/)

   This library is free software; you can redistribute it and/or
   modify it under the terms of the GNU Library General Public
   License as published by the Free Software Foundation; either
   version 2 of the License, or (at your option) any later version.

   This library is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   Library General Public License for more details.

   You should have received a copy of the GNU Library General Public
   License along with this library; see the file COPYING.LIB.
   If not, write to the Free Software Foundation,
   59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/

#include "Node.h"
#include <Foundation/NSArray.h>
#include <Foundation/NSString.h>

@implementation Node

- (id) init
{
  self = [super init];
  [self setParent: nil];
  [self setKey: nil];
  [self setValue: nil];
  _children = [NSMutableArray new];
  return self;
}

- (void) dealloc
{
  RELEASE(_parent);
  RELEASE(_key);
  RELEASE(_value);
  RELEASE(_children);
  [super dealloc];
}

-(Node *) parent
{
  return _parent;
}

- (void) setParent: (Node *) parent
{
  ASSIGN(_parent, parent);
}

-(NSArray *) children
{
  return _children;
}

-(void) addChildren:(Node *) children
{
  [_children addObject: children];
}

-(void) setKey:(NSString *) key
{
  ASSIGN(_key, key);
}

-(NSString *) key
{
  return _key;
}


-(void) setValue:(NSString *) value
{
  ASSIGN(_value, value);
}

-(NSString *) value
{
  return _value;
}
@end
