01: //** Copyright Statement ***************************************************
02: //The Salmon Open Framework for Internet Applications (SOFIA)
03: // Copyright (C) 1999 - 2002, Salmon LLC
04: //
05: // This program is free software; you can redistribute it and/or
06: // modify it under the terms of the GNU General Public License version 2
07: // as published by the Free Software Foundation;
08: //
09: // This program is distributed in the hope that it will be useful,
10: // but WITHOUT ANY WARRANTY; without even the implied warranty of
11: // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12: // GNU General Public License for more details.
13: //
14: // You should have received a copy of the GNU General Public License
15: // along with this program; if not, write to the Free Software
16: // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17: //
18: // For more information please visit http://www.salmonllc.com
19: //** End Copyright Statement ***************************************************
20:
21: package com.salmonllc.jsp.engine;
22:
23: /////////////////////////
24: //$Archive: /JADE/SourceCode/com/salmonllc/jsp/engine/JspDocument.java $
25: //$Author: Dan $
26: //$Revision: 8 $
27: //$Modtime: 10/30/02 2:58p $
28: /////////////////////////
29:
30: /**
31: * Contains a linked list of JSPElements that together represent a JSP document
32: */
33: class JspDocument {
34: JspElement _last;
35: JspElement _first;
36:
37: public JspDocument() {
38: super ();
39: }
40:
41: /**
42: * Append an element to the end of the list
43: */
44: public void append(JspElement e) {
45: if (_first == null) {
46: _first = e;
47: _last = e;
48: } else {
49: _last.setNext(e);
50: _last = e;
51: }
52: e.setNext(null);
53: }
54:
55: /**
56: * Get the first element in the document
57: */
58: public JspElement getFirst() {
59: return _first;
60: }
61:
62: /**
63: * Get the last element in the document
64: */
65: public JspElement getLast() {
66: return _last;
67: }
68:
69: /**
70: * Insert an element at the begining of the list.
71: */
72: public void insert(JspElement e) {
73: if (_first == null) {
74: _first = e;
75: _last = e;
76: e.setNext(null);
77: } else {
78: e.setNext(_first);
79: _first = e;
80: }
81: }
82: }
|