java.lang.Object
com.aendvari.common.model.osm.OsmModelNode
- All Implemented Interfaces:
- com.aendvari.common.model.ModelNode
- public class OsmModelNode
- extends java.lang.Object
- implements com.aendvari.common.model.ModelNode
An OSM implementation of the com.aendvari.common.model.ModelNode interface.
modelNode
protected com.aendvari.common.osm.OsmNode modelNode
- The OsmNode
OsmModelNode
protected OsmModelNode()
- Constructs an
OsmModelNode instance.
OsmModelNode
protected OsmModelNode(com.aendvari.common.osm.OsmNode setModelNode)
- Constructs an
OsmModelNode instance wrapping the supplied com.aendvari.common.osm.OsmNode.
setOsmNode
public void setOsmNode(com.aendvari.common.osm.OsmNode setModelNode)
- Sets the internal com.aendvari.common.osm.OsmNode object wrapped by this com.aendvari.common.model.ModelNode.
getOsmNode
public com.aendvari.common.osm.OsmNode getOsmNode()
- Returns the internal com.aendvari.common.osm.OsmNode object wrapped by this com.aendvari.common.model.ModelNode.
getOwnerModelTree
public com.aendvari.common.model.ModelTree getOwnerModelTree()
- Returns the instance of com.aendvari.common.model.ModelTree from which the com.aendvari.common.model.ModelNode is within.
- Specified by:
getOwnerModelTree in interface com.aendvari.common.model.ModelNode
getNodeValue
public java.lang.String getNodeValue()
- Returns the value of the node.
- Specified by:
getNodeValue in interface com.aendvari.common.model.ModelNode
setNodeValue
public void setNodeValue(java.lang.String value)
- Sets the value of the node.
- Specified by:
setNodeValue in interface com.aendvari.common.model.ModelNode
getNodeName
public java.lang.String getNodeName()
- Returns the name of this node.
- Specified by:
getNodeName in interface com.aendvari.common.model.ModelNode
getNodePath
public java.lang.String getNodePath()
- Returns a string representation of the node's position in the hierarchy.
- Specified by:
getNodePath in interface com.aendvari.common.model.ModelNode
getAttributes
public java.util.Map getAttributes()
- Returns the attributes of this node.
- Specified by:
getAttributes in interface com.aendvari.common.model.ModelNode
getAttribute
public java.lang.String getAttribute(java.lang.String name)
- Returns the string value of the specified attribute.
- Specified by:
getAttribute in interface com.aendvari.common.model.ModelNode
setAttribute
public void setAttribute(java.lang.String name,
java.lang.String value)
- Sets the string value of the attribute.
- Specified by:
setAttribute in interface com.aendvari.common.model.ModelNode
getParentNode
public com.aendvari.common.model.ModelNode getParentNode()
- The parent of this node. All nodes, except the root (com.aendvari.common.model.ModelNode)
node may have a parent. If a node has just been created and not yet added to the tree, or if
it has been removed from the tree, this is null.
- Specified by:
getParentNode in interface com.aendvari.common.model.ModelNode
getFirstChild
public com.aendvari.common.model.ModelNode getFirstChild()
- The first child of this node. If there is no such node, this returns null.
- Specified by:
getFirstChild in interface com.aendvari.common.model.ModelNode
getLastChild
public com.aendvari.common.model.ModelNode getLastChild()
- The last child of this node. If there is no such node, this returns null.
- Specified by:
getLastChild in interface com.aendvari.common.model.ModelNode
getPreviousSibling
public com.aendvari.common.model.ModelNode getPreviousSibling()
- The node immediately preceding this node. If there is no such node,
this returns null.
- Specified by:
getPreviousSibling in interface com.aendvari.common.model.ModelNode
getNextSibling
public com.aendvari.common.model.ModelNode getNextSibling()
- The node immediately following this node. If there is no such node,
this returns null.
- Specified by:
getNextSibling in interface com.aendvari.common.model.ModelNode
getChildNodes
public java.util.List getChildNodes()
- Returns an
Iterator of com.aendvari.common.model.ModelNode's using the path provided.
- Specified by:
getChildNodes in interface com.aendvari.common.model.ModelNode
hasChildNodes
public boolean hasChildNodes()
- Returns whether this node has any children.
- Specified by:
hasChildNodes in interface com.aendvari.common.model.ModelNode
appendChild
public com.aendvari.common.model.ModelNode appendChild(com.aendvari.common.model.ModelNode newChild)
- Adds the node
newChild to the end of the list of children of this node.
If the newChild is already in the tree, it is first removed.
- Specified by:
appendChild in interface com.aendvari.common.model.ModelNode
insertBefore
public com.aendvari.common.model.ModelNode insertBefore(com.aendvari.common.model.ModelNode newChild,
com.aendvari.common.model.ModelNode refChild)
- Inserts the node
newChild before the existing child node refChild.
If refChild is null, newChild is inserted at the end of the list
of children. If the newChild is already in the tree, it is first removed.
- Specified by:
insertBefore in interface com.aendvari.common.model.ModelNode
replaceChild
public com.aendvari.common.model.ModelNode replaceChild(com.aendvari.common.model.ModelNode newChild,
com.aendvari.common.model.ModelNode oldChild)
- Replaces the child node
oldChild with newChild, and returns
the oldChild node. If the newChild is already in the tree,
it is first removed.
- Specified by:
replaceChild in interface com.aendvari.common.model.ModelNode
removeChild
public com.aendvari.common.model.ModelNode removeChild(com.aendvari.common.model.ModelNode oldChild)
- Removes the child node indicated by
oldChild from the list of children,
and returns it.
- Specified by:
removeChild in interface com.aendvari.common.model.ModelNode
toString
public java.lang.String toString()
- Display the string value of the node.