⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 eiffel1.sct

📁 c#设计模式WithCla
💻 SCT
字号:
NO_OUTPUT_BEGIN
When With Class is not running update the wc2.ini for the basic Eiffel types and defaults as follows:
[TYPES] Type1=INTEGER, Type2=REAL, Type3=DOUBLE, Type4=BOOLEAN, Type5=CHARACTER, Type6=STRING, Type7=ARRAY,
[DEFAULTS] Type=INTEGER, ReturnType=    .  Replace the C++ types with Eiffel types.
Steps to create a class diagram, enter specifications, and generate compilable Eiffel code:
(1) Create the class diagram using Rumbaugh OMT notation or other available notation in the Methodology menu
(2) For each class, enter the following as appropriate in the Class Specification for specific Eiffel code:
-CLASS_USER1 - enter deferred if the class is an abstract class, e.g. deferred or enter Indexing statements,
-CLASS_USER2 - enter the generic type if the class is a generic class, e.g. [T],
-CLASS_USER3 - enter the inherit clause for a single superclass, e.g. deferred  rename  select.
-CLASS_INVARIANT - enter the complete invariant statements, e.g. invariant okGasQuantity: gasQuantity >= 0
You must enter compilabe Eiffel statements into -CLASS_USER1, -CLASS_USER2, -CLASS_USER3, -CLASS_INVARIANT.
-CLASS_LIBRARY_BASE_CLASS - enter the library superclass, e.g. STORABLE
If the class only has a library superclass enter following: inherit STORABLE;
(3) For each attribute enter or select an Eiffel type: BOOLEAN, CHARACTER, INTEGER, REAL, DOUBLE,
ARRAY, STRING.
(4) For each operation, enter the following:
- enter operation parameters in the form operation_type operation_name, e.g. INTEGER aNumber.  Then use the
keyword -PASCAL_OPERATION_PARAMETERS to print the parameters in Eiffel form.
- enter a valid Eiffel type or class in -OPERATION_RETURN_TYPE (remove default void)
- enter one of the following in -OPERATION_TRANSFORMATION: do, deferred, or external.
- enter a precondition in -OPERATION_PRECONDITION including require, e.g.  require okSpeed: aSpeed < 99
- enter a postcondition in -OPERATION_POSTCONDITION including ensure, e.g. ensure okNewSpeed: equal (speed, aSpeed)
- enter a rescue in -OPERATION_EXCEPTION_NAME including rescue, e.g.  rescue speed := 0
(5) In your Eiffel environment, create the ACE file and the system class.  You must manually update the
generated code as follows:
- for deferred classes manually delete the generated creation clause and creation routines
- if a class has multiple superclasses, manually update the inherit clause to ensure redefined
  routines are with the correct superclass
- for objects of generic classes, manually enter the actual generic parameter in the variable declaration, e.g
  myCollection: GENERICCOLLECTION[INTEGER]
- manually update the feature export, e.g. feature {TRIANGLE]
- manually enter unique constants, e.g. red, yellow, blue : INTEGER is unique
(6) This script is a starting point for you to modify to generate the exact code that you desire such as
adding deep copy routines and using collection classes instead of arrays.
NO_OUTPUT_END 

CLASS_USER1 class CLASS_NAME CLASS_USER2 [NO_REPEAT inherit BASE_CLASS ;DELETE_LAST_SYMBOL]
  CLASS_USER3
  CLASS_LIBRARY_BASE_CLASS
creation
  make$CLASS_NAME,
  initialize$CLASS_NAME

feature {ANY}
  SELECT_WHEN ATTRIBUTE_IS_CONSTANT [ATTRIBUTE_NAME : ATTRIBUTE_TYPE is ATTRIBUTE_INITIAL_VALUE ]
  SELECT_WHEN ATTRIBUTE_ACCESS == public [ATTRIBUTE_NAME : ATTRIBUTE_TYPE  ]
  [ASSOCIATION_ONE_NAME : ASSOCIATION_ONE_CLASS  ]
  [AGGREGATION_ONE_NAME : AGGREGATION_ONE_CLASS  ]
  [ASSOCIATION_MANY_NAME : ARRAY LITERAL_SYMBOL[ ASSOCIATION_MANY_CLASS LITERAL_SYMBOL]  ]
  [AGGREGATION_MANY_NAME : ARRAY LITERAL_SYMBOL[ AGGREGATION_MANY_CLASS LITERAL_SYMBOL]  ]

  make$CLASS_NAME is
  do
    [make$BASE_CLASS ]
    SELECT_WHEN LOGICAL_NOT ATTRIBUTE_IS_CONSTANT [ATTRIBUTE_NAME := ATTRIBUTE_INITIAL_VALUE  ]
    [!!ASSOCIATION_ONE_NAME$.make$ASSOCIATION_ONE_CLASS ]
    [!!AGGREGATION_ONE_NAME$.make$AGGREGATION_ONE_CLASS ]
    [!!ASSOCIATION_MANY_NAME$.make (0, 10) ]
    [!!AGGREGATION_MANY_NAME$.make (0, 10) ]
  end  -- make$CLASS_NAME

  ------------------------------------------------------------------------
  initialize$CLASS_NAME (SELECT_WHEN LOGICAL_NOT ATTRIBUTE_IS_CONSTANT [a_$ATTRIBUTE_NAME : ATTRIBUTE_TYPE DELETE_LAST_SYMBOL;] ) is
  do
    SELECT_WHEN LOGICAL_NOT ATTRIBUTE_IS_CONSTANT [ATTRIBUTE_NAME := a_$ATTRIBUTE_NAME]
  end  -- initialize$CLASS_NAME

  SELECT_WHEN OPERATION_ACCESS == public  
  [----------------------------------------------------------------------
  OPERATION_NAME PASCAL_OPERATION_PARAMETERS_PAREN PASCAL_OPERATION_RETURN_TYPE is
  --OPERATION_COMMENT1
  --OPERATION_COMMENT2
  --OPERATION_COMMENT3
    OPERATION_PRECONDITION
    OPERATION_TRANSFORMATION
    OPERATION_POSTCONDITION
    OPERATION_EXCEPTION_NAME
  end -- OPERATION_NAME
  ]
  SELECT_WHEN ATTRIBUTE_ACCESS == public
  [------------------------------------------------------------------------
  set_$ATTRIBUTE_NAME (a_$ATTRIBUTE_NAME : ATTRIBUTE_TYPE$) is
   do
     ATTRIBUTE_NAME := a_$ATTRIBUTE_NAME
   end 
  ]
---------------------------------------------------------------------------  
feature {NONE}

  SELECT_WHEN ATTRIBUTE_ACCESS == private [ATTRIBUTE_NAME : ATTRIBUTE_TYPE  ]
  SELECT_WHEN OPERATION_ACCESS == private
  [----------------------------------------------------------------------
  OPERATION_NAME PASCAL_OPERATION_PARAMETERS_PAREN PASCAL_OPERATION_RETURN_TYPE is
  --OPERATION_COMMENT1
  --OPERATION_COMMENT2
  --OPERATION_COMMENT3
    OPERATION_PRECONDITION
    OPERATION_TRANSFORMATION
    OPERATION_POSTCONDITION
    OPERATION_EXCEPTION_NAME
  end -- OPERATION_NAME
  ]
  CLASS_INVARIANT
end -- class CLASS_NAME

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -