1 57 58 package com.sun.org.apache.xerces.internal.impl.xs.models; 59 60 import com.sun.org.apache.xerces.internal.impl.dtd.models.CMNode; 61 import com.sun.org.apache.xerces.internal.impl.dtd.models.CMStateSet; 62 63 69 public class XSCMLeaf 70 extends CMNode { 71 72 76 77 private Object fLeaf = null; 78 79 82 private int fParticleId = -1; 83 84 89 private int fPosition = -1; 90 91 95 96 public XSCMLeaf(int type, Object leaf, int id, int position) { 97 super(type); 98 99 fLeaf = leaf; 101 fParticleId = id; 102 fPosition = position; 103 } 104 105 109 final Object getLeaf() { 110 return fLeaf; 111 } 112 113 final int getParticleId() { 114 return fParticleId; 115 } 116 117 final int getPosition() { 118 return fPosition; 119 } 120 121 final void setPosition(int newPosition) { 122 fPosition = newPosition; 123 } 124 125 129 131 public boolean isNullable() { 132 return (fPosition == -1); 134 } 135 136 public String toString() { 137 StringBuffer strRet = new StringBuffer (fLeaf.toString()); 138 if (fPosition >= 0) { 139 strRet.append 140 ( 141 " (Pos:" 142 + new Integer (fPosition).toString() 143 + ")" 144 ); 145 } 146 return strRet.toString(); 147 } 148 149 151 protected void calcFirstPos(CMStateSet toSet) { 152 if (fPosition == -1) 154 toSet.zeroBits(); 155 156 else 158 toSet.setBit(fPosition); 159 } 160 161 protected void calcLastPos(CMStateSet toSet) { 162 if (fPosition == -1) 164 toSet.zeroBits(); 165 166 else 168 toSet.setBit(fPosition); 169 } 170 171 } 173 174 | Popular Tags |