UML Modeling Layer

com.ibm.xtools.uml.msl.internal.resources
Class LogicalUMLUnit

java.lang.Object
  extended by com.ibm.xtools.uml.msl.internal.resources.LogicalUMLUnit
All Implemented Interfaces:
ILogicalUMLUnit, ILogicalUnit

public class LogicalUMLUnit
extends Object
implements ILogicalUMLUnit

Unit of logical UML resource, backed by an EMF resource.


Constructor Summary
LogicalUMLUnit(Resource resource, ILogicalUMLUnit parent)
          Constructor
 
Method Summary
 void addChild(ILogicalUMLUnit child)
          Adds child logical unit
 boolean canContain(Resource testResource)
          Tests if the specified resource can be logically contained by the logical unit.
 boolean equals(Object obj)
           
 List<ILogicalUnit> getChildren()
          Returns the logical children units of this logical unit.
 URI getContainerUri()
          Returns the URI of the container of this logical unit.
 ILogicalUnit getParent()
          Returns the logical parent unit of this logical unit.
 ILogicalUMLUnit getParentAsUMLUnit()
          Returns the logical parent unit of this logical unit as UML unit.
 Resource getResource()
          Returns the resource backing the logical unit.
 ResourceHealth getResourceHealth()
          The resource state values give us some indication of the health of the fragment.
 int hashCode()
           
 boolean isAccessible()
           
 void removeChild(ILogicalUMLUnit child)
          Removes child logical unit
 void setContainerUri(URI containerUri)
           
 void setResourceState(ResourceHealth state)
          Set the state for this unit.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LogicalUMLUnit

public LogicalUMLUnit(Resource resource,
                      ILogicalUMLUnit parent)
Constructor

Parameters:
resource - The resource backing the logical unit
parent - The logical parent unit
Method Detail

getResource

public Resource getResource()
Returns the resource backing the logical unit.

Specified by:
getResource in interface ILogicalUnit
Returns:
The resource backing the logical unit

getParent

public ILogicalUnit getParent()
Returns the logical parent unit of this logical unit. If this unit is the root unit of the logical resource then this method returns null.

Specified by:
getParent in interface ILogicalUnit
Returns:
The logical parent unit of this logical unit. May be null.

getParentAsUMLUnit

public ILogicalUMLUnit getParentAsUMLUnit()
Returns the logical parent unit of this logical unit as UML unit. If this unit is the root unit of the logical resource then this method returns null. Parent of a logical UML unit must be a UML logical unit. This method really returns the same unit as getParent - it only enforces the type.

Specified by:
getParentAsUMLUnit in interface ILogicalUMLUnit
Returns:
The logical parent unit of this logical unit as UML unit. May be null.

getChildren

public List<ILogicalUnit> getChildren()
Returns the logical children units of this logical unit. Empty list if it does not have children.

Specified by:
getChildren in interface ILogicalUnit
Returns:
The logical children units of this logical unit

addChild

public void addChild(ILogicalUMLUnit child)
Adds child logical unit

Parameters:
child - Child logical unit

removeChild

public void removeChild(ILogicalUMLUnit child)
Removes child logical unit

Parameters:
child - Child logical unit

canContain

public boolean canContain(Resource testResource)
Tests if the specified resource can be logically contained by the logical unit. For example, circular containment is not allowed.

Specified by:
canContain in interface ILogicalUMLUnit
Parameters:
resource - The resource to test
Returns:
Indicator if the specified resource can be logically contained

equals

public boolean equals(Object obj)
Overrides:
equals in class Object
See Also:
Object.equals(java.lang.Object)

hashCode

public int hashCode()
Overrides:
hashCode in class Object
See Also:
Object.hashCode()

getResourceHealth

public ResourceHealth getResourceHealth()
Description copied from interface: ILogicalUMLUnit
The resource state values give us some indication of the health of the fragment.

Specified by:
getResourceHealth in interface ILogicalUMLUnit
Returns:
An instance of the ResourceState enum.
See Also:
ResourceHealth

setResourceState

public void setResourceState(ResourceHealth state)
Set the state for this unit.

Parameters:
state -

isAccessible

public boolean isAccessible()
Specified by:
isAccessible in interface ILogicalUnit
Returns:
Indicator if the resource is accessible. One possible reason for inaccessibility would be that there is no corresponding file.

getContainerUri

public URI getContainerUri()
Description copied from interface: ILogicalUnit
Returns the URI of the container of this logical unit. If this unit is the root unit of the logical resource then this method returns null.

Specified by:
getContainerUri in interface ILogicalUnit
Returns:
the containerUri

setContainerUri

public void setContainerUri(URI containerUri)
Parameters:
containerUri - the containerUri to set

UML Modeling Layer

© Copyright IBM Corp. 2009. All rights reserved.