/** * This method returns true if there is a derivation between the reference type definition, that is the TypeInfo * on which the method is being called, and the other type definition, that is the one passed as parameters. * This method implements the DOM Level 3 TypeInfo interface. It must be called only on a valid type. * * @param typeNamespaceArg the namespace of the "other" type * @param typeNameArg the local name of the "other" type * @param derivationMethod the derivation method: zero or more of {@link SchemaType#DERIVATION_RESTRICTION}, * {@link SchemaType#DERIVATION_EXTENSION}, {@link SchemaType#DERIVATION_LIST}, or {@link SchemaType#DERIVATION_UNION}. * Zero means derived by any possible route. */ public boolean isDerivedFrom(String typeNamespaceArg, String typeNameArg, int derivationMethod) throws IllegalStateException { SchemaType base = schemaType.getBaseType(); int fingerprint = config.getNamePool().allocateFingerprint(typeNamespaceArg, typeNameArg); if (derivationMethod == 0 || (derivationMethod & schemaType.getDerivationMethod()) != 0) { if (base.getFingerprint() == fingerprint) { return true; } else if (base instanceof AnyType) { return false; } else { return new TypeInfoImpl(config, base).isDerivedFrom(typeNamespaceArg, typeNameArg, derivationMethod); } } return false; // Note: if derivationMethod is RESTRICTION, this interpretation requires every step to be derived // by restriction. An alternative interpretation is that at least one step must be derived by restriction. }
/** * This method returns true if there is a derivation between the reference type definition, that is the TypeInfo * on which the method is being called, and the other type definition, that is the one passed as parameters. * This method implements the DOM Level 3 TypeInfo interface. It must be called only on a valid type. * @param typeNamespaceArg the namespace of the "other" type * @param typeNameArg the local name of the "other" type * @param derivationMethod the derivation method: zero or more of {@link SchemaType#DERIVATION_RESTRICTION}, * {@link SchemaType#DERIVATION_EXTENSION}, {@link SchemaType#DERIVATION_LIST}, or {@link SchemaType#DERIVATION_UNION}. * Zero means derived by any possible route. */ public boolean isDerivedFrom(String typeNamespaceArg, String typeNameArg, int derivationMethod) throws IllegalStateException { SchemaType base = schemaType.getBaseType(); int fingerprint = config.getNamePool().allocate("", typeNamespaceArg, typeNameArg); if (derivationMethod==0 || (derivationMethod & schemaType.getDerivationMethod()) != 0) { if (base.getFingerprint() == fingerprint) { return true; } else if (base instanceof AnyType) { return false; } else { return new TypeInfoImpl(config, base).isDerivedFrom(typeNamespaceArg, typeNameArg, derivationMethod); } } return false; // Note: if derivationMethod is RESTRICTION, this interpretation requires every step to be derived // by restriction. An alternative interpretation is that at least one step must be derived by restriction. }
/** * This method returns true if there is a derivation between the reference type definition, that is the TypeInfo * on which the method is being called, and the other type definition, that is the one passed as parameters. * This method implements the DOM Level 3 TypeInfo interface. It must be called only on a valid type. * * @param typeNamespaceArg the namespace of the "other" type * @param typeNameArg the local name of the "other" type * @param derivationMethod the derivation method: zero or more of {@link SchemaType#DERIVATION_RESTRICTION}, * {@link SchemaType#DERIVATION_EXTENSION}, {@link SchemaType#DERIVATION_LIST}, or {@link SchemaType#DERIVATION_UNION}. * Zero means derived by any possible route. */ public boolean isDerivedFrom(String typeNamespaceArg, String typeNameArg, int derivationMethod) throws IllegalStateException { SchemaType base = schemaType.getBaseType(); int fingerprint = config.getNamePool().allocateFingerprint(typeNamespaceArg, typeNameArg); if (derivationMethod == 0 || (derivationMethod & schemaType.getDerivationMethod()) != 0) { if (base.getFingerprint() == fingerprint) { return true; } else if (base instanceof AnyType) { return false; } else { return new TypeInfoImpl(config, base).isDerivedFrom(typeNamespaceArg, typeNameArg, derivationMethod); } } return false; // Note: if derivationMethod is RESTRICTION, this interpretation requires every step to be derived // by restriction. An alternative interpretation is that at least one step must be derived by restriction. }