net.sf.saxon.type
Class AtomicType

java.lang.Object
  |
  +--net.sf.saxon.type.SchemaType
        |
        +--net.sf.saxon.type.SimpleType
              |
              +--net.sf.saxon.type.AtomicType
All Implemented Interfaces:
ItemType, java.io.Serializable, javax.xml.transform.SourceLocator, TypeInfo
Direct Known Subclasses:
ExternalObjectType

public class AtomicType
extends SimpleType
implements ItemType

An object belonging to this class represents an atomic type: either a built-in atomic type, or a user-defined atomic type. There is at most one AtomicType object for each distinct type in the schema (so equality can safely be tested using the == operator).

See Also:
Serialized Form

Field Summary
 
Fields inherited from class net.sf.saxon.type.SchemaType
DERIVATION_EXTENSION, DERIVATION_LIST, DERIVATION_RESTRICTION, DERIVATION_UNION, DERIVE_BY_SUBSTITUTION, finalProhibitions, INVALID, UNVALIDATED, VALIDATED, VALIDATING, validationPhase
 
Constructor Summary
AtomicType()
           
 
Method Summary
 AtomicType getAtomizedItemType()
          Get the item type of the atomic values that will be produced when an item of this type is atomized
 ItemType getPrimitiveItemType()
          Get the primitive type from which this type is derived.
 int getPrimitiveType()
          Get the primitive type from which this type is derived.
 ItemType getSuperType()
          Get the type from which this item type is derived by restriction.
 SequenceIterator getTypedValue(java.lang.CharSequence value, NamespaceResolver resolver)
          Get the typed value corresponding to a given string value, assuming it is valid against this type
 int hashCode()
          Returns a hash code value for the object.
 boolean isBuiltIn()
          Test whether this is a built-in type
 boolean matchesItem(Item item)
          Test whether a given item conforms to this type
 int relationshipTo(SchemaType other)
          Determine the relationship of this schema type to another schema type.
 void setIsBuiltIn(boolean yesOrNo)
          Mark this as a built-in type
 java.lang.String toString()
          Produce string representation for use in diagnostic output
 java.lang.String toString(NamePool pool)
          Display the type descriptor for diagnostics
 boolean validate(SchemaMarker schema)
          Checks the validity of this SimpleType definition.
 void validateContent(java.lang.CharSequence value, NamespaceResolver nsResolver)
          Check whether a given input string is valid according to this SimpleType
 
Methods inherited from class net.sf.saxon.type.SimpleType
applyWhitespaceNormalization, getBuiltInBaseType, getFacet, getFacetCollection, getFacets, getFacets, getTypedValue, getWhitespaceAction, isListType, isNamespaceSensitive, isSimpleType, isTypeDerivationOK, isUnionType, iterateMemberTypes, setFacetCollection
 
Methods inherited from class net.sf.saxon.type.SchemaType
allowsDerivation, checkDerivation, containingDeclarationIsElement, getBaseType, getBaseTypeFingerprint, getBlock, getColumnNumber, getContainingDeclarationName, getDerivationMethod, getDescription, getDisplayName, getFingerprint, getLineNumber, getLocalName, getNamePool, getPublicId, getSystemId, getTypeName, getTypeNamespace, isComplexType, isDerivedFrom, isSameType, setBaseType, setBaseTypeFingerprint, setContainingDeclaration, setDerivationMethod, setDerivationMethodName, setFinalProhibitions, setFingerprint, setLineNumber, setLocalName, setLocator, setNamePool, setSystemId
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AtomicType

public AtomicType()
Method Detail

setIsBuiltIn

public void setIsBuiltIn(boolean yesOrNo)
Mark this as a built-in type


isBuiltIn

public boolean isBuiltIn()
Test whether this is a built-in type


validate

public boolean validate(SchemaMarker schema)
                 throws SchemaException
Checks the validity of this SimpleType definition.

Overrides:
validate in class SimpleType
Parameters:
schema - a Schema used for error reporting
Throws:
SchemaException - when this SimpleType definition is invalid.

matchesItem

public boolean matchesItem(Item item)
Test whether a given item conforms to this type

Specified by:
matchesItem in interface ItemType
Parameters:
item - The item to be tested
Returns:
true if the item is an instance of this type; false otherwise

validateContent

public void validateContent(java.lang.CharSequence value,
                            NamespaceResolver nsResolver)
                     throws ValidationException
Check whether a given input string is valid according to this SimpleType

Specified by:
validateContent in class SimpleType
Parameters:
value - the input string to be checked
nsResolver - a namespace resolver used to resolve namespace prefixes if the type is namespace sensitive. The value supplied may be null; in this case any namespace-sensitive content will throw an UnsupportedOperationException.
Throws:
ValidationException - if the content is invalid
java.lang.UnsupportedOperationException - if the type is namespace-sensitive and no namespace resolver is supplied

getTypedValue

public SequenceIterator getTypedValue(java.lang.CharSequence value,
                                      NamespaceResolver resolver)
                               throws ValidationException
Get the typed value corresponding to a given string value, assuming it is valid against this type

Specified by:
getTypedValue in class SimpleType
Parameters:
value - the string value
resolver -
Returns:
an iterator over the atomic sequence comprising the typed value
ValidationException

getSuperType

public ItemType getSuperType()
Get the type from which this item type is derived by restriction. This is the supertype in the XPath type heirarchy, as distinct from the Schema base type: this means that the supertype of xs:boolean is xdt:anyAtomicType, whose supertype is item() (rather than xs:anySimpleType).

Specified by:
getSuperType in interface ItemType
Returns:
the supertype, or null if this type is item()

getPrimitiveItemType

public ItemType getPrimitiveItemType()
Get the primitive type from which this type is derived. For the definition of primitive types, see Type.isPrimitiveType(int)

Specified by:
getPrimitiveItemType in interface ItemType
Returns:
the type code of the primitive type

getPrimitiveType

public int getPrimitiveType()
Get the primitive type from which this type is derived. For the definition of primitive types, see Type.isPrimitiveType(int)

Specified by:
getPrimitiveType in interface ItemType
Returns:
the type code of the primitive type

getAtomizedItemType

public AtomicType getAtomizedItemType()
Get the item type of the atomic values that will be produced when an item of this type is atomized

Specified by:
getAtomizedItemType in interface ItemType

toString

public java.lang.String toString()
Produce string representation for use in diagnostic output

Overrides:
toString in class java.lang.Object

toString

public java.lang.String toString(NamePool pool)
Display the type descriptor for diagnostics

Specified by:
toString in interface ItemType

relationshipTo

public int relationshipTo(SchemaType other)
Determine the relationship of this schema type to another schema type.

Specified by:
relationshipTo in class SchemaType
Parameters:
other - the other schema type
Returns:
Type.SAME_TYPE if the types are the same; Type.SUBSUMES if the first type subsumes the second (that is, all instances of the second type are also instances of the first); Type.SUBSUMED_BY if the second type subsumes the first; Type.OVERLAPS if the two types overlap (have a non-empty intersection); Type.DISJOINT if the two types are disjoint (have an empty intersection)

hashCode

public int hashCode()
Returns a hash code value for the object.

Overrides:
hashCode in class java.lang.Object