home *** CD-ROM | disk | FTP | other *** search
/ S283 Planetary Science &n…he Search for Life DVD 2 / DVD-ROM.iso / install / jre1_3 / lib / rt.jar / javax / swing / text / html / StyleSheet$SearchBuffer.class (.txt) < prev    next >
Encoding:
Java Class File  |  1979-12-31  |  1.4 KB  |  72 lines

  1. package javax.swing.text.html;
  2.  
  3. import java.util.EmptyStackException;
  4. import java.util.Hashtable;
  5. import java.util.Stack;
  6. import java.util.Vector;
  7.  
  8. class StyleSheet$SearchBuffer {
  9.    static Stack searchBuffers = new Stack();
  10.    Vector vector = null;
  11.    StringBuffer stringBuffer = null;
  12.    Hashtable hashtable = null;
  13.  
  14.    private StyleSheet$SearchBuffer() {
  15.    }
  16.  
  17.    static StyleSheet$SearchBuffer obtainSearchBuffer() {
  18.       StyleSheet$SearchBuffer var0;
  19.       try {
  20.          var0 = (StyleSheet$SearchBuffer)searchBuffers.pop();
  21.       } catch (EmptyStackException var2) {
  22.          var0 = new StyleSheet$SearchBuffer();
  23.       }
  24.  
  25.       return var0;
  26.    }
  27.  
  28.    static void releaseSearchBuffer(StyleSheet$SearchBuffer var0) {
  29.       var0.empty();
  30.       searchBuffers.push(var0);
  31.    }
  32.  
  33.    StringBuffer getStringBuffer() {
  34.       if (this.stringBuffer == null) {
  35.          this.stringBuffer = new StringBuffer();
  36.       }
  37.  
  38.       return this.stringBuffer;
  39.    }
  40.  
  41.    Vector getVector() {
  42.       if (this.vector == null) {
  43.          this.vector = new Vector();
  44.       }
  45.  
  46.       return this.vector;
  47.    }
  48.  
  49.    Hashtable getHashtable() {
  50.       if (this.hashtable == null) {
  51.          this.hashtable = new Hashtable();
  52.       }
  53.  
  54.       return this.hashtable;
  55.    }
  56.  
  57.    void empty() {
  58.       if (this.stringBuffer != null) {
  59.          this.stringBuffer.setLength(0);
  60.       }
  61.  
  62.       if (this.vector != null) {
  63.          this.vector.removeAllElements();
  64.       }
  65.  
  66.       if (this.hashtable != null) {
  67.          this.hashtable.clear();
  68.       }
  69.  
  70.    }
  71. }
  72.