com.bbn.swede.editor.visualeditors.restriction
Class OASTNameResolver

java.lang.Object
  extended bycom.bbn.swede.editor.visualeditors.restriction.OASTNameResolver
All Implemented Interfaces:
IOASTChangeListener

public class OASTNameResolver
extends Object
implements IOASTChangeListener

Resolves URIs against the document's OAST.

Author:
aperezlo

Field Summary
protected  String _baseURI
          The base URI of the document.
protected  HashMap _namespaceToURI
          Map of namespace abbreviations to URIs.
protected  IOWLAbstractSyntaxTree _oast
          The OAST to resolve against.
protected  HashMap _uriToNamespace
          Map of URIs to namespace abbreviations.
 
Constructor Summary
OASTNameResolver(IOWLAbstractSyntaxTree oast)
          Creates a resolver for the specified OAST.
 
Method Summary
 void cleanUp()
          Cleans up resources used by the resolver.
 String getQNameForURI(String sUri)
          Translates a URI into a qualified name.
 String getURIForQName(String qName)
          Translates a qualified name into a full URI.
 void init()
          Intializes the resolver.
protected  void loadNamespaces()
          Searches the OAST for namespace nodes.
 void oastChanged(OASTEvent event)
          This method is called automatically after the OAST is changed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_oast

protected IOWLAbstractSyntaxTree _oast
The OAST to resolve against.


_namespaceToURI

protected HashMap _namespaceToURI
Map of namespace abbreviations to URIs.


_uriToNamespace

protected HashMap _uriToNamespace
Map of URIs to namespace abbreviations.


_baseURI

protected String _baseURI
The base URI of the document.

Constructor Detail

OASTNameResolver

public OASTNameResolver(IOWLAbstractSyntaxTree oast)
Creates a resolver for the specified OAST.

Parameters:
oast - the OAST
Method Detail

init

public void init()
Intializes the resolver.


loadNamespaces

protected void loadNamespaces()
Searches the OAST for namespace nodes.


cleanUp

public void cleanUp()
Cleans up resources used by the resolver.


getURIForQName

public String getURIForQName(String qName)
Translates a qualified name into a full URI.

Parameters:
qName - The qualified name
Returns:
The full URI of the qname, or null if it does not match a namespace abbreviation in the document.

getQNameForURI

public String getQNameForURI(String sUri)
Translates a URI into a qualified name.

Parameters:
sUri - The URI
Returns:
A qualified name corresponding to the URI, or null if there is no namespace abbreviation for the URI.

oastChanged

public void oastChanged(OASTEvent event)
Description copied from interface: IOASTChangeListener
This method is called automatically after the OAST is changed. When this is called, the nodes in event.getRemoved() are no longer in the tree, and the nodes in event.getInserted() have been placed in the tree at their proper positions.

Specified by:
oastChanged in interface IOASTChangeListener
Parameters:
event - Describes the change that was just made to the OAST.


Copyright © 2004-2005 BBN Technologies. All Rights Reserved.