// Job: Jay's Own Browser, a web browser written in Java by Jay Skeer // Copyright (C) 1996 Jay Skeer, Jay Prime Positive // // This 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. // // This program 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 this program; if not, write to the Free Software // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // public class OneWayLinkedList { Object item; OneWayLinkedList next; public OneWayLinkedList(Object item) { this.item= item; this.next= null; } // public void addEnd(OneWayLinkedList tail) { // next= tail; // } public void addBeg(OneWayLinkedList tail) { next= tail; } public Object peekBeg() { return item; } public int sizen(int max) { int rv= 0; OneWayLinkedList walk= next; while ((null != walk) && (rv < max)) { walk= walk.next; rv= rv + 1; } if (max <= rv) { /* error */ return -1; } else { return rv; } } public int size() { return sizen(65536); } }