com.bbn.swede.core.resources
Class OWLElement

java.lang.Object
  extended bycom.bbn.swede.core.resources.OWLElement
All Implemented Interfaces:
IOWLElement
Direct Known Subclasses:
LibraryOWLDocument, OWLClass, OWLDocument, OWLFolder, OWLLibrary, OWLModel, OWLProject, OWLProperty

public abstract class OWLElement
extends Object
implements IOWLElement

Common implementation for OWL elements.

Author:
jlerner

Field Summary
protected  IOWLElement _elemParent
          The parent of the element within the OWL model.
protected  OWLElementInfo _info
          The element info for the element.
protected  IResource _resource
          The Eclipse resource that most closely corresponds to this element.
protected  String _sElementName
          The name of the element.
 
Constructor Summary
OWLElement()
           
 
Method Summary
 void accept(IOWLElementVisitor visitor)
          Accepts the given visitor.
 boolean contains(IResource resource)
          Checks if this element or one of its decendents is based on a particular Eclipse resource.
 Object getAdapter(Class adapter)
           
 IOWLElement getCorrespondingElement(IResource resource)
          Locates the OWL Element corresponding to a particular Eclipse resource.
 IResource getCorrespondingResource()
          Returns the resource that corresponds to this element.
 OWLElementInfo getElementInfo()
          Returns the OWLElementInfo for an OWL resource, creating it first if this is the first time it has been requested.
 String getElementName()
          Returns the name of this element.
 String getLocalURI()
          Returns a file: URI indicating the resource's location on the filesystem.
 IOWLElement getParent()
          Returns the element directly containing this element.
 IPath getPath()
          Returns the path to the innermost resource enclosing this element.
 IResource getResource()
          Returns the innermost enclosing resource of this element.
 String getURI()
          Returns the URI of the OWL element, or null if it has no URI.
 boolean isReadOnly()
          Indicates whether the OWL element is read-only.
 void setElementName(String sNewName)
          Sets the name of the element.
 void setParent(IOWLElement elem)
          Sets the parent of this element.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_elemParent

protected IOWLElement _elemParent
The parent of the element within the OWL model. All elements besides the singleton instance of IOWLModel have a parent.


_resource

protected IResource _resource
The Eclipse resource that most closely corresponds to this element.


_sElementName

protected String _sElementName
The name of the element.


_info

protected OWLElementInfo _info
The element info for the element. This is created on demand by getElementInfo().

Constructor Detail

OWLElement

public OWLElement()
Method Detail

getParent

public IOWLElement getParent()
Description copied from interface: IOWLElement
Returns the element directly containing this element.

Specified by:
getParent in interface IOWLElement
Returns:
the parent element, or null if it has no parent.

setParent

public void setParent(IOWLElement elem)
Description copied from interface: IOWLElement
Sets the parent of this element.

Specified by:
setParent in interface IOWLElement
Parameters:
elem - The parent element

getPath

public IPath getPath()
Description copied from interface: IOWLElement
Returns the path to the innermost resource enclosing this element. This is the full path relative to the workbench

Specified by:
getPath in interface IOWLElement
Returns:
the path to the innermost enclosing resource

getResource

public IResource getResource()
Description copied from interface: IOWLElement
Returns the innermost enclosing resource of this element. This may be a resource that corresponds directly to this element.

Specified by:
getResource in interface IOWLElement
Returns:
the innermost enclosing resource of this element

getCorrespondingResource

public IResource getCorrespondingResource()
Description copied from interface: IOWLElement
Returns the resource that corresponds to this element. Not all OWL elements have a corresponding resource.

Specified by:
getCorrespondingResource in interface IOWLElement
Returns:
the corresponding resource or null if none exists.

getElementName

public String getElementName()
Description copied from interface: IOWLElement
Returns the name of this element.

Specified by:
getElementName in interface IOWLElement
Returns:
the element name

setElementName

public void setElementName(String sNewName)
Sets the name of the element.

Parameters:
sNewName - The new element name.

isReadOnly

public boolean isReadOnly()
Description copied from interface: IOWLElement
Indicates whether the OWL element is read-only.

Specified by:
isReadOnly in interface IOWLElement
Returns:
true if this element is read-only

getURI

public String getURI()
Description copied from interface: IOWLElement
Returns the URI of the OWL element, or null if it has no URI.

Specified by:
getURI in interface IOWLElement
Returns:
the full URI of the element or null to indicate no URI

getLocalURI

public String getLocalURI()
Description copied from interface: IOWLElement
Returns a file: URI indicating the resource's location on the filesystem.

Specified by:
getLocalURI in interface IOWLElement
Returns:
String of the local URI

getAdapter

public Object getAdapter(Class adapter)

getElementInfo

public OWLElementInfo getElementInfo()
Description copied from interface: IOWLElement
Returns the OWLElementInfo for an OWL resource, creating it first if this is the first time it has been requested.

Specified by:
getElementInfo in interface IOWLElement
Returns:
an OWLElementInfo instance with detailed information about the element

contains

public boolean contains(IResource resource)
Description copied from interface: IOWLElement
Checks if this element or one of its decendents is based on a particular Eclipse resource.

Specified by:
contains in interface IOWLElement
Parameters:
resource - The resource to attempt to locate
Returns:
true if the specified IResource corresponds to an OWL element descended from this one

getCorrespondingElement

public IOWLElement getCorrespondingElement(IResource resource)
Description copied from interface: IOWLElement
Locates the OWL Element corresponding to a particular Eclipse resource.

Specified by:
getCorrespondingElement in interface IOWLElement
Parameters:
resource - An Eclipse resource to locate in the OWL model
Returns:
The OWL Element that corresponds directly to resource, or null if there is no such element

accept

public final void accept(IOWLElementVisitor visitor)
Description copied from interface: IOWLElement
Accepts the given visitor. The visitor's visit method is called with this element. If the visitor returns true, this method will also visit the element's children.

Specified by:
accept in interface IOWLElement
Parameters:
visitor - The visitor


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