Dresden OCL Toolkit

tudresden.ocl.injection.reverseeng
Class AbstractDescriptor

java.lang.Object
  extended bytudresden.ocl.injection.reverseeng.AbstractDescriptor
Direct Known Subclasses:
CollectionDescriptor, MapDescriptor

public abstract class AbstractDescriptor
extends Object

Abstract super class of MapDescriptor and CollectionDescriptor.

Version:
0.1
Author:
sz9 (Steffen Zschaler)

Nested Class Summary
static class AbstractDescriptor.AbstractDescriptorEvent
          EventObject fired by descriptors to notify listeners of changes in their state.
static interface AbstractDescriptor.AbstractDescriptorListener
          Event interface sourced by AbstractDescriptor.
(package private)  class AbstractDescriptor.TracedTypeProposal
           
 
Field Summary
private static String ELEMENT
           
private static String KEY
           
private  AnalysisConsumer m_acOwner
          The analysis in which this descriptor occurred.
private  JavaClass m_jcParent
          The class containing the feature described.
private  List m_ladlListeners
          Listeners associated with this descriptor.
private  int m_nCommentID
          Comment ID associated with the feature.
private  RevengTreeNode m_rtnAssociatedNode
          Tree node associated with the descriptor.
private  String m_sContainingClass
          String cache of the containing class hierarchy.
private  String m_sDocComment
          Doccomment associated with the feature.
private  String m_sElementType
          Element type tag associated with the feature.
private  String m_sKeyType
          Key type tag, if any, associated with the feature.
private  String m_sName
          Name of the feature described.
private  String m_sType
          Type of the feature described.
static String s_sAllTypesReasonString
           
static String s_sMinimalTypeReasonString
           
 
Constructor Summary
AbstractDescriptor(AnalysisConsumer acOwner, JavaClass jcParent, String sName, String sType, String sComment, int nCommentID)
          Creates new AbstractDescriptor
 
Method Summary
 void addModifiedListener(AbstractDescriptor.AbstractDescriptorListener adl)
           
protected  void adjustDocComment(String sData, String sContext)
          Does not fire modified event as it assumes that the event will be fired by the caller...
abstract  RevengTreeNode createTreeNode(DefaultTreeModel dtmModel)
          Create tree node to render this descriptor.
protected  void fireModified()
           
 int getCommentID()
          Return the comment ID associated with this descriptor.
 JavaClass getContainingClass()
          Get the class hierarchy containing the described feature.
 String getDisplayName(boolean fExpanded)
          Get the name of the described feature as for displaying it to a user.
 String getDocComment()
          Return a version of the doccomment that has been updated based on the values of element-type and key-type.
 String getElementType()
          Return the contents of the element-type tag for the described feature.
 String getJavaDocName()
           
 String getKeyType()
          Return the contents of the key-type tag for the described feature.
 String getName()
          Get the name of the feature being described.
 List getProposedElementTypes()
          Return a list of ProposedTypes that can be used in the TypeEditPage for the element-type tag.
 List getProposedKeyTypes()
          Return a list of ProposedTypes that can be used in the TypeEditPage for the key-type tag.
 String getType()
          Get the type of the feature described.
 void indentComment(int nIndent)
          Indents the doccomment (all but the first line) the specified number of characters.
abstract  boolean isCollection()
          True, if feature described is a collection and not a map.
 boolean isIncomplete()
          True if the descriptor is incomplete, i.e.
 void removeModifiedListener(AbstractDescriptor.AbstractDescriptorListener adl)
           
 void setAssociatedTreeNode(RevengTreeNode rtn)
          Internal method reassociating a tree node with this descriptor.
 void setElementType(String sElementType)
          Set the contents of the element-type tag for the described feature.
protected  void setKeyType(String sKeyType)
          Set the contents of the key-type tag for the described feature.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ELEMENT

private static final String ELEMENT
See Also:
Constant Field Values

KEY

private static final String KEY
See Also:
Constant Field Values

m_acOwner

private AnalysisConsumer m_acOwner
The analysis in which this descriptor occurred.


m_jcParent

private JavaClass m_jcParent
The class containing the feature described.


m_sContainingClass

private String m_sContainingClass
String cache of the containing class hierarchy.


m_sName

private String m_sName
Name of the feature described.


m_sType

private String m_sType
Type of the feature described.


m_sDocComment

private String m_sDocComment
Doccomment associated with the feature.


m_nCommentID

private int m_nCommentID
Comment ID associated with the feature.


m_sElementType

private String m_sElementType
Element type tag associated with the feature.


m_sKeyType

private String m_sKeyType
Key type tag, if any, associated with the feature.


m_rtnAssociatedNode

private RevengTreeNode m_rtnAssociatedNode
Tree node associated with the descriptor. (Probably obsolete!)


m_ladlListeners

private List m_ladlListeners
Listeners associated with this descriptor. They will be notified about modifications to the descriptor.


s_sMinimalTypeReasonString

public static String s_sMinimalTypeReasonString

s_sAllTypesReasonString

public static String s_sAllTypesReasonString
Constructor Detail

AbstractDescriptor

public AbstractDescriptor(AnalysisConsumer acOwner,
                          JavaClass jcParent,
                          String sName,
                          String sType,
                          String sComment,
                          int nCommentID)
Creates new AbstractDescriptor

Parameters:
acOwner - analysis in which this feature occurred.
jcParent - class containing the feature to be described.
sName - name of the described feature.
sType - type of the feature
sComment - the doccomment preceding the described feature.
nCommentID - a number uniquely identifying the comment for the feature. (Number of comments from beginning of source file.
Method Detail

getName

public String getName()
Get the name of the feature being described.

Returns:
the name of the feature being described

getDocComment

public String getDocComment()
Return a version of the doccomment that has been updated based on the values of element-type and key-type.

Returns:
the updated doccomment

indentComment

public void indentComment(int nIndent)
Indents the doccomment (all but the first line) the specified number of characters. Fires modified event.


adjustDocComment

protected void adjustDocComment(String sData,
                                String sContext)
Does not fire modified event as it assumes that the event will be fired by the caller...


getElementType

public String getElementType()
Return the contents of the element-type tag for the described feature.

Returns:
the contents of the element-type tag for the described feature

setElementType

public void setElementType(String sElementType)
Set the contents of the element-type tag for the described feature.

Fires AbstractDescriptor.AbstractDescriptorListener.onDescriptorModified(tudresden.ocl.injection.reverseeng.AbstractDescriptor.AbstractDescriptorEvent) event.

Parameters:
sElementType - The new contents of the element-type tag. null to delete the element-type tag.

getKeyType

public String getKeyType()
Return the contents of the key-type tag for the described feature.

Returns:
the contents of the key-type tag for the described feature.

setKeyType

protected void setKeyType(String sKeyType)
Set the contents of the key-type tag for the described feature.

Fires AbstractDescriptor.AbstractDescriptorListener.onDescriptorModified(tudresden.ocl.injection.reverseeng.AbstractDescriptor.AbstractDescriptorEvent) event.

Parameters:
sKeyType - The new contents of the key-type tag. null to delete the key-type tag.

getCommentID

public int getCommentID()
Return the comment ID associated with this descriptor.

Returns:
the comment ID associated with this descriptor.

isIncomplete

public boolean isIncomplete()
True if the descriptor is incomplete, i.e. if a necessary tag (element-type/key-type) is not filled in.

Returns:
True if the descriptor is incomplete, i.e. if a necessary tag (element-type/key-type) is not filled in.

createTreeNode

public abstract RevengTreeNode createTreeNode(DefaultTreeModel dtmModel)
Create tree node to render this descriptor.

Parameters:
dtmModel - Tree model which the tree node should become part of.
Returns:
the freshly created node

setAssociatedTreeNode

public void setAssociatedTreeNode(RevengTreeNode rtn)
Internal method reassociating a tree node with this descriptor. (Probably obsolete!)

Parameters:
rtn - The tree node with which to associate the descriptor.

getType

public String getType()
Get the type of the feature described.

Returns:
the type of the feature described

getContainingClass

public JavaClass getContainingClass()
Get the class hierarchy containing the described feature.

Returns:
the class hierarchy containing the described feature

isCollection

public abstract boolean isCollection()
True, if feature described is a collection and not a map.

Returns:
true, if feature described is a collection and not a map

getJavaDocName

public String getJavaDocName()

getProposedElementTypes

public List getProposedElementTypes()
Return a list of ProposedTypes that can be used in the TypeEditPage for the element-type tag.


getProposedKeyTypes

public List getProposedKeyTypes()
Return a list of ProposedTypes that can be used in the TypeEditPage for the key-type tag.


getDisplayName

public String getDisplayName(boolean fExpanded)
Get the name of the described feature as for displaying it to a user.

Parameters:
fExpanded - if true, add containment hierarchy information to display name. Otherwise just return plain feature name.
Returns:
TODO

addModifiedListener

public void addModifiedListener(AbstractDescriptor.AbstractDescriptorListener adl)

removeModifiedListener

public void removeModifiedListener(AbstractDescriptor.AbstractDescriptorListener adl)

fireModified

protected void fireModified()

Dresden OCL Toolkit

Submit a bug
Developed at the Dresden University of Technology.
This software is published under the GNU Lesser General Public License.