From 2d3f90e1f0145452e29359d5ed07536adb5ba490 Mon Sep 17 00:00:00 2001 From: Jacques Grelet <jacques.grelet@ird.fr> Date: Tue, 17 Feb 2009 07:51:21 +0000 Subject: [PATCH] add node class used by stack --- @node/data.m | 6 ++++++ @node/get.m | 13 +++++++++++++ @node/next.m | 6 ++++++ @node/node.m | 38 ++++++++++++++++++++++++++++++++++++++ 4 files changed, 63 insertions(+) create mode 100644 @node/data.m create mode 100644 @node/get.m create mode 100644 @node/next.m create mode 100644 @node/node.m diff --git a/@node/data.m b/@node/data.m new file mode 100644 index 0000000..89704c5 --- /dev/null +++ b/@node/data.m @@ -0,0 +1,6 @@ +function val = data(self) + +% get access methods for properties +% --------------------------------- +val = self.data; + diff --git a/@node/get.m b/@node/get.m new file mode 100644 index 0000000..7296058 --- /dev/null +++ b/@node/get.m @@ -0,0 +1,13 @@ +function val = get(self, arg) + +% get access methods for properties +% --------------------------------- +switch arg +case 'data' + val = self.data; +case 'next' + val = self.next; +otherwise + error('Wrong input args'); +end + diff --git a/@node/next.m b/@node/next.m new file mode 100644 index 0000000..6bad714 --- /dev/null +++ b/@node/next.m @@ -0,0 +1,6 @@ +function val = next(self) + +% get access methods for properties +% --------------------------------- +val = self.next; + diff --git a/@node/node.m b/@node/node.m new file mode 100644 index 0000000..72d570d --- /dev/null +++ b/@node/node.m @@ -0,0 +1,38 @@ +function n = node(data,next) +% node.m +% +% This class is used with stack class to implemete LIFO stack +% +% $Id$ + +%% COPYRIGHT & LICENSE +% Copyright 2009 - IRD US191, all rights reserved. +% +% This file is part of tsg-qc Matlab program. +% +% tsg-qc program is free software; you can redistribute it and/or modify +% it under the terms of the GNU General Public License as published by +% the Free Software Foundation; either version 2 of the License, or +% (at your option) any later version. +% +% tsgqc 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 General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with Datagui; if not, write to the Free Software +% Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 +% USA + +if nargin == 2 + self.data = data; + self.next = next; +else + self.data = {}; + self.next = {}; +end + +% class constructor +% ----------------- +n = class(self, 'node'); -- GitLab