1 16 17 package org.apache.xerces.impl.xs.models; 18 19 import org.apache.xerces.impl.dtd.models.CMNode; 20 import org.apache.xerces.impl.dtd.models.CMStateSet; 21 22 30 public class XSCMLeaf 31 extends CMNode { 32 33 37 38 private Object fLeaf = null; 39 40 43 private int fParticleId = -1; 44 45 50 private int fPosition = -1; 51 52 56 57 public XSCMLeaf(int type, Object leaf, int id, int position) { 58 super(type); 59 60 fLeaf = leaf; 62 fParticleId = id; 63 fPosition = position; 64 } 65 66 70 final Object getLeaf() { 71 return fLeaf; 72 } 73 74 final int getParticleId() { 75 return fParticleId; 76 } 77 78 final int getPosition() { 79 return fPosition; 80 } 81 82 final void setPosition(int newPosition) { 83 fPosition = newPosition; 84 } 85 86 90 92 public boolean isNullable() { 93 return (fPosition == -1); 95 } 96 97 public String toString() { 98 StringBuffer strRet = new StringBuffer (fLeaf.toString()); 99 if (fPosition >= 0) { 100 strRet.append 101 ( 102 " (Pos:" 103 + Integer.toString(fPosition) 104 + ")" 105 ); 106 } 107 return strRet.toString(); 108 } 109 110 112 protected void calcFirstPos(CMStateSet toSet) { 113 if (fPosition == -1) 115 toSet.zeroBits(); 116 117 else 119 toSet.setBit(fPosition); 120 } 121 122 protected void calcLastPos(CMStateSet toSet) { 123 if (fPosition == -1) 125 toSet.zeroBits(); 126 127 else 129 toSet.setBit(fPosition); 130 } 131 132 } 134 135 | Popular Tags |