home *** CD-ROM | disk | FTP | other *** search
/ Symantec Visual Cafe for Java 2.5 / symantec-visual-cafe-2.5-database-dev-edition.iso / Extras / OSpace / jgl.exe / jgl_2_0 / COM / objectspace / jgl / Stack.class (.txt) < prev    next >
Encoding:
Java Class File  |  1997-03-12  |  2.3 KB  |  133 lines

  1. package COM.objectspace.jgl;
  2.  
  3. import java.util.Enumeration;
  4.  
  5. public class Stack implements Container {
  6.    Sequence mySequence;
  7.  
  8.    public Stack() {
  9.       this.mySequence = new Array();
  10.    }
  11.  
  12.    public Stack(Sequence var1) {
  13.       synchronized(var1){}
  14.  
  15.       try {
  16.          this.mySequence = (Sequence)var1.clone();
  17.       } catch (Throwable var4) {
  18.          throw var4;
  19.       }
  20.  
  21.    }
  22.  
  23.    public Stack(Stack var1) {
  24.       synchronized(var1){}
  25.  
  26.       try {
  27.          this.mySequence = (Sequence)var1.mySequence.clone();
  28.       } catch (Throwable var4) {
  29.          throw var4;
  30.       }
  31.  
  32.    }
  33.  
  34.    public synchronized void copy(Stack var1) {
  35.       synchronized(var1){}
  36.  
  37.       try {
  38.          if (this != var1) {
  39.             this.mySequence = (Sequence)var1.mySequence.clone();
  40.          }
  41.       } catch (Throwable var4) {
  42.          throw var4;
  43.       }
  44.  
  45.    }
  46.  
  47.    public synchronized Object clone() {
  48.       return new Stack((Sequence)this.mySequence.clone());
  49.    }
  50.  
  51.    public synchronized String toString() {
  52.       return "Stack( " + this.mySequence.toString() + " )";
  53.    }
  54.  
  55.    public boolean equals(Object var1) {
  56.       return var1 instanceof Stack && this.equals((Stack)var1);
  57.    }
  58.  
  59.    public synchronized boolean equals(Stack var1) {
  60.       return this.mySequence.equals(var1.mySequence);
  61.    }
  62.  
  63.    public synchronized int hashCode() {
  64.       return this.mySequence.hashCode();
  65.    }
  66.  
  67.    public boolean isEmpty() {
  68.       return this.mySequence.isEmpty();
  69.    }
  70.  
  71.    public int size() {
  72.       return this.mySequence.size();
  73.    }
  74.  
  75.    public int maxSize() {
  76.       return this.mySequence.maxSize();
  77.    }
  78.  
  79.    public synchronized Object top() {
  80.       return this.mySequence.back();
  81.    }
  82.  
  83.    public synchronized Object add(Object var1) {
  84.       this.mySequence.pushBack(var1);
  85.       return null;
  86.    }
  87.  
  88.    public void push(Object var1) {
  89.       this.add(var1);
  90.    }
  91.  
  92.    public synchronized Object pop() {
  93.       return this.mySequence.popBack();
  94.    }
  95.  
  96.    public synchronized void clear() {
  97.       this.mySequence.clear();
  98.    }
  99.  
  100.    public synchronized Enumeration elements() {
  101.       return this.mySequence.elements();
  102.    }
  103.  
  104.    public synchronized ForwardIterator start() {
  105.       return this.mySequence.start();
  106.    }
  107.  
  108.    public synchronized ForwardIterator finish() {
  109.       return this.mySequence.finish();
  110.    }
  111.  
  112.    public synchronized void swap(Stack var1) {
  113.       synchronized(var1){}
  114.  
  115.       try {
  116.          Sequence var4 = this.mySequence;
  117.          this.mySequence = var1.mySequence;
  118.          var1.mySequence = var4;
  119.       } catch (Throwable var6) {
  120.          throw var6;
  121.       }
  122.  
  123.    }
  124.  
  125.    public Object remove(Enumeration var1) {
  126.       throw new InvalidOperationException("cannot execute remove() on a stack");
  127.    }
  128.  
  129.    public int remove(Enumeration var1, Enumeration var2) {
  130.       throw new InvalidOperationException("cannot execute remove() on a stack");
  131.    }
  132. }
  133.