story.dbcore.nodes
Class GenericNode

java.lang.Object
  extended by story.dbcore.nodes.GenericNode
All Implemented Interfaces:
RenderableObject
Direct Known Subclasses:
InstanceNode

public class GenericNode
extends java.lang.Object
implements RenderableObject

GenericNode is an abstract class that provides common functionality for all types of Nodes. No actual types of Nodes are a part of the db-core. The applications on top (flashback, scheherazade, etc) have classes that extend GenericNode.


Field Summary
static AttributeID ATT_EXPANSION
           
static AttributeID ATT_SUBNODETYPE_ID
           
 
Constructor Summary
GenericNode(Document doc, NodeRepository parentRepository, NodeConfig config, LinkRepository linkRepository)
           
 
Method Summary
 NodeAddress address()
          Make a new NodeAddress with the node
 boolean attributeEquals(AttributeID attribute, AttributeValue other, boolean overrideInheritance)
          Determine whether an attribute is equal to some constant value.
 boolean attributeGreaterThan(AttributeID attribute, AttributeValue other, boolean overrideInheritance)
          Determine whether an attribute is greater than to some constant value.
 boolean attributeModified(AttributeID attribute)
          Determine whether an attribute has been modified from its default value.
 boolean directlyLinkedFrom(GenericNode from, LinkType linkType)
          Get the number of nodes this one is linked from.
 boolean directlyLinkedFrom(GenericNode from, LinkType linkType, LinkLabelAddress label)
          Get the number of nodes this one is linked from.
 boolean directlyLinksTo(GenericNode to, LinkType linkType)
          Test whether this node directly links to another node by a certain link type by any label.
 boolean directlyLinksTo(GenericNode to, LinkType linkType, LinkLabelAddress label)
          Test whether this node directly links to another node by a certain link type and a certain label.
 void enableAttributeInheritance(Document doc, LinkProperties linkProperties)
          Set pointers to the Document and the LinkProperties objects in the AttributeSet so it can implement attribute inheritance.
 java.util.Iterator getAttributeIDs()
          Return an iterator over all the AttributeIDs of the node's attributes.
 AttributeValue getAttributeValue(AttributeID attribute, boolean overrideInheritance)
          Retrieve the value of a particular attribute of the node.
 DocumentID getDocument()
          Retrieve the ID of this node's Document.
 NodeID getID()
          Return the node's identifier.
 int getMaxAttributeLength(AttributeID attribute)
          Returns the "maximum" length of the acceptable value for an attribute.
 NodeProxy getProxy()
           
 WritableRelatedNodes getRelatedNodes(LinkType linkType, LinkDirection linkDirection)
          Get the WritableRelatedNodes for this node's outward links to all other nodes.
 NodeRepositoryID getRepository()
          Retrieve the ID of this node's repository.
 NodeType getType()
          Return the node's type.
 boolean isRelatedTo(GenericNode to, LinkType linkType)
          Tests for inferred relatedness -- this is very slow compared to directlyLinkedTo and directlyLinkedFrom.
 int numNodesLinkedFrom(LinkType linkType)
          Test whether this node is directly linked to by another node by a certain link type by any label.
 int numNodesLinksTo(LinkType linkType)
          Get the number of nodes this one links to.
 java.lang.StringBuffer render()
           
 java.lang.StringBuffer renderAllInformation()
          Render all the information about this node.
 java.lang.StringBuffer renderAttributes()
          Render as a table all the attributes of the node.
 AttributeValue setAttribute(AttributeID ID, AttributeValue value)
          Set an attribute of the node
 void setRepository(NodeRepository parentRepository)
          Set the repository in which this node now resides
 void unlinkLinkFrom(GenericNode from, LinkType linkType, LinkLabelAddress label)
          Unlink a particular incoming link from another node to this one.
 void unlinkLinksFrom(GenericNode from, LinkType linkType)
          Unlink all incoming links from another node to this one.
 void unlinkLinksTo(GenericNode to, LinkType linkType)
          Unlink all outgoing links from this node to another.
 void unlinkLinkTo(GenericNode to, LinkType linkType, LinkLabelAddress label)
          Unlink a particular outgoing link from this node to another.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ATT_EXPANSION

public static final AttributeID ATT_EXPANSION

ATT_SUBNODETYPE_ID

public static final AttributeID ATT_SUBNODETYPE_ID
Constructor Detail

GenericNode

public GenericNode(Document doc,
                   NodeRepository parentRepository,
                   NodeConfig config,
                   LinkRepository linkRepository)
            throws Scheherexception
Throws:
Scheherexception
Method Detail

getRelatedNodes

public WritableRelatedNodes getRelatedNodes(LinkType linkType,
                                            LinkDirection linkDirection)
                                     throws Scheherexception
Get the WritableRelatedNodes for this node's outward links to all other nodes. Do NOT pass this object around! It should only be used by LinkRepository (TODO: enforcement by rearranging DB-CORE's package structure). Other classes can see the read-only RelatedNodes.

Throws:
Scheherexception

getProxy

public NodeProxy getProxy()
                   throws Scheherexception
Throws:
Scheherexception

directlyLinksTo

public boolean directlyLinksTo(GenericNode to,
                               LinkType linkType)
                        throws Scheherexception
Test whether this node directly links to another node by a certain link type by any label.

Throws:
Scheherexception

directlyLinksTo

public boolean directlyLinksTo(GenericNode to,
                               LinkType linkType,
                               LinkLabelAddress label)
                        throws Scheherexception
Test whether this node directly links to another node by a certain link type and a certain label.

Throws:
Scheherexception

isRelatedTo

public boolean isRelatedTo(GenericNode to,
                           LinkType linkType)
                    throws Scheherexception
Tests for inferred relatedness -- this is very slow compared to directlyLinkedTo and directlyLinkedFrom.

Throws:
Scheherexception

numNodesLinksTo

public int numNodesLinksTo(LinkType linkType)
                    throws Scheherexception
Get the number of nodes this one links to.

Throws:
Scheherexception

directlyLinkedFrom

public boolean directlyLinkedFrom(GenericNode from,
                                  LinkType linkType)
                           throws Scheherexception
Get the number of nodes this one is linked from.

Throws:
Scheherexception

directlyLinkedFrom

public boolean directlyLinkedFrom(GenericNode from,
                                  LinkType linkType,
                                  LinkLabelAddress label)
                           throws Scheherexception
Get the number of nodes this one is linked from.

Throws:
Scheherexception

numNodesLinkedFrom

public int numNodesLinkedFrom(LinkType linkType)
                       throws Scheherexception
Test whether this node is directly linked to by another node by a certain link type by any label.

Throws:
Scheherexception

unlinkLinkTo

public void unlinkLinkTo(GenericNode to,
                         LinkType linkType,
                         LinkLabelAddress label)
                  throws Scheherexception
Unlink a particular outgoing link from this node to another.

Throws:
Scheherexception

unlinkLinkFrom

public void unlinkLinkFrom(GenericNode from,
                           LinkType linkType,
                           LinkLabelAddress label)
                    throws Scheherexception
Unlink a particular incoming link from another node to this one.

Throws:
Scheherexception

unlinkLinksTo

public void unlinkLinksTo(GenericNode to,
                          LinkType linkType)
                   throws Scheherexception
Unlink all outgoing links from this node to another.

Throws:
Scheherexception

unlinkLinksFrom

public void unlinkLinksFrom(GenericNode from,
                            LinkType linkType)
                     throws Scheherexception
Unlink all incoming links from another node to this one.

Throws:
Scheherexception

setRepository

public void setRepository(NodeRepository parentRepository)
                   throws Scheherexception
Set the repository in which this node now resides

Throws:
Scheherexception

enableAttributeInheritance

public void enableAttributeInheritance(Document doc,
                                       LinkProperties linkProperties)
Set pointers to the Document and the LinkProperties objects in the AttributeSet so it can implement attribute inheritance.


getType

public NodeType getType()
Return the node's type.


getID

public NodeID getID()
             throws Scheherexception
Return the node's identifier.

Throws:
Scheherexception

getRepository

public NodeRepositoryID getRepository()
                               throws Scheherexception
Retrieve the ID of this node's repository.

Throws:
Scheherexception

address

public NodeAddress address()
                    throws Scheherexception
Make a new NodeAddress with the node

Throws:
Scheherexception

getDocument

public DocumentID getDocument()
Retrieve the ID of this node's Document.


setAttribute

public AttributeValue setAttribute(AttributeID ID,
                                   AttributeValue value)
                            throws Scheherexception
Set an attribute of the node

Throws:
Scheherexception

getAttributeValue

public AttributeValue getAttributeValue(AttributeID attribute,
                                        boolean overrideInheritance)
                                 throws Scheherexception
Retrieve the value of a particular attribute of the node.

Throws:
Scheherexception

getAttributeIDs

public java.util.Iterator getAttributeIDs()
                                   throws Scheherexception
Return an iterator over all the AttributeIDs of the node's attributes.

Throws:
Scheherexception

attributeEquals

public boolean attributeEquals(AttributeID attribute,
                               AttributeValue other,
                               boolean overrideInheritance)
                        throws Scheherexception
Determine whether an attribute is equal to some constant value.

Throws:
Scheherexception

attributeModified

public boolean attributeModified(AttributeID attribute)
                          throws Scheherexception
Determine whether an attribute has been modified from its default value.

Throws:
Scheherexception

getMaxAttributeLength

public int getMaxAttributeLength(AttributeID attribute)
                          throws Scheherexception
Returns the "maximum" length of the acceptable value for an attribute. (Note: It is up to the attribute itself to enforce these values; enforcement is not done here.)

Throws:
Scheherexception

attributeGreaterThan

public boolean attributeGreaterThan(AttributeID attribute,
                                    AttributeValue other,
                                    boolean overrideInheritance)
                             throws Scheherexception
Determine whether an attribute is greater than to some constant value.

Throws:
Scheherexception

render

public java.lang.StringBuffer render()
                              throws Scheherexception
Specified by:
render in interface RenderableObject
Throws:
Scheherexception

renderAllInformation

public java.lang.StringBuffer renderAllInformation()
                                            throws Scheherexception
Render all the information about this node.

Throws:
Scheherexception

renderAttributes

public java.lang.StringBuffer renderAttributes()
                                        throws Scheherexception
Render as a table all the attributes of the node.

Throws:
Scheherexception


Copyright © 2011 David K. Elson. All Rights Reserved.