org.argouml.uml.util.namespace
Interface Namespace

All Known Implementing Classes:
StringNamespace

public interface Namespace

The Namespace interface provides methods and constants which any class dealing with namespaces needs to implement.


Field Summary
static String CPP_NS_TOKEN
          the scope token for c++.
static String JAVA_NS_TOKEN
          the scope token for java.
static String UML_NS_TOKEN
          the scope token for uml.
 
Method Summary
 Namespace getBaseNamespace()
          returns the base of a namespace, e.g.
 Namespace getCommonNamespace(Namespace namespace)
          returns the namespace which is common to both namespaces, e.g.
 boolean isEmpty()
          check if the namespace is empty.
 Iterator iterator()
          return an iterator to the namespace elements.
 NamespaceElement peekNamespaceElement()
          return the innermost namespace element without removing it.
 NamespaceElement popNamespaceElement()
          reduces the innermost namespace element, e.g.
 void pushNamespaceElement(NamespaceElement element)
          add another element to a namespace.
 void setDefaultScopeToken(String token)
          namespaces usually have a scope operator when used in representational form.
 String toString(String token)
          return a string representation of the namespace with the given token.
 

Field Detail

JAVA_NS_TOKEN

public static final String JAVA_NS_TOKEN
the scope token for java.

See Also:
Constant Field Values

UML_NS_TOKEN

public static final String UML_NS_TOKEN
the scope token for uml.

See Also:
Constant Field Values

CPP_NS_TOKEN

public static final String CPP_NS_TOKEN
the scope token for c++.

See Also:
Constant Field Values
Method Detail

getCommonNamespace

public Namespace getCommonNamespace(Namespace namespace)
returns the namespace which is common to both namespaces, e.g. org.argouml.model and org.argouml.util have org.argouml in common.

Parameters:
namespace - a namespace
Returns:
the common or empty namespace

getBaseNamespace

public Namespace getBaseNamespace()
returns the base of a namespace, e.g. the base of org.argouml.util is org.argouml.

Returns:
base namespace

pushNamespaceElement

public void pushNamespaceElement(NamespaceElement element)
add another element to a namespace.

Parameters:
element - the element to add

popNamespaceElement

public NamespaceElement popNamespaceElement()
reduces the innermost namespace element, e.g. org.argouml.model will return model, and change the namespace to org.argouml.

Returns:
the popped element.

peekNamespaceElement

public NamespaceElement peekNamespaceElement()
return the innermost namespace element without removing it.

Returns:
the innermost namespace element

setDefaultScopeToken

public void setDefaultScopeToken(String token)
namespaces usually have a scope operator when used in representational form. see also the predifined constants.

Parameters:
token - the token to use from now on.

iterator

public Iterator iterator()
return an iterator to the namespace elements.

Returns:
an iterator of NamespaceElements.

isEmpty

public boolean isEmpty()
check if the namespace is empty.

Returns:
true if empty

toString

public String toString(String token)
return a string representation of the namespace with the given token. The existence of the method implies that classes also must implement toString() in a reasonable manner using the default token.

Parameters:
token - the token to be converted
Returns:
a string representation of the namespace


ArgoUML © 1996-2004 (20050222)ArgoUML HomepageArgoUML Developers' pageArgoUML Cookbook