|
||||||||||
| PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES | |||||||||
See:
Description
| Class Summary | |
|---|---|
| Concrete | |
| DGPFunc | |
| Display | |
| DisplayToString | |
| PrintToString | |
| StaticTrav | |
| ToStr | |
| ToString | |
DemFGen based datatype generic programming classes and interfaces.
The class DGPFunc can be extended to implement functionality over all the
classes in a given CD. This is done with a DemeterF traversal over the
CD-of-CDs as defined in the DemFGen CD file:
edu/neu/ccs/demeterf/demfgen/generation/program.cd.dfg
DGPFunc implements the default usage, which introduces a no argument method that is the same as the class name in C#; in Java the method has it's first letter as lowercase. (e.g., Print -> public String print(){...}). Various methods in the base class affect how the methods are generated and how the CD-of-CDs is traversed. See the source for classes Concrete/Print/Display for details.
There are multiple examples of useful functions including Print, ToStr, ToString, PrintToString, and Display. Print and Display are almost exactly the same as the corresponding visitors in DemeterJ. The others are similar.
The functions to be generated are specified as an argument to DemFGen with the option: --dgp: immediately followed by a list of DGPFunc class names separated by colons (":").
CD: main.cdSee individual source files for more details.MainC = <a> A. A = "(" + *l <b> B *l <c> C - *l ")". B = "Bee" *s <i> int. C = "Cee" *s <s> String.
BEH (Java): main.behMainC{{ public static void main(String[] s) throws Exception{ MainC m = MainC.parse("(Bee -54 Cee \"Test\")"); System.out.println("\nPrint:\n"+m.print()); System.out.println("\nDisplay:\n"+m.display()); } }}
BEH (C#): main.cs.behMainC{{ public static void Main(String[] s){ MainC m = MainC.parse("(Bee 54 -Cee \"Test\")"); Console.WriteLine("\nPrint:\n"+m.Print()); Console.WriteLine("\nDisplay:\n"+m.Display()); } }}
Build With:Java: java DemFGen main.cd main.beh ./ --build --dgp:Print:Display C#: java DemFGenCS main.cd main.cs.beh ./ --build --dgp:Print:Display
Run With:Java: java MainC C#: ./MAIN.exe
Output (For Both):Print: ( Bee -54 Cee "Test" ) Display: : MainC ( <a> : A ( <b> : B ( <i> : int "-54" ) <c> : C ( <s> : String "Test" ) ) )
|
||||||||||
| PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES | |||||||||