📄 xssimpletypedecl.java
字号:
// for fundamental facets private short fOrdered; private boolean fFinite; private boolean fBounded; private boolean fNumeric; // default constructor public XSSimpleTypeDecl(){} //Create a new built-in primitive types (and id/idref/entity/integer/yearMonthDuration) protected XSSimpleTypeDecl(XSSimpleTypeDecl base, String name, short validateDV, short ordered, boolean bounded, boolean finite, boolean numeric, boolean isImmutable, short builtInKind) { fIsImmutable = isImmutable; fBase = base; fTypeName = name; fTargetNamespace = URI_SCHEMAFORSCHEMA; // To simplify the code for anySimpleType, we treat it as an atomic type fVariety = VARIETY_ATOMIC; fValidationDV = validateDV; fFacetsDefined = FACET_WHITESPACE; if (validateDV == DV_STRING) { fWhiteSpace = WS_PRESERVE; } else { fWhiteSpace = WS_COLLAPSE; fFixedFacet = FACET_WHITESPACE; } this.fOrdered = ordered; this.fBounded = bounded; this.fFinite = finite; this.fNumeric = numeric; fAnnotations = null; // Specify the build in kind for this primitive type fBuiltInKind = builtInKind; } //Create a new simple type for restriction for built-in types protected XSSimpleTypeDecl(XSSimpleTypeDecl base, String name, String uri, short finalSet, boolean isImmutable, XSObjectList annotations, short builtInKind) { this(base, name, uri, finalSet, isImmutable, annotations); // Specify the build in kind for this built-in type fBuiltInKind = builtInKind; } //Create a new simple type for restriction. protected XSSimpleTypeDecl(XSSimpleTypeDecl base, String name, String uri, short finalSet, boolean isImmutable, XSObjectList annotations) { fBase = base; fTypeName = name; fTargetNamespace = uri; fFinalSet = finalSet; fAnnotations = annotations; fVariety = fBase.fVariety; fValidationDV = fBase.fValidationDV; switch (fVariety) { case VARIETY_ATOMIC: break; case VARIETY_LIST: fItemType = fBase.fItemType; break; case VARIETY_UNION: fMemberTypes = fBase.fMemberTypes; break; } // always inherit facets from the base. // in case a type is created, but applyFacets is not called fLength = fBase.fLength; fMinLength = fBase.fMinLength; fMaxLength = fBase.fMaxLength; fPattern = fBase.fPattern; fPatternStr = fBase.fPatternStr; fEnumeration = fBase.fEnumeration; fEnumerationType = fBase.fEnumerationType; fEnumerationItemType = fBase.fEnumerationItemType; fWhiteSpace = fBase.fWhiteSpace; fMaxExclusive = fBase.fMaxExclusive; fMaxInclusive = fBase.fMaxInclusive; fMinExclusive = fBase.fMinExclusive; fMinInclusive = fBase.fMinInclusive; fTotalDigits = fBase.fTotalDigits; fFractionDigits = fBase.fFractionDigits; fPatternType = fBase.fPatternType; fFixedFacet = fBase.fFixedFacet; fFacetsDefined = fBase.fFacetsDefined; //we also set fundamental facets information in case applyFacets is not called. caclFundamentalFacets(); fIsImmutable = isImmutable; // Inherit from the base type fBuiltInKind = base.fBuiltInKind; } //Create a new simple type for list. protected XSSimpleTypeDecl(String name, String uri, short finalSet, XSSimpleTypeDecl itemType, boolean isImmutable, XSObjectList annotations) { fBase = fAnySimpleType; fTypeName = name; fTargetNamespace = uri; fFinalSet = finalSet; fAnnotations = annotations; fVariety = VARIETY_LIST; fItemType = (XSSimpleTypeDecl)itemType; fValidationDV = DV_LIST; fFacetsDefined = FACET_WHITESPACE; fFixedFacet = FACET_WHITESPACE; fWhiteSpace = WS_COLLAPSE; //setting fundamental facets caclFundamentalFacets(); fIsImmutable = isImmutable; // Values of this type are lists fBuiltInKind = XSConstants.LIST_DT; } //Create a new simple type for union. protected XSSimpleTypeDecl(String name, String uri, short finalSet, XSSimpleTypeDecl[] memberTypes, XSObjectList annotations) { fBase = fAnySimpleType; fTypeName = name; fTargetNamespace = uri; fFinalSet = finalSet; fAnnotations = annotations; fVariety = VARIETY_UNION; fMemberTypes = memberTypes; fValidationDV = DV_UNION; // even for union, we set whitespace to something // this will never be used, but we can use fFacetsDefined to check // whether applyFacets() is allwwed: it's not allowed // if fFacetsDefined != 0 fFacetsDefined = FACET_WHITESPACE; fWhiteSpace = WS_COLLAPSE; //setting fundamental facets caclFundamentalFacets(); // none of the schema-defined types are unions, so just set // fIsImmutable to false. fIsImmutable = false; // No value can be of this type, so it's unavailable. fBuiltInKind = XSConstants.UNAVAILABLE_DT; } //set values for restriction. protected XSSimpleTypeDecl setRestrictionValues(XSSimpleTypeDecl base, String name, String uri, short finalSet, XSObjectList annotations) { //decline to do anything if the object is immutable. if(fIsImmutable) return null; fBase = base; fTypeName = name; fTargetNamespace = uri; fFinalSet = finalSet; fAnnotations = annotations; fVariety = fBase.fVariety; fValidationDV = fBase.fValidationDV; switch (fVariety) { case VARIETY_ATOMIC: break; case VARIETY_LIST: fItemType = fBase.fItemType; break; case VARIETY_UNION: fMemberTypes = fBase.fMemberTypes; break; } // always inherit facets from the base. // in case a type is created, but applyFacets is not called fLength = fBase.fLength; fMinLength = fBase.fMinLength; fMaxLength = fBase.fMaxLength; fPattern = fBase.fPattern; fPatternStr = fBase.fPatternStr; fEnumeration = fBase.fEnumeration; fEnumerationType = fBase.fEnumerationType; fEnumerationItemType = fBase.fEnumerationItemType; fWhiteSpace = fBase.fWhiteSpace; fMaxExclusive = fBase.fMaxExclusive; fMaxInclusive = fBase.fMaxInclusive; fMinExclusive = fBase.fMinExclusive; fMinInclusive = fBase.fMinInclusive; fTotalDigits = fBase.fTotalDigits; fFractionDigits = fBase.fFractionDigits; fPatternType = fBase.fPatternType; fFixedFacet = fBase.fFixedFacet; fFacetsDefined = fBase.fFacetsDefined; //we also set fundamental facets information in case applyFacets is not called. caclFundamentalFacets(); // Inherit from the base type fBuiltInKind = base.fBuiltInKind; return this; } //set values for list. protected XSSimpleTypeDecl setListValues(String name, String uri, short finalSet, XSSimpleTypeDecl itemType, XSObjectList annotations) { //decline to do anything if the object is immutable. if(fIsImmutable) return null; fBase = fAnySimpleType; fTypeName = name; fTargetNamespace = uri; fFinalSet = finalSet; fAnnotations = annotations; fVariety = VARIETY_LIST; fItemType = (XSSimpleTypeDecl)itemType; fValidationDV = DV_LIST; fFacetsDefined = FACET_WHITESPACE; fFixedFacet = FACET_WHITESPACE; fWhiteSpace = WS_COLLAPSE; //setting fundamental facets caclFundamentalFacets(); // Values of this type are lists fBuiltInKind = XSConstants.LIST_DT; return this; } //set values for union. protected XSSimpleTypeDecl setUnionValues(String name, String uri, short finalSet, XSSimpleTypeDecl[] memberTypes, XSObjectList annotations) { //decline to do anything if the object is immutable. if(fIsImmutable) return null; fBase = fAnySimpleType; fTypeName = name; fTargetNamespace = uri; fFinalSet = finalSet; fAnnotations = annotations; fVariety = VARIETY_UNION; fMemberTypes = memberTypes; fValidationDV = DV_UNION; // even for union, we set whitespace to something // this will never be used, but we can use fFacetsDefined to check // whether applyFacets() is allwwed: it's not allowed // if fFacetsDefined != 0 fFacetsDefined = FACET_WHITESPACE; fWhiteSpace = WS_COLLAPSE; //setting fundamental facets caclFundamentalFacets(); // No value can be of this type, so it's unavailable. fBuiltInKind = XSConstants.UNAVAILABLE_DT; return this; } public short getType () { return XSConstants.TYPE_DEFINITION; } public short getTypeCategory () { return SIMPLE_TYPE; } public String getName() { return getAnonymous()?null:fTypeName; } public String getTypeName() { return fTypeName; } public String getNamespace() { return fTargetNamespace; } public short getFinal(){ return fFinalSet; } public boolean isFinal(short derivation) { return (fFinalSet & derivation) != 0; } public XSTypeDefinition getBaseType(){ return fBase; }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -