org.pf.tools.cda.base.model
Class SoftwareComponent

java.lang.Object
  extended by org.pf.tools.cda.base.model.AModelObject
      extended by org.pf.tools.cda.base.model.AAnalyzableElement
          extended by org.pf.tools.cda.base.model.GenericClassContainer
              extended by org.pf.tools.cda.base.model.SoftwareComponent
All Implemented Interfaces:
java.lang.Comparable, org.pf.bif.lifecycle.IReleasable, IAnalyzableElement, IClassContainingElement, IComponentHolder, IContainer, IExplorableElement, IExplorableElementVisiting, IExplorationModelObject, IObjectProperties, IStructureVisiting

public class SoftwareComponent
extends GenericClassContainer
implements IComponentHolder

Represents the logical grouping of packages including all their classes to a software component.

Version:
1.0
Author:
M.Duchrow

Field Summary
static SoftwareComponent[] EMPTY_ARRAY
           
 
Fields inherited from class org.pf.tools.cda.base.model.GenericClassContainer
EMPTY_GENERIC_CONTAINER_ARRAY
 
Fields inherited from class org.pf.tools.cda.base.model.AModelObject
EMPTY_MODEL_OBJECT_ARRAY
 
Fields inherited from interface org.pfsw.odem.IContainer
EMPTY_CONTAINER_ARRAY
 
Fields inherited from interface org.pf.tools.cda.base.model.IAnalyzableElement
EMPTY_BASE_ARRAY
 
Constructor Summary
SoftwareComponent(java.lang.String aName, Workset aWorkset)
          Initialize the new instance with default values.
 
Method Summary
 void addComponent(SoftwareComponent component)
          Add the given component
 void addContainerInfo(ContainerInfo info)
           
 boolean addPackageIfContainerMatches(ClassPackage pack)
          Adds the given package to the components package list if the package belongs to a container that is defined as part of this component.
 boolean addPackageIfPatternMatches(ClassPackage pack)
          Adds the given package to the components package list if the package name matches any of the component's package name patterns.
 void addPackagePattern(java.lang.String pattern)
          Adds the given pattern.
 void addPackagePatterns(java.util.Collection<java.lang.String> patterns)
          Adds all patterns from the given collection.
 boolean addPackageToThisOrSubComponentIfPatternMatches(ClassPackage pack)
          Adds the given package to this component or one of its sub-components if any package name pattern matches the name of the given package.
static SoftwareComponent[] collectionToArray(java.util.Collection coll)
           
 int compareTo(java.lang.Object obj)
           
 void detachParentComponentHolder()
          Detaches this component from its current parent.
 boolean equals(java.lang.Object obj)
           
 SoftwareComponent[] getComponents()
          Returns all sub components this component contains
 java.util.List<ContainerInfo> getContainerInfoList()
           
 java.lang.String getDescription()
           
 java.lang.String getName()
          Returns the name
 java.util.Collection<java.lang.String> getNamespacePatterns()
           
 org.pf.text.StringPatternCollection getPackagePatterns()
           
 IComponentHolder getParentComponentHolder()
          Returns the parent holder that contains this object.
 int hashCode()
           
 boolean isSoftwareComponent()
          Returns true because this container represents a modelled software component.
 boolean isValid()
          Returns true if this class container is valid.
 boolean processSoftwareComponents(java.util.Collection collection, ISoftwareComponentProcessor processor)
          Calls the given processor for each contained component object and adds all component objects that the processor wants to the given collection.
 void removeComponent(SoftwareComponent component)
          Remove the given component
 void resetPackagePatterns()
          Removes all package patterns currently defined in this component.
 void setContainerInfoList(java.util.List<ContainerInfo> newValue)
           
 void setDescription(java.lang.String newValue)
           
 void setName(java.lang.String newValue)
           
 void setPackagePatterns(org.pf.text.StringPatternCollection newValue)
           
 void setParentComponentHolder(IComponentHolder newValue)
           
 java.lang.String toString()
           
 
Methods inherited from class org.pf.tools.cda.base.model.GenericClassContainer
accept, acceptContainers, acceptNamespaces, acceptTypes, addSubContainer, canHaveDependencies, contains, createPackage, displayString, findClassInfo, findOrCreateClassInfo, findOrCreatePackage, findPackage, getAlias, getAllContainedClasses, getAnalyzableElementType, getChildCount, getChildren, getClassification, getContext, getDirectReferredContainers, getIncludedContainers, getNamespaces, getNumberOfContainedClasses, getNumberOfContainedPackages, getPackageNamed, getPackages, getParentContainer, getRequiredClassFileVersion, getSubContainers, getVersion, getWorkset, hasVersion, isNotFoundContainer, isShortContainerNamesOn, isThirdPartyLibrary, packagesCollected, packagesCollected, processClassInformationObjects, processClassPackageObjects, refersTo, release, setAlias
 
Methods inherited from class org.pf.tools.cda.base.model.AAnalyzableElement
canBeAnalyzedForDependencies
 
Methods inherited from class org.pf.tools.cda.base.model.AModelObject
apply, countAllElementsRecursivly, getNumberOfAncestors, getProperty, getPropertyNames, setProperty
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.pfsw.odem.IObjectProperties
getProperty, getPropertyNames, setProperty
 

Field Detail

EMPTY_ARRAY

public static final SoftwareComponent[] EMPTY_ARRAY
Constructor Detail

SoftwareComponent

public SoftwareComponent(java.lang.String aName,
                         Workset aWorkset)
Initialize the new instance with default values.

Method Detail

getName

public java.lang.String getName()
Description copied from class: AModelObject
Returns the name

Specified by:
getName in interface IExplorationModelObject
Specified by:
getName in class AModelObject

setName

public void setName(java.lang.String newValue)

getDescription

public java.lang.String getDescription()

setDescription

public void setDescription(java.lang.String newValue)

getContainerInfoList

public java.util.List<ContainerInfo> getContainerInfoList()

setContainerInfoList

public void setContainerInfoList(java.util.List<ContainerInfo> newValue)

getPackagePatterns

public org.pf.text.StringPatternCollection getPackagePatterns()

setPackagePatterns

public void setPackagePatterns(org.pf.text.StringPatternCollection newValue)

setParentComponentHolder

public void setParentComponentHolder(IComponentHolder newValue)

collectionToArray

public static SoftwareComponent[] collectionToArray(java.util.Collection coll)

resetPackagePatterns

public void resetPackagePatterns()
Removes all package patterns currently defined in this component.


addPackagePattern

public void addPackagePattern(java.lang.String pattern)
Adds the given pattern.


addPackagePatterns

public void addPackagePatterns(java.util.Collection<java.lang.String> patterns)
Adds all patterns from the given collection.


toString

public java.lang.String toString()
Overrides:
toString in class GenericClassContainer

equals

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

hashCode

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

compareTo

public int compareTo(java.lang.Object obj)
Specified by:
compareTo in interface java.lang.Comparable
Overrides:
compareTo in class GenericClassContainer
See Also:
Comparable.compareTo(java.lang.Object)

isValid

public boolean isValid()
Returns true if this class container is valid.

Specified by:
isValid in class GenericClassContainer

isSoftwareComponent

public boolean isSoftwareComponent()
Returns true because this container represents a modelled software component.

Overrides:
isSoftwareComponent in class GenericClassContainer

getNamespacePatterns

public java.util.Collection<java.lang.String> getNamespacePatterns()

addPackageToThisOrSubComponentIfPatternMatches

public boolean addPackageToThisOrSubComponentIfPatternMatches(ClassPackage pack)
Adds the given package to this component or one of its sub-components if any package name pattern matches the name of the given package.

Returns:
true if the given package was added, otherwise false

addPackageIfPatternMatches

public boolean addPackageIfPatternMatches(ClassPackage pack)
Adds the given package to the components package list if the package name matches any of the component's package name patterns.

Returns:
true if the given package was added, otherwise false

addPackageIfContainerMatches

public boolean addPackageIfContainerMatches(ClassPackage pack)
Adds the given package to the components package list if the package belongs to a container that is defined as part of this component.

Returns:
true if the given package was added, otherwise false

addContainerInfo

public void addContainerInfo(ContainerInfo info)

processSoftwareComponents

public boolean processSoftwareComponents(java.util.Collection collection,
                                         ISoftwareComponentProcessor processor)
Calls the given processor for each contained component object and adds all component objects that the processor wants to the given collection.

Parameters:
collection - The collection to which the matching objects will be added (might be null)
processor - The processor that decides whether or not an object must be added (must not be null)
Returns:
true if processing should continue, otherwise false

detachParentComponentHolder

public void detachParentComponentHolder()
Detaches this component from its current parent. That is, after calling this method this component has no parent anymore.


getParentComponentHolder

public IComponentHolder getParentComponentHolder()
Returns the parent holder that contains this object. If this object has no parent null will be returned.

Specified by:
getParentComponentHolder in interface IComponentHolder

getComponents

public SoftwareComponent[] getComponents()
Returns all sub components this component contains

Specified by:
getComponents in interface IComponentHolder

addComponent

public void addComponent(SoftwareComponent component)
Description copied from interface: IComponentHolder
Add the given component

Specified by:
addComponent in interface IComponentHolder

removeComponent

public void removeComponent(SoftwareComponent component)
Remove the given component

Specified by:
removeComponent in interface IComponentHolder