org.jplate.foundation.node.impl.defaults
Class DefaultNodeFactory<BC,LC>

java.lang.Object
  extended by org.jplate.foundation.node.impl.defaults.DefaultNodeFactory<BC,LC>
Type Parameters:
BC - Data contained at the branch level.
LC - Data contained at the leaf level.
All Implemented Interfaces:
NodeFactoryIfc<BC,LC>

public class DefaultNodeFactory<BC,LC>
extends java.lang.Object
implements NodeFactoryIfc<BC,LC>

Default implementation to create branch and leaf nodes.

Modifications:
    $Date: 2008-12-02 12:32:45 -0500 (Tue, 02 Dec 2008) $
    $Revision: 479 $
    $Author: sfloess $
    $HeadURL: https://jplate.svn.sourceforge.net/svnroot/jplate/trunk/src/dev/java/org/jplate/foundation/node/impl/defaults/DefaultNodeFactory.java $
    


Field Summary
private  ListFactoryIfc<NodeIfc<BC,LC>> _listFactory
          The factory that can create implementations of List to hold NodeIfc's.
private  org.apache.commons.logging.Log _log
          Used for logging.
 
Constructor Summary
DefaultNodeFactory()
          Default constructor.
DefaultNodeFactory(ListFactoryIfc<NodeIfc<BC,LC>> listFactory)
          Sets the list factory for creating child NodeIfc lists and the leaf node factory.
 
Method Summary
 BranchNodeIfc<BC,LC> createBranchNode()
          This will create a branch node who has no parent.
 BranchNodeIfc<BC,LC> createBranchNode(BranchNodeIfc<BC,LC> parent)
          This will create a branch node whose parent is parent.
 LeafNodeIfc<BC,LC> createLeafNode(BranchNodeIfc<BC,LC> parent)
          This will create a leaf node whose parent is parent.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_log

private final transient org.apache.commons.logging.Log _log
Used for logging.


_listFactory

private final ListFactoryIfc<NodeIfc<BC,LC>> _listFactory
The factory that can create implementations of List to hold NodeIfc's. Used by DefaultBranchNode's.

Constructor Detail

DefaultNodeFactory

public DefaultNodeFactory(ListFactoryIfc<NodeIfc<BC,LC>> listFactory)
Sets the list factory for creating child NodeIfc lists and the leaf node factory.

Parameters:
listFactory - Creates List's to hold child NodeIfc's.

DefaultNodeFactory

public DefaultNodeFactory()
Default constructor. The list factory used is UnsynchronizedLinkedListFactory *

Method Detail

createBranchNode

public BranchNodeIfc<BC,LC> createBranchNode(BranchNodeIfc<BC,LC> parent)
This will create a branch node whose parent is parent.

Specified by:
createBranchNode in interface NodeFactoryIfc<BC,LC>
Parameters:
parent - is the parent node.
Returns:
a new branch node.

createBranchNode

public BranchNodeIfc<BC,LC> createBranchNode()
This will create a branch node who has no parent.

Specified by:
createBranchNode in interface NodeFactoryIfc<BC,LC>
Returns:
a new branch node.

createLeafNode

public LeafNodeIfc<BC,LC> createLeafNode(BranchNodeIfc<BC,LC> parent)
This will create a leaf node whose parent is parent.

Specified by:
createLeafNode in interface NodeFactoryIfc<BC,LC>
Parameters:
parent - is the parent node.
Returns:
a new leaf node.