FileDocCategorySizeDatePackage
IdentityConstraint.javaAPI DocJava SE 5 API9477Fri Aug 26 14:55:50 BST 2005com.sun.org.apache.xerces.internal.impl.xs.identity

IdentityConstraint

public abstract class IdentityConstraint extends Object implements XSIDCDefinition
Base class of Schema identity constraint.
author
Andy Clark, IBM
version
$Id: IdentityConstraint.java,v 1.9 2003/11/11 20:14:59 sandygao Exp $

Fields Summary
protected short
type
type
protected String
fNamespace
target namespace
protected String
fIdentityConstraintName
Identity constraint name.
protected String
fElementName
name of owning element
protected Selector
fSelector
Selector.
protected int
fFieldCount
Field count.
protected Field[]
fFields
Fields.
protected XSAnnotationImpl[]
fAnnotations
protected int
fNumAnnotations
Constructors Summary
protected IdentityConstraint(String namespace, String identityConstraintName, String elemName)
Default constructor.


    //
    // Constructors
    //

       
           
        fNamespace = namespace;
        fIdentityConstraintName = identityConstraintName;
        fElementName = elemName;
    
Methods Summary
public voidaddAnnotation(com.sun.org.apache.xerces.internal.impl.xs.XSAnnotationImpl annotation)

        if(annotation == null)
            return;
        if(fAnnotations == null) {
            fAnnotations = new XSAnnotationImpl[2];
        } else if(fNumAnnotations == fAnnotations.length) {
            XSAnnotationImpl[] newArray = new XSAnnotationImpl[fNumAnnotations << 1];
            System.arraycopy(fAnnotations, 0, newArray, 0, fNumAnnotations);
            fAnnotations = newArray;
        }
        fAnnotations[fNumAnnotations++] = annotation;
    
public voidaddField(com.sun.org.apache.xerces.internal.impl.xs.identity.Field field)
Adds a field.

        if (fFields == null)
            fFields = new Field[4];
        else if (fFieldCount == fFields.length)
            fFields = resize(fFields, fFieldCount*2);
        fFields[fFieldCount++] = field;
    
public booleanequals(com.sun.org.apache.xerces.internal.impl.xs.identity.IdentityConstraint id)

        boolean areEqual = fIdentityConstraintName.equals(id.fIdentityConstraintName);
        if(!areEqual) return false;
        areEqual = fSelector.toString().equals(id.fSelector.toString());
        if(!areEqual) return false;
        areEqual = (fFieldCount == id.fFieldCount);
        if(!areEqual) return false;
        for(int i=0; i<fFieldCount; i++)
            if(!fFields[i].toString().equals(id.fFields[i].toString())) return false;
        return true;
    
public com.sun.org.apache.xerces.internal.xs.XSObjectListgetAnnotations()
Optional. Annotation.

        return new XSObjectListImpl(fAnnotations, fNumAnnotations);
    
public shortgetCategory()
{identity-constraint category} One of key, keyref or unique.

        return type;
    
public java.lang.StringgetElementName()

        return fElementName;
    
public com.sun.org.apache.xerces.internal.impl.xs.identity.FieldgetFieldAt(int index)
Returns the field at the specified index.

        return fFields[index];
    
public intgetFieldCount()
Returns the field count.

        return fFieldCount;
    
public com.sun.org.apache.xerces.internal.xs.StringListgetFieldStrs()
{fields} A non-empty list of restricted XPath ([XPath]) expressions.

        String[] strs = new String[fFieldCount];
        for (int i = 0; i < fFieldCount; i++)
            strs[i] = fFields[i].toString();
        return new StringListImpl(strs, fFieldCount);
    
public java.lang.StringgetIdentityConstraintName()
Returns the identity constraint name.

        return fIdentityConstraintName;
    
public java.lang.StringgetName()
The name of this XSObject depending on the XSObject type.

        return fIdentityConstraintName;
    
public java.lang.StringgetNamespace()
The namespace URI of this node, or null if it is unspecified. defines how a namespace URI is attached to schema components.

        return fNamespace;
    
public com.sun.org.apache.xerces.internal.xs.XSNamespaceItemgetNamespaceItem()

see
com.sun.org.apache.xerces.internal.xs.XSObject#getNamespaceItem()

        // REVISIT: implement
		return null;
	
public com.sun.org.apache.xerces.internal.xs.XSIDCDefinitiongetRefKey()
{referenced key} Required if {identity-constraint category} is keyref, forbidden otherwise. An identity-constraint definition with {identity-constraint category} equal to key or unique.

        return null;
    
public com.sun.org.apache.xerces.internal.impl.xs.identity.SelectorgetSelector()
Returns the selector.

        return fSelector;
    
public java.lang.StringgetSelectorStr()
{selector} A restricted XPath ([XPath]) expression

        return fSelector.toString();
    
public shortgetType()
Get the type of the object, i.e ELEMENT_DECLARATION.

        return XSConstants.IDENTITY_CONSTRAINT;
    
static final com.sun.org.apache.xerces.internal.impl.xs.identity.Field[]resize(com.sun.org.apache.xerces.internal.impl.xs.identity.Field[] oldArray, int newSize)

        Field[] newArray = new Field[newSize];
        System.arraycopy(oldArray, 0, newArray, 0, oldArray.length);
        return newArray;
    
public voidsetSelector(com.sun.org.apache.xerces.internal.impl.xs.identity.Selector selector)
Sets the selector.

        fSelector = selector;
    
public java.lang.StringtoString()
Returns a string representation of this object.

        String s = super.toString();
        int index1 = s.lastIndexOf('$");
        if (index1 != -1) {
            return s.substring(index1 + 1);
        }
        int index2 = s.lastIndexOf('.");
        if (index2 != -1) {
            return s.substring(index2 + 1);
        }
        return s;