edu.neu.ccs.demeterf.demfgen.classes
Class DemFGenMain

java.lang.Object
  extended by edu.neu.ccs.demeterf.demfgen.classes.DemFGenMain

public class DemFGenMain
extends java.lang.Object

Representation of DemFGenMain


Nested Class Summary
static class DemFGenMain.imports
          Field Class for DemFGenMain.imports
static class DemFGenMain.incl
          Field Class for DemFGenMain.incl
static class DemFGenMain.look
          Field Class for DemFGenMain.look
static class DemFGenMain.pkg
          Field Class for DemFGenMain.pkg
static class DemFGenMain.Subst
          Substitution class, replaces Idents using the given Environment context
static class DemFGenMain.types
          Field Class for DemFGenMain.types
 
Constructor Summary
DemFGenMain(IncludeList incl, PackageDef pkg, LookDef look, ImportList imports, TypeDefList types)
          Construct a(n) DemFGenMain Instance
 
Method Summary
static void abort()
          Quit/Exit due to some error (print before calling)
 boolean equals(java.lang.Object o)
          Is the given object Equal to this DemFGenMain?
static List<TypeDef> flatten(List<DemFGenMain> CD, List<ClassHier.InhrtPair> inhrt)
          Flatten the classes so that fields are represented in all concrete classes (i.e., push common fields down to subtypes)
 ImportList getImports()
          Getter for field DemFGenMain.imports
 IncludeList getIncl()
          Getter for field DemFGenMain.incl
 LookDef getLook()
          Getter for field DemFGenMain.look
 PackageDef getPkg()
          Getter for field DemFGenMain.pkg
 TypeDefList getTypes()
          Getter for field DemFGenMain.types
static void header(java.lang.String lang)
          Print the DemFGen Header for the given language (e.g., "Java" or "C#")
static List<FieldOrSyntax> instantiate(List<FieldOrSyntax> fs, List<java.lang.String> bnds, List<java.lang.String> uses)
          Type instantiation Function Class
static TypeDef instantiate(TypeUse tu, List<TypeDef> aT)
          Instantiate a generic type definition.
static List<TypeDef> justTypes(List<DemFGenMain> CD)
          Get just the TypeDefs from a List of DemFGenMains
static void main(java.lang.String[] args)
          Main entry point for DemFGen.
static List<StrLTrip.StrPair> makeEnv(java.lang.String[] d, java.lang.String[] u, int i)
          Create an environment from definition variables and actual uses
static DemFGenMain parse(java.io.InputStream inpt)
          Parse an instance of DemFGenMain from the given Stream
static DemFGenMain parse(java.io.Reader inpt)
          Parse an instance of DemFGenMain from the given Reader
static DemFGenMain parse(java.lang.String inpt)
          Parse an instance of DemFGenMain from the given String
 java.lang.String print()
          DGP method from Class Print
static List<TypeDef> removeSyntax(List<TypeDef> types)
          Remove all the syntax froma given CD
static List<BehDef> resolveBEHFile(java.io.InputStream in, java.lang.String name)
          Recursively resolve any included BEH files from the given InputStream, starting with the given file name.
static List<BehDef> resolveBEHFile(java.lang.String file)
          Recursively resolve any included BEH files, starting with the given file name.
static List<DemFGenMain> resolveCDFile(java.io.InputStream in, java.lang.String name)
          Recursively resolve any included CD files from the given InputStream, starting with the given file name.
static List<DemFGenMain> resolveCDFile(java.lang.String file)
          Recursively resolve any included CD files, starting with the given file name.
static double seconds(long mil)
          Return the number of Seconds from the given Milliseconds
static List<ClassHier.InhrtPair> subtypes(List<DemFGenMain> CD)
          Return a list of all the suptypes from the given DemFGenMains...
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DemFGenMain

public DemFGenMain(IncludeList incl,
                   PackageDef pkg,
                   LookDef look,
                   ImportList imports,
                   TypeDefList types)
Construct a(n) DemFGenMain Instance

Method Detail

equals

public boolean equals(java.lang.Object o)
Is the given object Equal to this DemFGenMain?

Overrides:
equals in class java.lang.Object

parse

public static DemFGenMain parse(java.lang.String inpt)
                         throws ParseException
Parse an instance of DemFGenMain from the given String

Throws:
ParseException

parse

public static DemFGenMain parse(java.io.InputStream inpt)
                         throws ParseException
Parse an instance of DemFGenMain from the given Stream

Throws:
ParseException

parse

public static DemFGenMain parse(java.io.Reader inpt)
                         throws ParseException
Parse an instance of DemFGenMain from the given Reader

Throws:
ParseException

abort

public static void abort()
Quit/Exit due to some error (print before calling)


header

public static void header(java.lang.String lang)
Print the DemFGen Header for the given language (e.g., "Java" or "C#")


main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
Main entry point for DemFGen. Parses the CD and BEH files, manages arguments, and generates classes. All the real stuff is implemented below, and in separate classes in the "demeterf.demfgen.*" classes.

Throws:
java.lang.Exception

seconds

public static double seconds(long mil)
Return the number of Seconds from the given Milliseconds


resolveCDFile

public static List<DemFGenMain> resolveCDFile(java.lang.String file)
                                       throws java.io.FileNotFoundException
Recursively resolve any included CD files, starting with the given file name.

Throws:
java.io.FileNotFoundException

resolveCDFile

public static List<DemFGenMain> resolveCDFile(java.io.InputStream in,
                                              java.lang.String name)
                                       throws ParseException
Recursively resolve any included CD files from the given InputStream, starting with the given file name. The name is kept around for ParseError feedback to the user.

Throws:
ParseException

resolveBEHFile

public static List<BehDef> resolveBEHFile(java.lang.String file)
                                   throws java.io.FileNotFoundException
Recursively resolve any included BEH files, starting with the given file name.

Throws:
java.io.FileNotFoundException

resolveBEHFile

public static List<BehDef> resolveBEHFile(java.io.InputStream in,
                                          java.lang.String name)
                                   throws ParseException
Recursively resolve any included BEH files from the given InputStream, starting with the given file name. The name is kept around for ParseError feedback to the user.

Throws:
ParseException

justTypes

public static List<TypeDef> justTypes(List<DemFGenMain> CD)
Get just the TypeDefs from a List of DemFGenMains


flatten

public static List<TypeDef> flatten(List<DemFGenMain> CD,
                                    List<ClassHier.InhrtPair> inhrt)
Flatten the classes so that fields are represented in all concrete classes (i.e., push common fields down to subtypes)


removeSyntax

public static List<TypeDef> removeSyntax(List<TypeDef> types)
Remove all the syntax froma given CD


instantiate

public static List<FieldOrSyntax> instantiate(List<FieldOrSyntax> fs,
                                              List<java.lang.String> bnds,
                                              List<java.lang.String> uses)
Type instantiation Function Class


instantiate

public static TypeDef instantiate(TypeUse tu,
                                  List<TypeDef> aT)
Instantiate a generic type definition. Basically replace all occurences of the TypeParameters using the environment implied by the given TypeUse


makeEnv

public static List<StrLTrip.StrPair> makeEnv(java.lang.String[] d,
                                             java.lang.String[] u,
                                             int i)
Create an environment from definition variables and actual uses


subtypes

public static List<ClassHier.InhrtPair> subtypes(List<DemFGenMain> CD)
Return a list of all the suptypes from the given DemFGenMains...


print

public java.lang.String print()
DGP method from Class Print


getTypes

public TypeDefList getTypes()
Getter for field DemFGenMain.types


getImports

public ImportList getImports()
Getter for field DemFGenMain.imports


getLook

public LookDef getLook()
Getter for field DemFGenMain.look


getPkg

public PackageDef getPkg()
Getter for field DemFGenMain.pkg


getIncl

public IncludeList getIncl()
Getter for field DemFGenMain.incl