1 57 58 package org.enhydra.apache.xerces.validators.common; 59 60 import org.enhydra.apache.xerces.framework.XMLContentSpec; 61 import org.enhydra.apache.xerces.utils.ImplementationMessages; 62 63 67 public class CMUniOp extends CMNode 68 { 69 public CMUniOp(int type, CMNode childNode) throws CMException 73 { 74 super(type); 75 76 if ((type() != XMLContentSpec.CONTENTSPECNODE_ZERO_OR_ONE) 78 && (type() != XMLContentSpec.CONTENTSPECNODE_ZERO_OR_MORE) 79 && (type() != XMLContentSpec.CONTENTSPECNODE_ONE_OR_MORE)) 80 { 81 throw new CMException(ImplementationMessages.VAL_UST); 82 } 83 84 fChild = childNode; 86 } 87 88 89 final CMNode getChild() 93 { 94 return fChild; 95 } 96 97 98 boolean isNullable() throws CMException 102 { 103 if (type() == XMLContentSpec.CONTENTSPECNODE_ONE_OR_MORE) 108 return fChild.isNullable(); 109 else 110 return true; 111 } 112 113 114 protected void calcFirstPos(CMStateSet toSet) throws CMException 118 { 119 toSet.setTo(fChild.firstPos()); 121 } 122 123 protected void calcLastPos(CMStateSet toSet) throws CMException 124 { 125 toSet.setTo(fChild.lastPos()); 127 } 128 129 130 private CMNode fChild; 138 }; 139 | Popular Tags |