| 
 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectgov.llnl.babel.backend.Utilities
public class Utilities
The Utilities class contains a variety of common
 utility functions, such as sorting a collection of data or
 determining the maximum string width of a collection of data.
| Field Summary | |
|---|---|
| static java.lang.String | s_exceptionThe argument name that holds the exception pointer which a method may throw an exception. | 
| static java.lang.String | s_selfThe argument name that holds the object/interface pointer in a call to an object method. | 
| Constructor Summary | |
|---|---|
| Utilities() | |
| Method Summary | |
|---|---|
| static java.lang.String | capitalize(java.lang.String str) | 
| static java.util.Collection | convertIdsToSymbols(Context context,
                    java.util.Collection symbolIDs)Convert a collection of SymbolIDobjects into a collection
 ofSymbolobjects using the symbol table. | 
| static java.util.List | extendArgs(SymbolID selfId,
           Method m,
           boolean indices,
           Context context)Add extra arguments to the original argument list of a method as needed for the self pointer and the exception argument. | 
| static java.util.Set | getAllParents(Class cls)Return all parents of this class, including both class parents and interface parents. | 
| static java.lang.String | getEnumInitialization(Context context,
                      SymbolID enumID) | 
| static java.lang.String | getTypeInitialization(Type type,
                      Context context) | 
| static java.util.Set | getUniqueInterfaceIDs(Class cls)Extract the unique interfaces from this class and return them as a set of SymbolIDobjects. | 
| static java.util.Set | getUniqueInterfaces(Class cls)Extract the unique interfaces from this class. | 
| static int | getWidth(java.util.Collection collection)Determine the maximum width of a set of objects. | 
| static boolean | isException(Symbol sym,
            Context context)Return trueif and only if the extendable is
 a class that is the base exception class, is an interface that is
 the base exception interface, or it has the base exception class or 
 interface in its type ancestry. | 
| static boolean | isPointer(Type t)Return trueif and only if this type is implemented in 
 C by a type that is a pointer. | 
| static Symbol | lookupSymbol(Context context,
             java.lang.String fqn)Lookup a symbol entry in the singleton symbol table by fully qualified name. | 
| static Symbol | lookupSymbol(Context context,
             SymbolID id)Lookup a symbol entry in the singleton symbol table. | 
| static java.lang.String | replace(java.lang.String source,
        java.lang.String from,
        java.lang.String to)This method allows substring replacement Unfortunately the java.lang.String class has a replace function for characters but not strings. | 
| static java.util.ArrayList | sort(java.util.Collection collection)Sort a Collectionof objects into ascending order and
 return the sorted list in anArrayListobject. | 
| Methods inherited from class java.lang.Object | 
|---|
| clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| Field Detail | 
|---|
public static final java.lang.String s_self
public static final java.lang.String s_exception
| Constructor Detail | 
|---|
public Utilities()
| Method Detail | 
|---|
public static java.util.ArrayList sort(java.util.Collection collection)
Collection of objects into ascending order and
 return the sorted list in an ArrayList object.
public static int getWidth(java.util.Collection collection)
public static java.util.Set getUniqueInterfaces(Class cls)
Interface.
public static java.util.Set getUniqueInterfaceIDs(Class cls)
SymbolID objects.
public static java.util.Set getAllParents(Class cls)
Set contains the symbol
 identifiers of all parents.
public static Symbol lookupSymbol(Context context,
                                  SymbolID id)
                           throws CodeGenerationException
CodeGenerationException
public static Symbol lookupSymbol(Context context,
                                  java.lang.String fqn)
                           throws CodeGenerationException
CodeGenerationException
public static java.lang.String getEnumInitialization(Context context,
                                                     SymbolID enumID)
                                              throws CodeGenerationException
CodeGenerationException
public static java.lang.String getTypeInitialization(Type type,
                                                     Context context)
                                              throws CodeGenerationException
CodeGenerationException
public static java.util.Collection convertIdsToSymbols(Context context,
                                                       java.util.Collection symbolIDs)
SymbolID objects into a collection
 of Symbol objects using the symbol table.
symbolIDs - a collection of SymbolID objects.
Symbol objects. There is a
         one-to-one and onto correspondence between elements in the
         return value and elements in symbolIDs.Symbol, 
SymbolID
public static java.lang.String replace(java.lang.String source,
                                       java.lang.String from,
                                       java.lang.String to)
source - The string to do the replacement onfrom - The substring to match and replaceto - The new string to insert in place of the matched substring
public static boolean isPointer(Type t)
true if and only if this type is implemented in 
 C by a type that is a pointer.
t - the type to be evaluated.
true is returned if and only if this type
            is implemented by a type that is a pointer.
public static java.util.List extendArgs(SymbolID selfId,
                                        Method m,
                                        boolean indices,
                                        Context context)
                                 throws CodeGenerationException
selfId - the name of the class/interface who owns the method.m - the method whose argument list will be extended.indices - True if the argument list should include rarray
                 indices. True from C binding.
CodeGenerationException - a catch all exception for problems in the code generation phase.
public static boolean isException(Symbol sym,
                                  Context context)
true if and only if the extendable is
 a class that is the base exception class, is an interface that is
 the base exception interface, or it has the base exception class or 
 interface in its type ancestry.
public static java.lang.String capitalize(java.lang.String str)
| 
 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||