Resources  
  FAQ
Online Help File
Examples
External Links
 
  Online Help File  
  The Time2HELP help file is available online.  
  Order Time2HELP  
  Order Time2help and pay by credit card, check or bank transfer.  
  Order online from Kagi.  
  Download trial version  
 

Download the 30 day trial version of Time2HELP now.

 
 

 

From Vision to Code - Built by Delphi

 

 
Painless Documentation
for your Source Code
 
    Home   Features  Download   Support   News   Order   

DocComment example

This is a simple unit lightly documented with DocComments
(Note: This example uses another "Magic symbol" to indicate that the comment is a DocComment, namely ":" (colon). This symbol is supported for backwards compatibility. You may use the JavaDoc syntax "**" (double star) instead.)

To see how Time2HELP converts this into HTML, click here
(Note that here we have instructed Time2HELP to include the implementation of the methods/routines in the output, this may be turned off)

 

{:Contains classes/types representing parts of the UML metamodel.}
unit L1UMLModelElements;

interface
uses Classes;

Type

TUML_NameSpace=class;
TUML_AssociationEnd = class;

{:Named entity in a model.
It is the base for all modelling metaclasses in the UML.
All other metaclasses are either direct or indirect subclasses of TUML_ModelElement.
}
// -----------------------------------------------------------------------
    TUML_ModelElement = class(TObject)
// -----------------------------------------------------------------------
private
  fName: String;

  fNameSpace: TUML_NameSpace; //Shared. May be nil.

public
  //:Name of the element. Must be unique within the current <See Class=TUML_NameSpace>.
  Property Name: String  Read fName  Write fName;

  //:Namespace of this element.
  Property NameSpace: TUML_NameSpace  Read fNameSpace  Write fNameSpace;
End;

{:Part of a model in which each name has a unique meaning.<p>
In the metamodel a NameSpace is a ModelElement that can contain other ModelElements, like 

Associations and Classifiers.
The name of each contained ModelElement must be unique within the NameSpace. Moreover, 

each contained ModelElement is contained in at most one NameSpace.
 The concrete subclasses of NameSpace will have additional constraints that specify which 

kinds of elements may be contained within it.
 }
// -----------------------------------------------------------------------
    TUML_NameSpace = class(TUML_ModelElement)
// -----------------------------------------------------------------------
End;

{:A model element which may participate in a generalization relationship.}
// -----------------------------------------------------------------------
    TUML_GeneralizableElement = class(TUML_NameSpace)
// -----------------------------------------------------------------------
private
{Currently these properties are stored in these field.
 They are in fact derived info, and may perhaps be calculated on the fly in the future.
}
  fIsRoot: Boolean;
  fIsLeaf: Boolean;
  fIsAbstract: Boolean;

public

  Property IsRoot: Boolean  Read fIsRoot  Write fIsRoot;
  Property IsLeaf: Boolean  Read fIsLeaf  Write fIsLeaf;
  Property IsAbstract: Boolean  Read fIsAbstract  Write fIsAbstract;
End;

{:Declares a collection of Features, such as attributes, methods and operations.
It has a Name, which is unique in the NameSpace enclosing the Classifier.}
// -----------------------------------------------------------------------
    TUML_Classifier = class(TUML_GeneralizableElement)
// -----------------------------------------------------------------------
private
  fFeatures: TStringList; //forslag til syntax: #<Aggregation=Composite Of=TUML_Feature>
public
    Constructor Create;
    Destructor Destroy; override;

  Property Features: TStringList Read fFeatures;
End;

{:A Feature is a property, like Operation or Attribute, which is encapsulated within 

another entity, such as an Interface, a Class or a DataType.
}
// -----------------------------------------------------------------------
    TUML_Feature = class(TUML_ModelElement)
// -----------------------------------------------------------------------
End;

{:Defines a semantic relationsip between two or more Classifiers.
An association has a name and at least two <See Class=TUML_AssociationEnd>s, ie. 

connections to the associated Classifiers.
}
// -----------------------------------------------------------------------
    TUML_Association = class(TUML_ModelElement)
// -----------------------------------------------------------------------
private
  fAssociationEnds: TStringList;//#

public
    Constructor Create;
    Destructor Destroy; override;

    Function CreateAssociationEndTo(const i_classifier: TUML_Classifier): 

TUML_AssociationEnd;

//:The associatons' ends. Two or more.
  Property AssociationEnds: TStringList  Read fAssociationEnds;
End;

TUML_Aggregation = (agNone, agShared, agComposite);
TUML_TargetScope = (tsInstance, tsType);
TUML_Changeable = (chNone, chFrozen, chAddOnly);

{:Endpoint of an Association, which connects the association to a Classifier.
It has a name and defines a set of properties of the connection, e.g. which Classifier 

the instances must conform to, their multiplicity, if they may be exchanged, and if they 

may be reached from another instance via this connection.
}
// -----------------------------------------------------------------------
    TUML_AssociationEnd = class(TUML_ModelElement)
// -----------------------------------------------------------------------
private
  fIsNavigable: Boolean;
  fIsOrdered: Boolean;
  fAggregation: TUML_Aggregation;
  fMultiplicity: String; //should probably use two integers, and plus/minus infinity!
  fTargetScope: TUML_TargetScope;
  fChangeable: TUML_ChangeAble;

  fClassifier: TUML_Classifier;
public


//:The Classifier which this AssociationEnd is connected to.
  Property Classifier: TUML_Classifier  Read fClassifier  Write fClassifier;

  Property IsNavigable: Boolean  Read fIsNavigable  Write fIsNavigable;
  Property IsOrdered: Boolean  Read fIsOrdered  Write fIsOrdered;
  Property Aggregation: TUML_Aggregation  Read fAggregation  Write fAggregation;
  Property Multiplicity: String  Read fMultiplicity  Write fMultiplicity;
  Property TargetScope: TUML_TargetScope  Read fTargetScope  Write fTargetScope;
  Property Changeable: TUML_Changeable  Read fChangeable  Write fChangeable;
End;


implementation
uses L1Basis;


//########################################################################
//   TUML_Classifier
//########################################################################
Constructor TUML_Classifier.Create;
begin
  inherited Create;
  fFeatures:= TStringList.Create;
End;

Destructor TUML_Classifier.Destroy;
begin
  L1Strings_DeepFree(fFeatures);

  inherited Destroy;
End;

//########################################################################
//   TUML_Association
//########################################################################
Constructor TUML_Association.Create;
begin
  inherited Create;
  fAssociationEnds:= TStringList.Create;
End;

Destructor TUML_Association.Destroy;
begin
  L1Strings_DeepFree(fAssociationEnds);

  inherited Destroy;
End;





Function TUML_Association.CreateAssociationEndTo(const i_classifier: TUML_Classifier): 

TUML_AssociationEnd;
Begin
  Result:=TUML_AssociationEnd.Create;
  Result.Classifier:=i_classifier;
  AssociationEnds.AddObject('', Result); //Currently we don't use the full stringlist. 
(Could have used TList instead).
End;


end.

 

This page was last updated 2002-07-20 .
Copyright © 1997-2002 by Digital Logikk AS.