Business Objects
Quark Platform Documentation
Version 1.7.0_0
Business Objects

org.openquark.cal.compiler
Class QualifiedName

java.lang.Object
  extended by org.openquark.cal.compiler.QualifiedName
All Implemented Interfaces:
Comparable<QualifiedName>, Name

public final class QualifiedName
extends Object
implements Name, Comparable<QualifiedName>

A simple wrapper class for holding onto names qualified by their module source. There are also a variety of static constants representing the names of well known Prelude type constructors, data constructors and functions. This class must remain immutable.

Author:
Bo Ilic

Method Summary
 Object clone()
          Return a clone of this object.
 int compareTo(QualifiedName otherName)
          Provides an ordering on QualifiedNames where the module part is compared first, as String values, followed by the unqualified part.
 boolean equals(Object other)
           
 boolean equals(QualifiedName otherName)
           
 ModuleName getModuleName()
          
 String getQualifiedName()
           
 String getUnqualifiedName()
           
 int hashCode()
           
static boolean isValidCompoundName(String compoundName)
          Return whether a string is a valid qualified name.
 boolean lowercaseFirstChar()
          Can be used to quickly triage whether a qualified name is in the lowercase namespace (functions, class methods) or the uppercase namespace (type classes, type constructors, data constructors).
static QualifiedName make(ModuleName moduleName, String unqualifiedName)
          Factory method for constructing a QualifiedName from a module name and an unqualified name.
static QualifiedName make(String moduleName, String unqualifiedName)
          Factory method for constructing a QualifiedName from a module name and an unqualified name.
static QualifiedName makeFromCompoundName(String compoundName)
          A helper function that makes a QualifiedName from a compound name String.
 String toSourceText()
          
 String toString()
          
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

make

public static QualifiedName make(ModuleName moduleName,
                                 String unqualifiedName)
Factory method for constructing a QualifiedName from a module name and an unqualified name.

Parameters:
moduleName - the module name.
unqualifiedName - the unqualified name.
Returns:
an instance of QualifiedName.

make

public static QualifiedName make(String moduleName,
                                 String unqualifiedName)
Factory method for constructing a QualifiedName from a module name and an unqualified name.

Parameters:
moduleName - the module name.
unqualifiedName - the unqualified name.
Returns:
an instance of QualifiedName.

compareTo

public int compareTo(QualifiedName otherName)
Provides an ordering on QualifiedNames where the module part is compared first, as String values, followed by the unqualified part.

Specified by:
compareTo in interface Comparable<QualifiedName>
Parameters:
otherName -
Returns:
int

equals

public boolean equals(Object other)
Overrides:
equals in class Object
Parameters:
other -
Returns:
boolean true if other is an instance of QualifiedName and both the module and unqualified parts are the same as that of this QualifiedName.

equals

public boolean equals(QualifiedName otherName)
Parameters:
otherName -
Returns:
true if both the module name and unqualified parts for otherName are that same as that of this QualifiedName.

getModuleName

public ModuleName getModuleName()

Specified by:
getModuleName in interface Name
Returns:
the module part of the qualified name e.g. for "List.filter" this would be "List".

getQualifiedName

public String getQualifiedName()
Returns:
the full name, represented as a string e.g. "List.filter".

toSourceText

public String toSourceText()

Specified by:
toSourceText in interface Name
Returns:
the full name, represented as a string e.g. "List.filter".

getUnqualifiedName

public String getUnqualifiedName()
Returns:
the name, without its module part e.g. "filter".

hashCode

public int hashCode()
Overrides:
hashCode in class Object
Returns:
int

makeFromCompoundName

public static QualifiedName makeFromCompoundName(String compoundName)
A helper function that makes a QualifiedName from a compound name String.

Creation date: (7/16/01 2:34:12 PM)

Parameters:
compoundName - a name of the form moduleName.unqualifiedName, where moduleName can be a hierarchical module name containing one or more components separated by '.'.
Returns:
a new QualifiedName

isValidCompoundName

public static boolean isValidCompoundName(String compoundName)
Return whether a string is a valid qualified name.

Parameters:
compoundName - a name of the form moduleName.unqualifiedName, where moduleName can be a hierarchical module name containing one or more components separated by '.'.
Returns:
boolean whether the name is a valid compound name.

toString

public String toString()

Overrides:
toString in class Object

clone

public Object clone()
             throws CloneNotSupportedException
Return a clone of this object.

Overrides:
clone in class Object
Returns:
a clone of this QualifiedName
Throws:
CloneNotSupportedException

lowercaseFirstChar

public boolean lowercaseFirstChar()
Can be used to quickly triage whether a qualified name is in the lowercase namespace (functions, class methods) or the uppercase namespace (type classes, type constructors, data constructors).

Returns:
true if the unqualified name has a lowercase ascii letter as its first letter. False otherwise.

Business Objects
Quark Platform Documentation
Version 1.7.0_0
Business Objects

Copyright © 2007 Business Objects. All rights reserved.