FileDocCategorySizeDatePackage
XSCMLeaf.javaAPI DocApache Xerces 3.0.13514Fri Sep 14 20:33:56 BST 2007org.apache.xerces.impl.xs.models

XSCMLeaf

public class XSCMLeaf extends org.apache.xerces.impl.dtd.models.CMNode
Content model leaf node.
xerces.internal
author
Neil Graham, IBM
version
$Id: XSCMLeaf.java 572112 2007-09-02 19:11:51Z mrglavas $

Fields Summary
private final Object
fLeaf
This is the leaf: element decl or wildcard decl.
private int
fParticleId
Identify the particle: for UPA checking
private int
fPosition
Part of the algorithm to convert a regex directly to a DFA numbers each leaf sequentially. If its -1, that means its an epsilon node. Zero and greater are non-epsilon positions.
Constructors Summary
public XSCMLeaf(int type, Object leaf, int id, int position)
Constructs a content model leaf.


    //
    // Constructors
    //

          
              
        super(type);

        // Store the element index and position
        fLeaf = leaf;
        fParticleId = id;
        fPosition = position;
    
Methods Summary
protected voidcalcFirstPos(org.apache.xerces.impl.dtd.models.CMStateSet toSet)

        // If we are an epsilon node, then the first pos is an empty set
        if (fPosition == -1)
            toSet.zeroBits();

        // Otherwise, its just the one bit of our position
        else
            toSet.setBit(fPosition);
    
protected voidcalcLastPos(org.apache.xerces.impl.dtd.models.CMStateSet toSet)

        // If we are an epsilon node, then the last pos is an empty set
        if (fPosition == -1)
            toSet.zeroBits();

        // Otherwise, its just the one bit of our position
        else
            toSet.setBit(fPosition);
    
final java.lang.ObjectgetLeaf()

        return fLeaf;
    
final intgetParticleId()

        return fParticleId;
    
final intgetPosition()

        return fPosition;
    
public booleanisNullable()

        // Leaf nodes are never nullable unless its an epsilon node
        return (fPosition == -1);
    
final voidsetPosition(int newPosition)

        fPosition = newPosition;
    
public java.lang.StringtoString()

        StringBuffer strRet = new StringBuffer(fLeaf.toString());
        if (fPosition >= 0) {
            strRet.append(" (Pos:")
                  .append(Integer.toString(fPosition))
                  .append(')");
        }
        return strRet.toString();