Package com.yworks.yshrink.model
Class Model
- java.lang.Object
-
- com.yworks.yshrink.model.Model
-
public class Model extends java.lang.ObjectThe type Model.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringCONSTRUCTOR_NAMEThe constant CONSTRUCTOR_NAME.protected NetworknetworkThe Network.protected java.util.Map<java.lang.Object,java.lang.Object>node2DescriptorThe Node 2 descriptor.protected java.util.Map<java.lang.Object,java.lang.Object>node2TypeThe Node 2 type.static java.lang.StringVOID_DESCThe constant VOID_DESC.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.ObjectcreateDependencyEdge(AbstractDescriptor source, AbstractDescriptor target, EdgeType type)creates a dependency of typetypeiff no edge of the same type exists betweensourceandtarget.java.lang.ObjectcreateDependencyEdge(java.lang.Object sourceNode, java.lang.Object targetNode, EdgeType edgeType)Create dependency edge edge.voidcreateEntryPointEdges(java.util.List<AbstractDescriptor> entryPoints)Create entry point edges.voidgetAllAncestorClasses(java.lang.String className, java.util.Set<java.lang.String> parents)Gets all ancestor classes.java.util.Collection<ClassDescriptor>getAllClassDescriptors()Gets all class descriptors.java.util.Collection<java.lang.String>getAllClassNames()Gets all class names.booleangetAllExternalAncestorMethods(java.lang.String className, java.util.List<java.lang.reflect.Method> methods)Gets all external ancestor methods.voidgetAllImplementedInterfaces(java.lang.String className, java.util.Set<java.lang.String> interfaces)Gets all implemented interfaces.java.util.Set<ClassDescriptor>getAllImplementingClasses(ClassDescriptor cd)retrieve all implementing classes ofcd.voidgetAllInternalAncestorEntrypointMethods(java.lang.String className, java.util.List<MethodDescriptor> methods)Gets all internal ancestor entrypoint methods.ClassDescriptorgetClassDescriptor(java.lang.String className)Gets class descriptor.java.lang.ObjectgetClassNode(java.lang.Object memberNode)Gets class node.EdgeTypegetDependencyType(java.lang.Object e)Gets dependency type.AbstractDescriptorgetDescriptor(java.lang.Object n)Gets descriptor.java.lang.ObjectgetEntryPointNode()Gets entry point node.voidgetInternalDescendants(ClassDescriptor cd, java.util.List<ClassDescriptor> descendants)collects all subclasses ofcdNetworkgetNetwork()Gets network.intgetNodeType(java.lang.Object n)Gets node type.booleanisAllResolved()Is all resolved boolean.booleanisClassModeled(java.lang.String className)Is class modeled boolean.booleanisMethodExternallyDefined(ClassDescriptor origClass, MethodDescriptor md)determine wether the methodmdis implemented in any superclasses of classclassNameor ifmdis declared in any interface that classclassNameor any superclass of classclassNameimplements.booleanisObsolete(java.lang.Object n)Is obsolete boolean.booleanisSimpleModelSet()Is simple model set boolean.booleanisStubNeeded(java.lang.Object n)Is stub needed boolean.voidmarkNotObsolete(java.lang.Object n)Mark not obsolete.voidmarkObsolete(java.lang.Object n)Mark obsolete.voidmarkStubNeeded(java.lang.Object n)Mark stub needed.ClassDescriptornewClassDescriptor(java.lang.String name, java.lang.String superName, java.lang.String[] interfaces, int access, java.io.File sourceJar)New class descriptor class descriptor.FieldDescriptornewFieldDescriptor(ClassDescriptor cd, java.lang.String desc, java.lang.String name, int access, java.io.File sourceJar)New field descriptor field descriptor.MethodDescriptornewMethodDescriptor(ClassDescriptor cd, int access, java.lang.String name, java.lang.String desc, java.lang.String[] exceptions, java.io.File sourceJar)New method descriptor method descriptor.voidsetClassResolver(ClassResolver res)Sets class resolver.voidsetSimpleModelSet()Sets simple model set.
-
-
-
Field Detail
-
network
protected Network network
The Network.
-
node2Descriptor
protected java.util.Map<java.lang.Object,java.lang.Object> node2Descriptor
The Node 2 descriptor.
-
node2Type
protected java.util.Map<java.lang.Object,java.lang.Object> node2Type
The Node 2 type.
-
VOID_DESC
public static java.lang.String VOID_DESC
The constant VOID_DESC.
-
CONSTRUCTOR_NAME
public static final java.lang.String CONSTRUCTOR_NAME
The constant CONSTRUCTOR_NAME.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
Model
public Model()
Instantiates a new Model.
-
Model
public Model(Network network)
Instantiates a new Model.- Parameters:
network- the network
-
-
Method Detail
-
setClassResolver
public void setClassResolver(ClassResolver res)
Sets class resolver.- Parameters:
res- the res
-
setSimpleModelSet
public void setSimpleModelSet()
Sets simple model set.
-
isSimpleModelSet
public boolean isSimpleModelSet()
Is simple model set boolean.- Returns:
- the boolean
-
getEntryPointNode
public java.lang.Object getEntryPointNode()
Gets entry point node.- Returns:
- the entry point node
-
isClassModeled
public boolean isClassModeled(java.lang.String className)
Is class modeled boolean.- Parameters:
className- the class name- Returns:
- the boolean
-
createDependencyEdge
public java.lang.Object createDependencyEdge(AbstractDescriptor source, AbstractDescriptor target, EdgeType type)
creates a dependency of typetypeiff no edge of the same type exists betweensourceandtarget.- Parameters:
source- the edge sourcetarget- the edge targettype- the edge type- Returns:
- the created edge, or null if no edge was created
-
createDependencyEdge
public java.lang.Object createDependencyEdge(java.lang.Object sourceNode, java.lang.Object targetNode, EdgeType edgeType)Create dependency edge edge.- Parameters:
sourceNode- the source nodetargetNode- the target nodeedgeType- the edge type- Returns:
- the edge
-
newClassDescriptor
public ClassDescriptor newClassDescriptor(java.lang.String name, java.lang.String superName, java.lang.String[] interfaces, int access, java.io.File sourceJar)
New class descriptor class descriptor.- Parameters:
name- the namesuperName- the super nameinterfaces- the interfacesaccess- the accesssourceJar- the source jar- Returns:
- the class descriptor
-
newMethodDescriptor
public MethodDescriptor newMethodDescriptor(ClassDescriptor cd, int access, java.lang.String name, java.lang.String desc, java.lang.String[] exceptions, java.io.File sourceJar)
New method descriptor method descriptor.- Parameters:
cd- the cdaccess- the accessname- the namedesc- the descexceptions- the exceptionssourceJar- the source jar- Returns:
- the method descriptor
-
newFieldDescriptor
public FieldDescriptor newFieldDescriptor(ClassDescriptor cd, java.lang.String desc, java.lang.String name, int access, java.io.File sourceJar)
New field descriptor field descriptor.- Parameters:
cd- the cddesc- the descname- the nameaccess- the accesssourceJar- the source jar- Returns:
- the field descriptor
-
getAllClassDescriptors
public java.util.Collection<ClassDescriptor> getAllClassDescriptors()
Gets all class descriptors.- Returns:
- the all class descriptors
-
getAllClassNames
public java.util.Collection<java.lang.String> getAllClassNames()
Gets all class names.- Returns:
- the all class names
-
getClassDescriptor
public ClassDescriptor getClassDescriptor(java.lang.String className)
Gets class descriptor.- Parameters:
className- the class name- Returns:
- the class descriptor
-
getDescriptor
public AbstractDescriptor getDescriptor(java.lang.Object n)
Gets descriptor.- Parameters:
n- the n- Returns:
- the descriptor
-
getClassNode
public java.lang.Object getClassNode(java.lang.Object memberNode)
Gets class node.- Parameters:
memberNode- the member node- Returns:
- the class node
-
getDependencyType
public EdgeType getDependencyType(java.lang.Object e)
Gets dependency type.- Parameters:
e- the e- Returns:
- the dependency type
-
getAllImplementingClasses
public java.util.Set<ClassDescriptor> getAllImplementingClasses(ClassDescriptor cd)
retrieve all implementing classes ofcd.- Parameters:
cd- the cd- Returns:
- List of ClassDescriptors containing all classes that implement cd
-
getAllImplementedInterfaces
public void getAllImplementedInterfaces(java.lang.String className, java.util.Set<java.lang.String> interfaces)Gets all implemented interfaces.- Parameters:
className- the class nameinterfaces- the interfaces
-
getAllAncestorClasses
public void getAllAncestorClasses(java.lang.String className, java.util.Set<java.lang.String> parents)Gets all ancestor classes.- Parameters:
className- the class nameparents- the parents
-
getAllInternalAncestorEntrypointMethods
public void getAllInternalAncestorEntrypointMethods(java.lang.String className, java.util.List<MethodDescriptor> methods)Gets all internal ancestor entrypoint methods.- Parameters:
className- the class namemethods- the methods
-
getAllExternalAncestorMethods
public boolean getAllExternalAncestorMethods(java.lang.String className, java.util.List<java.lang.reflect.Method> methods)Gets all external ancestor methods.- Parameters:
className- the class namemethods- the methods- Returns:
- the all external ancestor methods
-
getInternalDescendants
public void getInternalDescendants(ClassDescriptor cd, java.util.List<ClassDescriptor> descendants)
collects all subclasses ofcd- Parameters:
cd- the cddescendants- the descendants
-
isMethodExternallyDefined
public boolean isMethodExternallyDefined(ClassDescriptor origClass, MethodDescriptor md)
determine wether the methodmdis implemented in any superclasses of classclassNameor ifmdis declared in any interface that classclassNameor any superclass of classclassNameimplements.- Parameters:
origClass- the orig classmd- the md- Returns:
- true iff an implementation or declaration of
mdis found in any ancestor class/interface of classclassName
-
createEntryPointEdges
public void createEntryPointEdges(java.util.List<AbstractDescriptor> entryPoints)
Create entry point edges.- Parameters:
entryPoints- the entry points
-
isAllResolved
public boolean isAllResolved()
Is all resolved boolean.- Returns:
- the boolean
-
getNodeType
public int getNodeType(java.lang.Object n)
Gets node type.- Parameters:
n- the n- Returns:
- the node type
-
markObsolete
public void markObsolete(java.lang.Object n)
Mark obsolete.- Parameters:
n- the n
-
markNotObsolete
public void markNotObsolete(java.lang.Object n)
Mark not obsolete.- Parameters:
n- the n
-
markStubNeeded
public void markStubNeeded(java.lang.Object n)
Mark stub needed.- Parameters:
n- the n
-
isObsolete
public boolean isObsolete(java.lang.Object n)
Is obsolete boolean.- Parameters:
n- the n- Returns:
- the boolean
-
isStubNeeded
public boolean isStubNeeded(java.lang.Object n)
Is stub needed boolean.- Parameters:
n- the n- Returns:
- the boolean
-
getNetwork
public Network getNetwork()
Gets network.- Returns:
- the network
-
-