FileDocCategorySizeDatePackage
CMNodeFactory.javaAPI DocJava SE 5 API8228Fri Aug 26 14:55:50 BST 2005com.sun.org.apache.xerces.internal.impl.xs.models

CMNodeFactory

public class CMNodeFactory extends Object

Creates nodes.

author
Neeraj Bajaj
version
$Revision: 1.2 $, $Date: 2004/01/22 20:36:54 $

Fields Summary
private static final String
ERROR_REPORTER
Property identifier: error reporter.
private static final boolean
DEBUG

Output extra debugging messages to {@link System.err}.

private int
nodeCount

Count of number of nodes created.

private XMLErrorReporter
fErrorReporter
Error reporter. This property identifier is: http://apache.org/xml/properties/internal/error-reporter
Constructors Summary
public CMNodeFactory()
Default constructor.

    
           
      

        if (DEBUG) {
            System.err.println("CMNodeFactory()");
        }
    
Methods Summary
public com.sun.org.apache.xerces.internal.impl.dtd.models.CMNodegetCMBinOpNode(int type, com.sun.org.apache.xerces.internal.impl.dtd.models.CMNode leftNode, com.sun.org.apache.xerces.internal.impl.dtd.models.CMNode rightNode)

Create a leaf node as defined by the params.

param
type Type of node to create.
param
leftNode Left node.
param
rightNode Right node.
return
New node as defined by the params.


        // this is a new node
        nodeCount++;

        if (DEBUG) {
            System.err.println("CMNodeFactory#getCMBinOpNode("
            + "type[" + type + "], "
            + "leftNode[" + leftNode.toString() + "], "
            + "rightNode[" + rightNode.toString() + "])\n"
            + "\tnodeCount=" + nodeCount);
        }
        
        // create new node as defined by the params
        return new XSCMBinOp(type, leftNode, rightNode);
    
public com.sun.org.apache.xerces.internal.impl.dtd.models.CMNodegetCMLeafNode(int type, java.lang.Object leaf, int id, int position)

Create a new leaf node as defined by the params.

param
type Type of leaf node to return.
param
leaf Leaf Object
param
id ID of leaf to return.
param
position Position of leaf to return.
return
New node as defined by the params.

        
        // this is a new node
        nodeCount++;

        if (DEBUG) {
            System.err.println("CMNodeFactory#getCMLeafNode("
            + "type[" + type + "], "
            + "leaf[" + leaf.toString() + "], "
            + "id[" + id + "], "
            + "position[" + position + "])\n"
            + "\tnodeCount=" + nodeCount);
        }
                
        // create new node as defined by the params
        return new XSCMLeaf(type, leaf, id, position);
    
public com.sun.org.apache.xerces.internal.impl.dtd.models.CMNodegetCMUniOpNode(int type, com.sun.org.apache.xerces.internal.impl.dtd.models.CMNode childNode)

Create a leaf node as defined by the params.

param
type Type of node to create.
param
childNode Child node.
return
New node as defined by the params.


        // this is a new node
        nodeCount++;

        if (DEBUG) {
            System.err.println("CMNodeFactory#getCMUniOpNode("
            + "type[" + type + "], "
            + "childNode[" + childNode.toString() + "])\n"
            + "\tnodeCount=" + nodeCount);
        }
        
        // create new node as defined by the params
        return new XSCMUniOp(type, childNode);
    
public voidreset(com.sun.org.apache.xerces.internal.xni.parser.XMLComponentManager componentManager)

Reset internal state using componentManager provided values.

param
componentManager {@link XMLComponentManager} to provide new values for internal state.

        
        if (DEBUG) {
            System.err.println("CMNodeFactory#reset("
            + "componentManager[" + componentManager.toString() + "])");
        }

        // error reporter
        fErrorReporter = (XMLErrorReporter) componentManager.getProperty(ERROR_REPORTER);
    
public voidresetNodeCount()

Reset the internal node count to 0.

        nodeCount = 0;
        
        if (DEBUG) {
            System.err.println("CMNodeFactory#resetNodeCount: "
                + "nodeCount=" + nodeCount + " (after reset)");
        }
    
public voidsetProperty(java.lang.String propertyId, java.lang.Object value)

Sets the value of a property. This method is called by the component manager any time after reset when a property changes value.

Note: Components should silently ignore properties that do not affect the operation of the component.

param
propertyId The property identifier.
param
value The value of the property.

        
        if (DEBUG) {
            System.err.println("CMNodeFactory#setProperty("
            + "propertyId[" + propertyId + "], "
            + "value[" + value.toString() + "])");
        }

        // Xerces properties?
        if (propertyId.startsWith(Constants.XERCES_PROPERTY_PREFIX)) {
            String property = propertyId.substring(Constants.XERCES_PROPERTY_PREFIX.length());
                        
            // error reporter?
            if (property.equals(Constants.ERROR_REPORTER_PROPERTY)) {
                fErrorReporter = (XMLErrorReporter) value;
                return;
            }
            
            // silently ignore unknown Xerces property
            return;
        } else {
            // silently ignore unknown non-Xerces property
            return;
        }