org.semanticweb.owlapi.reasoner.impl
Class DefaultNodeSet<E extends OWLObject>

java.lang.Object
  extended by org.semanticweb.owlapi.reasoner.impl.DefaultNodeSet<E>
All Implemented Interfaces:
java.lang.Iterable<Node<E>>, NodeSet<E>
Direct Known Subclasses:
OWLClassNodeSet, OWLDataPropertyNodeSet, OWLDatatypeNodeSet, OWLNamedIndividualNodeSet, OWLObjectPropertyNodeSet

public abstract class DefaultNodeSet<E extends OWLObject>
extends java.lang.Object
implements NodeSet<E>

Author: Matthew Horridge
The University of Manchester
Information Management Group
Date: 05-Dec-2009


Constructor Summary
DefaultNodeSet()
           
DefaultNodeSet(E entity)
           
DefaultNodeSet(Node<E> node)
           
DefaultNodeSet(java.util.Set<Node<E>> nodes)
           
 
Method Summary
 void addAllNodes(java.util.Collection<Node<E>> nodes)
          Adds a collection of Nodes to this set.
 void addDifferentEntities(java.util.Set<E> entities)
          Adds the specified entities as Nodes to this set.
 void addEntity(E entity)
          Adds an entity to this NodeSet by wrapping it in a Node.
 void addNode(Node<E> node)
          Adds a Node to this set.
 void addSameEntities(java.util.Set<E> entities)
          Adds the set of entities as a Node to this set.
 boolean containsEntity(E e)
          A convenience method that determines if this NodeSet contains a specific entity.
 java.util.Set<E> getFlattened()
          A convenience method that gets all of the entities contained in the Nodes in this NodeSet.
protected abstract  DefaultNode<E> getNode(E entity)
           
protected abstract  DefaultNode<E> getNode(java.util.Set<E> entities)
           
 java.util.Set<Node<E>> getNodes()
          Gets the Nodes contained in this NodeSet
 boolean isBottomSingleton()
          Determies if this NodeSet is a singleton that only contains the bottom node (in a hierarchy).
 boolean isEmpty()
           
 boolean isSingleton()
          Determines if this NodeSet is a singleton.
 boolean isTopSingleton()
          Determines if this NodeSet is a singleton node that only contains the top node (in a hierarchy).
 java.util.Iterator<Node<E>> iterator()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultNodeSet

public DefaultNodeSet()

DefaultNodeSet

public DefaultNodeSet(E entity)

DefaultNodeSet

public DefaultNodeSet(Node<E> node)

DefaultNodeSet

public DefaultNodeSet(java.util.Set<Node<E>> nodes)
Method Detail

getNodes

public java.util.Set<Node<E>> getNodes()
Description copied from interface: NodeSet
Gets the Nodes contained in this NodeSet

Specified by:
getNodes in interface NodeSet<E extends OWLObject>
Returns:
The set of Nodes contained in this NodeSet. Note that this set will be an unmodifiable set.

addEntity

public void addEntity(E entity)
Adds an entity to this NodeSet by wrapping it in a Node.

Parameters:
entity - The entity to be added. The entity will be wrapped in the Node and the Node added to this set. Must not be null.
Throws:
java.lang.NullPointerException - if entity is null.

addNode

public void addNode(Node<E> node)
Adds a Node to this set.

Parameters:
node - The Node to be added.
Throws:
java.lang.NullPointerException - if entity is null.

addAllNodes

public void addAllNodes(java.util.Collection<Node<E>> nodes)
Adds a collection of Nodes to this set.

Parameters:
nodes - The Nodes to be added. Note that if the collection is not a set then duplicate Nodes will be filtered out.

addSameEntities

public void addSameEntities(java.util.Set<E> entities)
Adds the set of entities as a Node to this set.

Parameters:
entities - The set of entities to be added. The entities will be wrapped in a Node which will be added to this NodeSet.

addDifferentEntities

public void addDifferentEntities(java.util.Set<E> entities)
Adds the specified entities as Nodes to this set.

Parameters:
entities - The entities to be added. Each entity will be wrapped in a Node which will then be added to this NodeSet.

getNode

protected abstract DefaultNode<E> getNode(E entity)

getNode

protected abstract DefaultNode<E> getNode(java.util.Set<E> entities)

getFlattened

public java.util.Set<E> getFlattened()
Description copied from interface: NodeSet
A convenience method that gets all of the entities contained in the Nodes in this NodeSet.

Specified by:
getFlattened in interface NodeSet<E extends OWLObject>
Returns:
The union of the entities contained in the Nodes in this NodeSet.

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface NodeSet<E extends OWLObject>

containsEntity

public boolean containsEntity(E e)
Description copied from interface: NodeSet
A convenience method that determines if this NodeSet contains a specific entity.

Specified by:
containsEntity in interface NodeSet<E extends OWLObject>
Parameters:
e - The entity to test for
Returns:
true if this NodeSet contains a Node that contains the entity, e, and false if this NodeSet does not contain a Node that contains the entity, e.

isSingleton

public boolean isSingleton()
Description copied from interface: NodeSet
Determines if this NodeSet is a singleton. A NodeSet is a singleton if it contains only one Node.

Specified by:
isSingleton in interface NodeSet<E extends OWLObject>
Returns:
true if this NodeSet is a singleton, otherwise false.

isTopSingleton

public boolean isTopSingleton()
Description copied from interface: NodeSet
Determines if this NodeSet is a singleton node that only contains the top node (in a hierarchy).

Specified by:
isTopSingleton in interface NodeSet<E extends OWLObject>
Returns:
true if this NodeSet is a singleton that contains only the top node, and false otherwise.
See Also:
Node#isTopNode()}

isBottomSingleton

public boolean isBottomSingleton()
Description copied from interface: NodeSet
Determies if this NodeSet is a singleton that only contains the bottom node (in a hierarchy).

Specified by:
isBottomSingleton in interface NodeSet<E extends OWLObject>
Returns:
true if this NodeSet is a singleton that only contains a node that is the bottom node, otherwise false
See Also:
Node#isBottomNode()}

iterator

public java.util.Iterator<Node<E>> iterator()
Specified by:
iterator in interface java.lang.Iterable<Node<E extends OWLObject>>