com.hp.hpl.jena.enhanced
Class EnhNode

java.lang.Object
  extended bycom.hp.hpl.jena.enhanced.Polymorphic
      extended bycom.hp.hpl.jena.enhanced.EnhNode

public class EnhNode
extends Polymorphic

A specialisation of Polymorphic that models an extended node in a an extended graph. An extended node wraps a normal node, and adds additional convenience access or user affordances, though the state remains in the graph itself.

Author:
Jeremy Carroll (original code)
Chris Dollin (original code)
Ian Dickinson (refactoring and commentage)

Constructor Summary
EnhNode(Node n, EnhGraph g)
           
 
Method Summary
 RDFNode as(java.lang.Class t)
          allow subclasses to implement RDFNode & its subinterface
 Node asNode()
          Answer the graph node that this enhanced node wraps
 boolean canAs(java.lang.Class t)
          API-level method for polymorphic testing
 boolean equals(java.lang.Object o)
          An enhanced node is equal to another node n iff: n is identical to this n has a facets map that is identical to the facets map on this the underlying nodes are equal This is deemed to be a complete and correct interpretation of enhanced node equality, which is why this method has been marked final.
 EnhGraph getGraph()
          Answer the graph containing this node
 int hashCode()
          The hash code of an enhanced node is defined to be the same as the underlying node.
 boolean isValid()
          answer true iff this enhanced node is still underpinned in the graph by triples appropriate to its type.
 EnhNode viewAs(java.lang.Class t)
          Answer a facet of this node, where that facet is denoted by the given type.
 
Methods inherited from class com.hp.hpl.jena.enhanced.Polymorphic
addView, supports
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EnhNode

public EnhNode(Node n,
               EnhGraph g)
Method Detail

asNode

public Node asNode()
Answer the graph node that this enhanced node wraps

Returns:
A plain node

getGraph

public EnhGraph getGraph()
Answer the graph containing this node

Returns:
An enhanced graph

viewAs

public EnhNode viewAs(java.lang.Class t)
Answer a facet of this node, where that facet is denoted by the given type.

Parameters:
t - A type denoting the desired facet of the underlying node
Returns:
An enhanced nodet that corresponds to t; this may be this Java object, or a different object.

as

public RDFNode as(java.lang.Class t)
allow subclasses to implement RDFNode & its subinterface


canAs

public boolean canAs(java.lang.Class t)
API-level method for polymorphic testing


hashCode

public final int hashCode()
The hash code of an enhanced node is defined to be the same as the underlying node.

Returns:
The hashcode as an int

equals

public final boolean equals(java.lang.Object o)
An enhanced node is equal to another node n iff: This is deemed to be a complete and correct interpretation of enhanced node equality, which is why this method has been marked final.

Specified by:
equals in class Polymorphic
Parameters:
o - An object to test for equality with this node
Returns:
True if o is equal to this node.

isValid

public boolean isValid()
Description copied from class: Polymorphic
answer true iff this enhanced node is still underpinned in the graph by triples appropriate to its type.

Specified by:
isValid in class Polymorphic


Copyright © 2001-2003 Hewlett-Packard. All Rights Reserved.