gov.llnl.babel.symbols
Class SymbolUtilities
java.lang.Object
gov.llnl.babel.symbols.SymbolUtilities
public class SymbolUtilities
extends java.lang.Object
Utility class SymbolUtilities
is a collection of common,
simple symbol manipulation functions. All methods are declared as static.
static String | getOutermostPackage(String fqn) - Return the outermost package prefix for the name (everything up to
but not including the first ".").
|
static String | getParentPackage(String fqn) - Return the parent package for the name (everything up to but not
including the last ".".
|
static Version | getParentVersion(String fqn, Context context) - Return the version associated with the parent package.
|
static String | getSymbolName(String full_name, 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 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, String name) - Return the version of the symbol.
|
static String | getVersionString(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 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(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, 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.
|
getOutermostPackage
public static String getOutermostPackage(String fqn)
Return the outermost package prefix for the name (everything up to
but not including the first ".").
getParentPackage
public static String getParentPackage(String fqn)
Return the parent package for the name (everything up to but not
including the last ".". If the name does not contain a parent,
then null is returned.
getParentVersion
public static Version getParentVersion(String fqn,
Context context)
Return the version associated with the parent package.
fqn
- the fully qualified name of the symbol being checked
- the version associated with its parent package, if any
getSymbolName
public static String getSymbolName(String full_name,
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. Returns null if either parameters are null.
full_name
- the fully qualified name being checkedpkg
- the parent package name being used for comparison
getSymbolName
public static 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.
fid
- the symbol id of the first symbol being checked.sid
- the symbol id of the second symbol being checked.
getVersion
public static Version getVersion(Context context,
String name)
Return the version of the symbol.
getVersionString
public static String getVersionString(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.
vers
- the symbol whose version string is to be built
- the expanded version string
getVersionString
public static 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.
id
- the version whose expanded version string is to be built
- the expanded version string
hasParentPackage
public static boolean hasParentPackage(String fqn)
Return true if the symbol is at the highest level (i.e., has no
parent package); otherwise, return false.
fqn
- the fully qualified name of the symbol whose parentage is
being checked
- a boolean indicating if the symbol has a parent package or not
hasParentPackage
public static boolean hasParentPackage(SymbolID id)
Return true if the symbol is not at the highest level (i.e., has
parent package); otherwise, return false.
id
- the symbol id whose parentage is being checked
- a boolean indicating if the symbol has a parent package or not
isBase
public static boolean isBase(SymbolID id)
Return true if the specified symbol is one of the base sidl symbols;
otherwise, return false.
id
- the symbol id of the symbol being checked
- a boolean indicating if the symbol is a base sidl symbol
isBaseException
public static boolean isBaseException(SymbolID id)
Return true if the specified symbol is one of the base sidl
exception symbols; otherwise, return false.
id
- the symbol id of the symbol being checked
- a boolean indicating if the symbol is a base exception symbol
sameVersionAsParent
public static boolean sameVersionAsParent(Context context,
String fqn)
Return true if the symbol has a parent with the same version number;
otherwise, return false.
fqn
- the fully qualified name of the symbol being checked
- a boolean indicating if the symbol has a parent with same version
sameVersionAsParent
public static boolean sameVersionAsParent(Context context,
SymbolID id)
Return true if the symbol has a parent with the same version number;
otherwise, return false.
id
- the symbol id of the symbol being checked
- a boolean indicating if the symbol has a parent with same version