类 Stack<T>

java.lang.Object
weka.core.neighboursearch.covertrees.Stack<T>
类型参数:
T - The type of elements to be stored in the stack.
所有已实现的接口:
Serializable, RevisionHandler

public class Stack<T> extends Object implements Serializable, RevisionHandler
Class implementing a stack.
版本:
$Revision: 1.3 $
作者:
Alina Beygelzimer (original C++ code), Sham Kakade (original C++ code), John Langford (original C++ code), Ashraf M. Kibriya (amk14[at-the-rate]cs[dot]waikato[dot]ac[dot]nz) (Java port)
另请参阅:
  • 字段概要

    字段
    修饰符和类型
    字段
    说明
    The elements inside the stack.
    int
    The number of elements in the stack.
  • 构造器概要

    构造器
    构造器
    说明
    Constructor.
    Stack(int capacity)
    Constructor.
  • 方法概要

    修饰符和类型
    方法
    说明
    void
    Adds all the given elements in the stack.
    void
    Removes all the elements from the stack.
    element(int i)
    Returns the ith element in the stack.
    Returns the revision string.
    Returns the last element in the stack.
    pop()
    Pops (removes) the first (last added) element in the stack.
    void
    push(T new_ele)
    Pushes the given element to the stack.
    void
    push(Stack<T> v, T new_ele)
    Pushes the given element onto the given stack.
    void
    Replace all elements in the stack with the elements of another given stack.
    void
    set(int i, T e)
    Sets the ith element in the stack.
    subList(int beginIdx, int uptoLength)
    Returns a sublist of the elements in the stack.

    从类继承的方法 java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 字段详细资料

    • length

      public int length
      The number of elements in the stack.
    • elements

      public ArrayList<T> elements
      The elements inside the stack.
  • 构造器详细资料

    • Stack

      public Stack()
      Constructor.
    • Stack

      public Stack(int capacity)
      Constructor.
      参数:
      capacity - The initial capacity of the stack.
  • 方法详细资料

    • last

      public T last()
      Returns the last element in the stack.
      返回:
      The last element.
    • element

      public T element(int i)
      Returns the ith element in the stack.
      参数:
      i - The index of the element to return.
      返回:
      The ith element.
    • set

      public void set(int i, T e)
      Sets the ith element in the stack.
      参数:
      i - The index at which the element is to be inserted.
      e - The element to insert.
    • subList

      public List subList(int beginIdx, int uptoLength)
      Returns a sublist of the elements in the stack.
      参数:
      beginIdx - The start index of the sublist.
      uptoLength - The length of the sublist.
      返回:
      The sublist starting from beginIdx and of length uptoLength.
    • clear

      public void clear()
      Removes all the elements from the stack.
    • addAll

      public void addAll(Collection c)
      Adds all the given elements in the stack.
      参数:
      c - The collection of elements to add in the stack.
    • replaceAllBy

      public void replaceAllBy(Stack<T> s)
      Replace all elements in the stack with the elements of another given stack. It first removes all the elements currently in the stack, and then adds all the elements of the provided stack.
      参数:
      s - The stack whose elements should be put in this stack.
    • pop

      public T pop()
      Pops (removes) the first (last added) element in the stack.
      返回:
      The poped element.
    • push

      public void push(T new_ele)
      Pushes the given element to the stack.
      参数:
      new_ele - The element to be pushed to the stack.
    • push

      public void push(Stack<T> v, T new_ele)
      Pushes the given element onto the given stack.
      参数:
      v - The stack onto push the element.
      new_ele - The element to push.
    • getRevision

      public String getRevision()
      Returns the revision string.
      指定者:
      getRevision 在接口中 RevisionHandler
      返回:
      the revision