xssimpletypedecl.java

来自「JAVA的一些源码 JAVA2 STANDARD EDITION DEVELO」· Java 代码 · 共 1,439 行 · 第 1/5 页

JAVA
1,439
字号
    private XSObjectListImpl fMultiValueFacets;    // simpleType annotations    private XSObjectList fAnnotations = null;    private short fPatternType = SPECIAL_PATTERN_NONE;    // for fundamental facets    private short fOrdered;    private boolean fFinite;    private boolean fBounded;    private boolean fNumeric;        /**     * Unique ID for each simple type.     * This information is used to assign unique names for simple types.     */    private final int fUniqueId = getNextId();        private static int fIdCounter=0;    private static synchronized int getNextId() { return fIdCounter++; }            // default constructor    public XSSimpleTypeDecl(){}    //Create a new built-in primitive types (and id/idref/entity/integer)    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;        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;        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();        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();        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();        return this;    }    public short getType () {        return XSConstants.TYPE_DEFINITION;    }    public short getTypeCategory () {        return SIMPLE_TYPE;    }    public String getName() {        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 + =
减小字号Ctrl + -
显示快捷键?