org.eclipse.gmt.umlx.ecore.accessor
Class TreeAccessor

java.lang.Object
  extended by org.eclipse.gmt.umlx.ecore.accessor.TreeAccessor

public class TreeAccessor
extends java.lang.Object


Constructor Summary
TreeAccessor()
           
 
Method Summary
static
<C,P> void
addSibling(int index, C child, P parent)
           
static
<C,SomeP> SomeP
basicGetParent(C object)
          Return the parent of a child object.
static
<T> org.eclipse.emf.ecore.resource.Resource
eResource(T object)
          Return the containing resource for object.
static
<C> java.lang.Object
getCoModel(C child)
           
static
<C,CM> CM
getCoModel(C child, java.lang.Class<CM> coModelClass)
           
static
<C> java.lang.String
getLabel(C child)
          Return the label for child.
static
<C> java.lang.Object
getParent(C object)
          Return the parent of a child object.
static
<C,P> P
getParent(C object, java.lang.Class<P> parentClass)
           
static
<C> IParentAccessor<? super C,?,?>
getParentAccessor(C child)
          Return the parent adapter for child and its current parent.
static
<C> IParentAccessor<? super C,?,?>
getParentAccessor(java.lang.Class<C> childClass)
          Return the parent adapter for a given child class.
static
<C> ISiblingAccessor<? super C,?,?>
getSiblingAccessor(C child)
          Return the sibling adapter for child and its current parent.
static
<C,P> ISiblingAccessor<? super C,? super P,?>
getSiblingAccessor(C child, java.lang.Class<P> parentClass)
           
static
<C,P> ISiblingAccessor<? super C,? super P,?>
getSiblingAccessor(java.lang.Class<C> childClass, java.lang.Class<P> parentClass)
           
static
<C,SomeP,P extends SomeP>
ISiblingAccessor<? super C,? super P,?>
getSiblingAccessor(C child, P parent)
          Return the sibling adapter for child and not necessarily current parent.
static
<C,SomeP,P extends SomeP>
ISiblingAccessor<? super C,? super P,?>
getSiblingAccessor0(IParentAccessor<? super C,SomeP,?> parentAccessor, java.lang.Class<P> parentClass)
           
static
<C> java.util.List<? super C>
getSiblings(C child)
           
static
<C,P> java.util.List<? super C>
getSiblings(java.lang.Class<C> childClass, P parent)
           
static
<C,P> java.util.List<? super C>
getSiblings(C child, P parent)
           
static
<C,P> java.lang.String
newName(java.lang.String prefix, java.lang.Class<C> childClass, P parent)
          Generate a new name for a childClass child of parent using a given naming prefix.
static
<C,P> int
removeSibling(C child, P parent)
           
static
<C,CM> void
setCoModel(C child, CM coModel, java.lang.Class<CM> coModelClass)
           
static
<C,P> void
setParent(C child, P parent)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TreeAccessor

public TreeAccessor()
Method Detail

addSibling

public static <C,P> void addSibling(int index,
                                    C child,
                                    P parent)

basicGetParent

public static <C,SomeP> SomeP basicGetParent(C object)
Return the parent of a child object.

Type Parameters:
C - Class of child object
SomeP - Unknown class of parent object
Parameters:
object -
Returns:
the containing resource (or null)

eResource

public static <T> org.eclipse.emf.ecore.resource.Resource eResource(T object)
Return the containing resource for object.

Type Parameters:
T - Class of object
Parameters:
object -
Returns:
the containing resource (or null)

getCoModel

public static <C> java.lang.Object getCoModel(C child)

getCoModel

public static <C,CM> CM getCoModel(C child,
                                   java.lang.Class<CM> coModelClass)

getLabel

public static <C> java.lang.String getLabel(C child)
Return the label for child.

Type Parameters:
C - Class of the child
Parameters:
child - The child
Returns:
label

getParent

public static <C> java.lang.Object getParent(C object)
Return the parent of a child object.

Type Parameters:
C - Class of child object
SomeP - Unknown class of parent object
Parameters:
object -
Returns:
the containing resource (or null)

getParent

public static <C,P> P getParent(C object,
                                java.lang.Class<P> parentClass)

getParentAccessor

public static <C> IParentAccessor<? super C,?,?> getParentAccessor(C child)
Return the parent adapter for child and its current parent.

Type Parameters:
C - Class of the child
Parameters:
child - The child
Returns:
parent adapter for the child and its current parent

getParentAccessor

public static <C> IParentAccessor<? super C,?,?> getParentAccessor(java.lang.Class<C> childClass)
Return the parent adapter for a given child class.

Type Parameters:
C - Class of the child
Parameters:
childClass - Class of the child
Returns:
sibling adapter for the child and a putative parent

getSiblingAccessor

public static <C> ISiblingAccessor<? super C,?,?> getSiblingAccessor(C child)
Return the sibling adapter for child and its current parent.

Type Parameters:
C - Class of the child
Parameters:
child - The child
Returns:
sibling adapter for the child and its current parent

getSiblingAccessor

public static <C,SomeP,P extends SomeP> ISiblingAccessor<? super C,? super P,?> getSiblingAccessor(C child,
                                                                                                   P parent)
Return the sibling adapter for child and not necessarily current parent.

Type Parameters:
C - Class of the child
P - Class of the parent
Parameters:
child - The child
parent - The putative parent
Returns:
sibling adapter for the child and a putative parent

getSiblingAccessor0

public static <C,SomeP,P extends SomeP> ISiblingAccessor<? super C,? super P,?> getSiblingAccessor0(IParentAccessor<? super C,SomeP,?> parentAccessor,
                                                                                                    java.lang.Class<P> parentClass)

getSiblingAccessor

public static <C,P> ISiblingAccessor<? super C,? super P,?> getSiblingAccessor(C child,
                                                                               java.lang.Class<P> parentClass)

getSiblingAccessor

public static <C,P> ISiblingAccessor<? super C,? super P,?> getSiblingAccessor(java.lang.Class<C> childClass,
                                                                               java.lang.Class<P> parentClass)

getSiblings

public static <C> java.util.List<? super C> getSiblings(C child)

getSiblings

public static <C,P> java.util.List<? super C> getSiblings(C child,
                                                          P parent)

getSiblings

public static <C,P> java.util.List<? super C> getSiblings(java.lang.Class<C> childClass,
                                                          P parent)

newName

public static <C,P> java.lang.String newName(java.lang.String prefix,
                                             java.lang.Class<C> childClass,
                                             P parent)
Generate a new name for a childClass child of parent using a given naming prefix. The name will be unique with respect to all named siblings of object.

Parameters:
prefix - prefix for generated name
childClass - class identifying distinct name space
parent - context in which names should be distinct
Returns:
the new name

removeSibling

public static <C,P> int removeSibling(C child,
                                      P parent)

setCoModel

public static <C,CM> void setCoModel(C child,
                                     CM coModel,
                                     java.lang.Class<CM> coModelClass)

setParent

public static <C,P> void setParent(C child,
                                   P parent)