consciouscode.seedling
Class NodeLocation

java.lang.Object
  extended by consciouscode.seedling.NodeReference
      extended by consciouscode.seedling.NodeLocation

public class NodeLocation
extends NodeReference

Identifies the location of a node installed into a Seedling hierarchical container, by naming a child of a specific BranchNode. An instance does not necessarily identify an installed node, although the parent branch (if defined) must necessary exist.

As with superclass NodeReference, a NodeLocation is immutable. It's main properties are:

parentBranch
The node's immediate parent BranchNode. This can be used to access other Seedling nodes.
nodeName
The node's name, relative to the parent branch.
globalPath
A string denoting the location "all the way up" to the container's global root. This value is intended for debugging and logging, and cannot be used to traverse to the node.

Since RootNodes don't have (accessible) parents, their locations behave as follows:

MethodResult for RootNodes
NodeReference.available()this root
NodeReference.getBaseBranch()this root
NodeReference.getNodeName() NodePath.ROOT_NAME ("/")
NodeReference.getNodePath() NodePath.IDENTITY_PATH
getParentBranch()null
NodeReference.installed()this root
NodeReference.parent()null
NodeReference.required()this root
NodeReference.toLocalPath() NodePath.ROOT_PATH


Method Summary
static consciouscode.seedling.NodeLocation.RootLocation forRoot(RootNode root, String globalPath)
          NOT SUPPORTED FOR APPLICATION USE.
 String getGlobalPath()
          Returns this node location as a global path.
 BranchNode getParentBranch()
          Returns the parent branch of the identified node.
 
Methods inherited from class consciouscode.seedling.NodeReference
available, child, equals, forBranch, forChild, forParts, forPath, forPath, from, fromChild, fromParts, fromPath, fromPath, getBaseBranch, getInstalledNode, getLocalPath, getLocalRoot, getNode, getNodeName, getNodePath, getPath, installed, isRoot, parent, parts, path, path, required, toLocalPath, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

forRoot

public static consciouscode.seedling.NodeLocation.RootLocation forRoot(RootNode root,
                                                                       String globalPath)
NOT SUPPORTED FOR APPLICATION USE.


getParentBranch

public BranchNode getParentBranch()
Returns the parent branch of the identified node.

Returns:
the branch that contains the referenced node; null if the reference is to a RootNode.

getGlobalPath

public final String getGlobalPath()
Returns this node location as a global path. Global paths are for display purposes, and cannot be used to traverse a Seedling hierarchy.

Returns:
a non-empty path.


Copyright © 2001–2012 Todd V. Jonker. All Rights Reserved.