Operator  Design Pattern Singleton
   Objective    Ensures that there will be only one instance
                         of a certain object specification
   Parameters   Objects: SINGLETON;
   Subtasks   
         1 - Create Class of an Object: SINGLETON -> Class of SINGLETON
   Consequences   
         Class of SINGLETON will describe the instantiation process for
         the objects specified by SINGLETON
   Product Text
         Class of ADV/ADO SINGLETON
            Declarations
               Attributes
                  NumberOfMembers: nat;
               Actions
                  Creation CreateClass;
                  Destruction DestroyClass;
                  AddObject: nat;
                  RemoveObject: nat;
               Nested ADVs/ADOs
                  Sequence Object of SINGLETON;
            Static Properties
               Constraints 
                  [] NumberOfMembers <= 1;                                
            Dynamic Properties
               Valuation
                  CreateClass -> O NumberOfMembers = 0;
                  AddObject(N) -> O NumberOfMembers = NumberOfMembers + 1;
                  RemoveObject(N) -> O NumberOfMembers = NumberOfMembers - 1;
               Interconnection
                  AddObject(N) --> Object(N).Creation_Actions;
                  RemoveObject(N) --> Object(N).Destruction_Actions;
         EndClass SINGLETON
End Operator
  • Tex version