home *** CD-ROM | disk | FTP | other *** search
/ Cre@te Online 2000 December / Cre@teOnline CD05.iso / MacSoft / XML ConsoleMax.sea / XML ConsoleMax / Required / xml4j.jar / com / ibm / xml / internal / CMLeaf.class (.txt) < prev    next >
Encoding:
Java Class File  |  1999-08-30  |  1.5 KB  |  69 lines

  1. package com.ibm.xml.internal;
  2.  
  3. import com.ibm.xml.framework.StringPool;
  4.  
  5. class CMLeaf extends CMNode {
  6.    private int fElementIndex;
  7.    private int fPosition = -1;
  8.  
  9.    CMLeaf(int var1, int var2, int var3) throws CMException {
  10.       super(var1);
  11.       if (((CMNode)this).type() != 0) {
  12.          throw new CMException(155);
  13.       } else {
  14.          this.fElementIndex = var2;
  15.          this.fPosition = var3;
  16.       }
  17.    }
  18.  
  19.    CMLeaf(int var1, int var2) throws CMException {
  20.       super(var1);
  21.       if (((CMNode)this).type() != 0) {
  22.          throw new CMException(155);
  23.       } else {
  24.          this.fElementIndex = var2;
  25.       }
  26.    }
  27.  
  28.    final int getElemIndex() {
  29.       return this.fElementIndex;
  30.    }
  31.  
  32.    final int getPosition() {
  33.       return this.fPosition;
  34.    }
  35.  
  36.    final void setPosition(int var1) {
  37.       this.fPosition = var1;
  38.    }
  39.  
  40.    boolean isNullable() throws CMException {
  41.       return this.fPosition == -1;
  42.    }
  43.  
  44.    String toString(StringPool var1) {
  45.       StringBuffer var2 = new StringBuffer(var1.toString(this.fElementIndex));
  46.       if (this.fPosition >= 0) {
  47.          var2.append(" (Pos:" + (new Integer(this.fPosition)).toString() + ")");
  48.       }
  49.  
  50.       return var2.toString();
  51.    }
  52.  
  53.    protected void calcFirstPos(CMStateSet var1) throws CMException {
  54.       if (this.fPosition == -1) {
  55.          var1.zeroBits();
  56.       } else {
  57.          var1.setBit(this.fPosition);
  58.       }
  59.    }
  60.  
  61.    protected void calcLastPos(CMStateSet var1) throws CMException {
  62.       if (this.fPosition == -1) {
  63.          var1.zeroBits();
  64.       } else {
  65.          var1.setBit(this.fPosition);
  66.       }
  67.    }
  68. }
  69.