Home Page   We Generate Your Software.
Products Services Company Technology Demo Contact Site Map Search
Please note: this document is currently under revision.
The information herein contained, while still valid, does not reflect the latest state of the described technology.
The Somusar/SoProTech[tm] Booklet Series
Volume IV

"somusar/Tefigel: A Tutorial Introduction"

Printer friendly


Contents
1. Introduction
2. Language Summary
3. Text File Components
4. Text File Processing
5. Modularity
6. Multilanguage Applicability
7. Generating Object-oriented Languages
7.1 Java[tm]
7.2 C#
7.3 C++
8. Generating Internet-oriented Languages and Protocols
9. Generating Procedural Languages
10. Generating Scripting or Special-purpose Languages
11. Advanced Features and Topics
12. A More Extensive Example
13. Further Reading

Chapter 7 - Generating Object-oriented Languages

7.1 - Java[tm]        top

Code Example 21 - Generating Java[tm]
Generate set and get methods for two members of a Java class.
Source code - File "language/j_getset"
    1      @ dash &
    2      @ language/java/get_set(int,Quantity,quantity)
    3      @ language/java/get_set(double,Percentage,percentage)
	       
Output of "/opt/somusar/bin/tefigel language/j_getset"
    1          public int getQuantity() {
    2              return quantity;
    3          }
    4      
    5          public void setQuantity( int quantity ) {
    6              this.quantity = quantity;
    7          }
    8      
    9          public double getPercentage() {
   10              return percentage;
   11          }
   12      
   13          public void setPercentage( double percentage ) {
   14              this.percentage = percentage;
   15          }
   16      
	       

Java[tm] get/set subroutine - File "language/java/get_set"
    1      @ interface(TYPE,IdId,idId)
    2          public TYPE get&IdId() {
    3              return idId;
    4          }
    5      
    6          public void set&IdId( TYPE idId ) {
    7              this.idId = idId;
    8          }
    9      
	       

7.2 - C#        top

Code Example 22 - Generating C#
Generate set and get methods for two members of a C# class.
Source code - File "language/cs_getset"
    1      @ dash &
    2      @ language/cs/get_set(int,Quantity,quantity)
    3      @ language/cs/get_set(double,Percentage,percentage)
	       
Output of "/opt/somusar/bin/tefigel language/cs_getset"
    1          public int Quantity {
    2              get {
    3                  return quantity;
    4              }
    5              set {
    6                  quantity = value;
    7              }
    8          }
    9      
   10          public double Percentage {
   11              get {
   12                  return percentage;
   13              }
   14              set {
   15                  percentage = value;
   16              }
   17          }
   18      
	       

C# get/set subroutine - File "language/cs/get_set"
    1      @ interface(TYPE,IdId,idId)
    2          public TYPE IdId {
    3              get {
    4                  return idId;
    5              }
    6              set {
    7                  idId = value;
    8              }
    9          }
   10      
	       

7.3 - C++        top

Code Example 23 - Generating C++
Generate set and get methods for two members of a C++ class.
Source code - File "language/cpp_getset"
    1      @ dash &
    2      @ language/cpp/get_set(int,Quantity,quantity)
    3      @ language/cpp/get_set(double,Percentage,percentage)
	       
Output of "/opt/somusar/bin/tefigel language/cpp_getset"
    1          int getQuantity() {
    2              return quantity;
    3          }
    4      
    5          void setQuantity( int quantity ) {
    6              this->quantity = quantity;
    7          }
    8      
    9          double getPercentage() {
   10              return percentage;
   11          }
   12      
   13          void setPercentage( double percentage ) {
   14              this->percentage = percentage;
   15          }
   16      
	       

C++ get/set subroutine - File "language/cpp/get_set"
    1      @ interface(TYPE,IdId,idId)
    2          TYPE get&IdId() {
    3              return idId;
    4          }
    5      
    6          void set&IdId( TYPE idId ) {
    7              this->idId = idId;
    8          }
    9      
	       

[Previous chapter]    [Next chapter]    [Back to top]

http:// www.somusar.com  / doc  / booklets  / tefigel_tut  - Powered by SoProMach
Copyright © 2003-2012 Somusar - Trademarks - Legal - Privacy - Webmaster