00001 /* 00002 [The "BSD licence"] 00003 Copyright (c) 2005-2007 Kunle Odutola 00004 All rights reserved. 00005 00006 Redistribution and use in source and binary forms, with or without 00007 modification, are permitted provided that the following conditions 00008 are met: 00009 1. Redistributions of source code MUST RETAIN the above copyright 00010 notice, this list of conditions and the following disclaimer. 00011 2. Redistributions in binary form MUST REPRODUCE the above copyright 00012 notice, this list of conditions and the following disclaimer in 00013 the documentation and/or other materials provided with the 00014 distribution. 00015 3. The name of the author may not be used to endorse or promote products 00016 derived from this software without specific prior WRITTEN permission. 00017 4. Unless explicitly state otherwise, any contribution intentionally 00018 submitted for inclusion in this work to the copyright owner or licensor 00019 shall be under the terms and conditions of this license, without any 00020 additional terms or conditions. 00021 00022 THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 00023 IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 00024 OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 00025 IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 00026 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 00027 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 00028 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 00029 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00030 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 00031 THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00032 */ 00033 00034 00035 namespace Antlr.Runtime.Collections 00036 { 00037 using System; 00038 using ArrayList = System.Collections.ArrayList; 00039 00043 public class StackList : ArrayList 00044 { 00045 public StackList() : base() 00046 { 00047 } 00048 00052 public void Push(object item) 00053 { 00054 Add(item); 00055 } 00056 00061 public object Pop() 00062 { 00063 object poppedItem = this[this.Count - 1]; 00064 RemoveAt(this.Count - 1); 00065 return poppedItem; 00066 } 00067 00072 public object Peek() 00073 { 00074 return this[this.Count - 1]; 00075 } 00076 } 00077 }
1.5.5