gov.llnl.babel.symbols
public class SymbolUtilities extends java.lang.Object
SymbolUtilities
is a collection of common,
simple symbol manipulation functions. All methods are declared as static.Modifier and Type | Method and Description |
---|---|
static java.lang.String |
getOutermostPackage(java.lang.String fqn)
Return the outermost package prefix for the name (everything up to
but not including the first ".").
|
static java.lang.String |
getParentPackage(java.lang.String fqn)
Return the parent package for the name (everything up to but not
including the last ".".
|
static Version |
getParentVersion(java.lang.String fqn,
Context context)
Return the version associated with the parent package.
|
static java.lang.String |
getSymbolName(java.lang.String full_name,
java.lang.String pkg)
Return the short name of the string holding the fully qualified name
if it is in the specified package; otherwise, return the fully qualified
name.
|
static java.lang.String |
getSymbolName(SymbolID fid,
SymbolID sid)
Return the short name of the first symbol if it is in the same package
as the second symbol; otherwise, return its long name.
|
static Version |
getVersion(Context context,
java.lang.String name)
Return the version of the symbol.
|
static java.lang.String |
getVersionString(java.lang.String vers)
Return the version string (i.e., "version " followed by the number) or
null if the version is exactly "0" based on the specified version string.
|
static java.lang.String |
getVersionString(SymbolID id)
Return the version string (i.e., " version " followed by the number) or
null if the version is exactly "0" for the specified symbol.
|
static boolean |
hasParentPackage(java.lang.String fqn)
Return true if the symbol is at the highest level (i.e., has no
parent package); otherwise, return false.
|
static boolean |
hasParentPackage(SymbolID id)
Return true if the symbol is not at the highest level (i.e., has
parent package); otherwise, return false.
|
static boolean |
isBase(SymbolID id)
Return true if the specified symbol is one of the base sidl symbols;
otherwise, return false.
|
static boolean |
isBaseException(SymbolID id)
Return true if the specified symbol is one of the base sidl
exception symbols; otherwise, return false.
|
static boolean |
sameVersionAsParent(Context context,
java.lang.String fqn)
Return true if the symbol has a parent with the same version number;
otherwise, return false.
|
static boolean |
sameVersionAsParent(Context context,
SymbolID id)
Return true if the symbol has a parent with the same version number;
otherwise, return false.
|
public static java.lang.String getOutermostPackage(java.lang.String fqn)
public static java.lang.String getParentPackage(java.lang.String fqn)
public static boolean hasParentPackage(SymbolID id)
id
- the symbol id whose parentage is being checkedpublic static boolean hasParentPackage(java.lang.String fqn)
fqn
- the fully qualified name of the symbol whose parentage is
being checkedpublic static boolean sameVersionAsParent(Context context, SymbolID id)
id
- the symbol id of the symbol being checkedpublic static boolean sameVersionAsParent(Context context, java.lang.String fqn)
fqn
- the fully qualified name of the symbol being checkedpublic static Version getVersion(Context context, java.lang.String name)
public static Version getParentVersion(java.lang.String fqn, Context context)
fqn
- the fully qualified name of the symbol being checkedpublic static boolean isBaseException(SymbolID id)
id
- the symbol id of the symbol being checkedpublic static boolean isBase(SymbolID id)
id
- the symbol id of the symbol being checkedpublic static java.lang.String getSymbolName(SymbolID fid, SymbolID sid)
fid
- the symbol id of the first symbol being checked.sid
- the symbol id of the second symbol being checked.public static java.lang.String getSymbolName(java.lang.String full_name, java.lang.String pkg)
full_name
- the fully qualified name being checkedpkg
- the parent package name being used for comparisonpublic static java.lang.String getVersionString(java.lang.String vers)
vers
- the symbol whose version string is to be builtpublic static java.lang.String getVersionString(SymbolID id)
id
- the version whose expanded version string is to be built