i3.dragos.gm.core
Class UnwrapTool

java.lang.Object
  extended by i3.dragos.gm.core.UnwrapTool

public class UnwrapTool
extends java.lang.Object

Utility class to simplify the unwrapping of layers created by a Wrapper.

Beyond simply removing all layers to yield a basic instance usable by the actual core GM implementation, it can also remove all layers up to a specified one, allowing you to class-cast the returned object and access any additional methods defined by this layer.

Author:
Thorsten Hermes <thermes@i3.informatik.rwth-aachen.de>

Constructor Summary
UnwrapTool()
           
 
Method Summary
static java.util.Collection<GraphEntity> unwrapAllGraphEntities(java.util.Collection<? extends GraphEntity> c)
          All graph entities in the given collection are unwrapped.
static java.util.Collection<GraphEntityClass> unwrapAllGraphEntityClasses(java.util.Collection<? extends GraphEntityClass> c)
          All graph entity classes in the given collection are unwrapped.
static Attribute unwrapAttribute(Attribute a)
          Completely removes all additional layers around an attribute.
static Attribute unwrapAttributeTill(Attribute a, java.lang.Class<?> c)
          Performs unwrapping until an instance of a specified Class is found.
static Edge unwrapEdge(Edge g)
          Variant of unwrapGraphEntity(GraphEntity) to avoid casting.
static EdgeClass unwrapEdgeClass(EdgeClass g)
          Variant of unwrapGraphEntityClass(GraphEntityClass) to avoid casting.
static EdgeClass unwrapEdgeClassTill(EdgeClass g, java.lang.Class<?> c)
          Performs unwrapping until an instance of a specified Class is found.
static Edge unwrapEdgeTill(Edge g, java.lang.Class<?> c)
          Performs unwrapping until an instance of a specified Class is found.
static Graph unwrapGraph(Graph g)
          Variant of unwrapGraphEntity(GraphEntity) to avoid casting.
static GraphClass unwrapGraphClass(GraphClass g)
          Variant of unwrapGraphEntityClass(GraphEntityClass) to avoid casting.
static GraphClass unwrapGraphClassTill(GraphClass g, java.lang.Class<?> c)
          Performs unwrapping until an instance of a specified Class is found.
static GraphEntity unwrapGraphEntity(GraphEntity g)
          Completely removes all additional layers around an entity.
static GraphEntityClass unwrapGraphEntityClass(GraphEntityClass g)
          Completely removes all additional layers around an entity class.
static GraphEntityClass unwrapGraphEntityClassTill(GraphEntityClass g, java.lang.Class<?> c)
          Performs unwrapping until an instance of a specified Class is found.
static GraphEntity unwrapGraphEntityTill(GraphEntity g, java.lang.Class<?> c)
          Performs unwrapping until an instance of a specified Class is found.
static Graph unwrapGraphTill(Graph g, java.lang.Class<?> c)
          Performs unwrapping until an instance of a specified Class is found.
static Node unwrapNode(Node g)
          Variant of unwrapGraphEntity(GraphEntity) to avoid casting.
static NodeClass unwrapNodeClass(NodeClass g)
          Variant of unwrapGraphEntityClass(GraphEntityClass) to avoid casting.
static NodeClass unwrapNodeClassTill(NodeClass g, java.lang.Class<?> c)
          Performs unwrapping until an instance of a specified Class is found.
static Node unwrapNodeTill(Node g, java.lang.Class<?> c)
          Performs unwrapping until an instance of a specified Class is found.
static Relation unwrapRelation(Relation g)
          Variant of unwrapGraphEntity(GraphEntity) to avoid casting.
static RelationClass unwrapRelationClass(RelationClass g)
          Variant of unwrapGraphEntityClass(GraphEntityClass) to avoid casting.
static RelationClass unwrapRelationClassTill(RelationClass g, java.lang.Class<?> c)
          Performs unwrapping until an instance of a specified Class is found.
static RelationEnd unwrapRelationEnd(RelationEnd g)
          Variant of unwrapGraphEntity(GraphEntity) to avoid casting.
static RelationEndClass unwrapRelationEndClass(RelationEndClass g)
          Variant of unwrapGraphEntityClass(GraphEntityClass) to avoid casting.
static RelationEndClass unwrapRelationEndClassTill(RelationEndClass g, java.lang.Class<?> c)
          Performs unwrapping until an instance of a specified Class is found.
static RelationEnd unwrapRelationEndTill(RelationEnd g, java.lang.Class<?> c)
          Performs unwrapping until an instance of a specified Class is found.
static Relation unwrapRelationTill(Relation g, java.lang.Class<?> c)
          Performs unwrapping until an instance of a specified Class is found.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UnwrapTool

public UnwrapTool()
Method Detail

unwrapGraphEntityTill

public static final GraphEntity unwrapGraphEntityTill(GraphEntity g,
                                                      java.lang.Class<?> c)
                                               throws DragosException
Performs unwrapping until an instance of a specified Class is found. If the parameter g is null, null is returned, so this method may be called before parameter checking.

Parameters:
g - The entity to unwrap.
c - The class to look for.
Returns:
The first instance of the requested class found.
Throws:
DragosException - if no instance of the requested class was found.

unwrapGraphTill

public static final Graph unwrapGraphTill(Graph g,
                                          java.lang.Class<?> c)
                                   throws DragosException
Performs unwrapping until an instance of a specified Class is found. If the parameter g is null, null is returned, so this method may be called before parameter checking.

Parameters:
g - The entity to unwrap.
c - The class to look for.
Returns:
The first instance of the requested class found.
Throws:
DragosException - if no instance of the requested class was found.

unwrapNodeTill

public static final Node unwrapNodeTill(Node g,
                                        java.lang.Class<?> c)
                                 throws DragosException
Performs unwrapping until an instance of a specified Class is found. If the parameter g is null, null is returned, so this method may be called before parameter checking.

Parameters:
g - The entity to unwrap.
c - The class to look for.
Returns:
The first instance of the requested class found.
Throws:
DragosException - if no instance of the requested class was found.

unwrapEdgeTill

public static final Edge unwrapEdgeTill(Edge g,
                                        java.lang.Class<?> c)
                                 throws DragosException
Performs unwrapping until an instance of a specified Class is found. If the parameter g is null, null is returned, so this method may be called before parameter checking.

Parameters:
g - The entity to unwrap.
c - The class to look for.
Returns:
The first instance of the requested class found.
Throws:
DragosException - if no instance of the requested class was found.

unwrapRelationTill

public static final Relation unwrapRelationTill(Relation g,
                                                java.lang.Class<?> c)
                                         throws DragosException
Performs unwrapping until an instance of a specified Class is found. If the parameter g is null, null is returned, so this method may be called before parameter checking.

Parameters:
g - The entity to unwrap.
c - The class to look for.
Returns:
The first instance of the requested class found.
Throws:
DragosException - if no instance of the requested class was found.

unwrapRelationEndTill

public static final RelationEnd unwrapRelationEndTill(RelationEnd g,
                                                      java.lang.Class<?> c)
                                               throws DragosException
Performs unwrapping until an instance of a specified Class is found. If the parameter g is null, null is returned, so this method may be called before parameter checking.

Parameters:
g - The entity to unwrap.
c - The class to look for.
Returns:
The first instance of the requested class found.
Throws:
DragosException - if no instance of the requested class was found.

unwrapGraphEntityClassTill

public static final GraphEntityClass unwrapGraphEntityClassTill(GraphEntityClass g,
                                                                java.lang.Class<?> c)
                                                         throws DragosException
Performs unwrapping until an instance of a specified Class is found. If the parameter g is null, null is returned, so this method may be called before parameter checking.

Parameters:
g - The entity class to unwrap.
c - The class to look for.
Returns:
The first instance of the requested class found.
Throws:
DragosException - if no instance of the requested class was found.

unwrapGraphClassTill

public static final GraphClass unwrapGraphClassTill(GraphClass g,
                                                    java.lang.Class<?> c)
                                             throws DragosException
Performs unwrapping until an instance of a specified Class is found. If the parameter g is null, null is returned, so this method may be called before parameter checking.

Parameters:
g - The entity class to unwrap.
c - The class to look for.
Returns:
The first instance of the requested class found.
Throws:
DragosException - if no instance of the requested class was found.

unwrapNodeClassTill

public static final NodeClass unwrapNodeClassTill(NodeClass g,
                                                  java.lang.Class<?> c)
                                           throws DragosException
Performs unwrapping until an instance of a specified Class is found. If the parameter g is null, null is returned, so this method may be called before parameter checking.

Parameters:
g - The entity class to unwrap.
c - The class to look for.
Returns:
The first instance of the requested class found.
Throws:
DragosException - if no instance of the requested class was found.

unwrapEdgeClassTill

public static final EdgeClass unwrapEdgeClassTill(EdgeClass g,
                                                  java.lang.Class<?> c)
                                           throws DragosException
Performs unwrapping until an instance of a specified Class is found. If the parameter g is null, null is returned, so this method may be called before parameter checking.

Parameters:
g - The entity class to unwrap.
c - The class to look for.
Returns:
The first instance of the requested class found.
Throws:
DragosException - if no instance of the requested class was found.

unwrapRelationClassTill

public static final RelationClass unwrapRelationClassTill(RelationClass g,
                                                          java.lang.Class<?> c)
                                                   throws DragosException
Performs unwrapping until an instance of a specified Class is found. If the parameter g is null, null is returned, so this method may be called before parameter checking.

Parameters:
g - The entity to unwrap.
c - The class to look for.
Returns:
The first instance of the requested class found.
Throws:
DragosException - if no instance of the requested class was found.

unwrapRelationEndClassTill

public static final RelationEndClass unwrapRelationEndClassTill(RelationEndClass g,
                                                                java.lang.Class<?> c)
                                                         throws DragosException
Performs unwrapping until an instance of a specified Class is found. If the parameter g is null, null is returned, so this method may be called before parameter checking.

Parameters:
g - The entity to unwrap.
c - The class to look for.
Returns:
The first instance of the requested class found.
Throws:
DragosException - if no instance of the requested class was found.

unwrapGraphEntity

public static final GraphEntity unwrapGraphEntity(GraphEntity g)
Completely removes all additional layers around an entity. If the parameter is null, null is returned, so this method may be called before parameter checking.

Parameters:
g - The entity to unwrap.
Returns:
The unwrapped entity.

unwrapGraph

public static final Graph unwrapGraph(Graph g)
Variant of unwrapGraphEntity(GraphEntity) to avoid casting.

Parameters:
g - The entity to unwrap.
Returns:
The unwrapped entity.

unwrapNode

public static final Node unwrapNode(Node g)
Variant of unwrapGraphEntity(GraphEntity) to avoid casting.

Parameters:
g - The entity to unwrap.
Returns:
The unwrapped entity.

unwrapEdge

public static final Edge unwrapEdge(Edge g)
Variant of unwrapGraphEntity(GraphEntity) to avoid casting.

Parameters:
g - The entity to unwrap.
Returns:
The unwrapped entity.

unwrapRelation

public static final Relation unwrapRelation(Relation g)
Variant of unwrapGraphEntity(GraphEntity) to avoid casting.

Parameters:
g - The entity to unwrap.
Returns:
The unwrapped entity.

unwrapRelationEnd

public static final RelationEnd unwrapRelationEnd(RelationEnd g)
Variant of unwrapGraphEntity(GraphEntity) to avoid casting.

Parameters:
g - The entity to unwrap.
Returns:
The unwrapped entity.

unwrapGraphEntityClass

public static final GraphEntityClass unwrapGraphEntityClass(GraphEntityClass g)
Completely removes all additional layers around an entity class. If the parameter is null, null is returned, so this method may be called before parameter checking.

Parameters:
g - The entity class to unwrap.
Returns:
The unwrapped entity class.

unwrapGraphClass

public static final GraphClass unwrapGraphClass(GraphClass g)
Variant of unwrapGraphEntityClass(GraphEntityClass) to avoid casting.

Parameters:
g - The entity class to unwrap.
Returns:
The unwrapped entity class.

unwrapNodeClass

public static final NodeClass unwrapNodeClass(NodeClass g)
Variant of unwrapGraphEntityClass(GraphEntityClass) to avoid casting.

Parameters:
g - The entity class to unwrap.
Returns:
The unwrapped entity class.

unwrapEdgeClass

public static final EdgeClass unwrapEdgeClass(EdgeClass g)
Variant of unwrapGraphEntityClass(GraphEntityClass) to avoid casting.

Parameters:
g - The entity class to unwrap.
Returns:
The unwrapped entity class.

unwrapRelationClass

public static final RelationClass unwrapRelationClass(RelationClass g)
Variant of unwrapGraphEntityClass(GraphEntityClass) to avoid casting.

Parameters:
g - The entity class to unwrap.
Returns:
The unwrapped entity class.

unwrapRelationEndClass

public static final RelationEndClass unwrapRelationEndClass(RelationEndClass g)
Variant of unwrapGraphEntityClass(GraphEntityClass) to avoid casting.

Parameters:
g - The entity class to unwrap.
Returns:
The unwrapped entity class.

unwrapAttributeTill

public static final Attribute unwrapAttributeTill(Attribute a,
                                                  java.lang.Class<?> c)
                                           throws DragosException
Performs unwrapping until an instance of a specified Class is found. If the parameter a is null, null is returned, so this method may be called before parameter checking.

Parameters:
a - The attribute to unwrap.
c - The class to look for.
Returns:
The first instance of the requested class found.
Throws:
DragosException - if no instance of the requested class was found.

unwrapAttribute

public static final Attribute unwrapAttribute(Attribute a)
Completely removes all additional layers around an attribute. If the parameter is null, null is returned, so this method may be called before parameter checking.

Parameters:
a - The attribute to unwrap.
Returns:
The unwrapped attribute.

unwrapAllGraphEntities

public static final java.util.Collection<GraphEntity> unwrapAllGraphEntities(java.util.Collection<? extends GraphEntity> c)
All graph entities in the given collection are unwrapped. A new collection is returned containing the unwrapped GraphEntity instances.

Parameters:
c - A collection of GraphEntity instances.
Returns:
a collection of unwrapped GraphEntity instances.

unwrapAllGraphEntityClasses

public static final java.util.Collection<GraphEntityClass> unwrapAllGraphEntityClasses(java.util.Collection<? extends GraphEntityClass> c)
All graph entity classes in the given collection are unwrapped. A new collection is returned containing the unwrapped GraphEntityClass instances.

Parameters:
c - A collection of GraphEntityClasses instances.
Returns:
a collection of unwrapped GraphEntityClasses instances.


Copyright © 2002-2008 RWTH Aachen, Department of Computer Science 3 (Software Engineering). All Rights Reserved.