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

java.lang.Object
  extended by org.pf.tools.cda.base.model.AModelObject
All Implemented Interfaces:
java.lang.Comparable, IExplorationModelObject, IObjectProperties
Direct Known Subclasses:
AAnalyzableElement

public abstract class AModelObject
extends java.lang.Object
implements java.lang.Comparable, IExplorationModelObject

Common superclass of all model object classes

Version:
1.1
Author:
M.Duchrow

Field Summary
static AModelObject[] EMPTY_MODEL_OBJECT_ARRAY
           
 
Constructor Summary
AModelObject()
          Initialize the new instance with default values.
 
Method Summary
 boolean apply(AModelObjectVisitor visitor)
          Calls the visitor.startModelObject(this) then calls apply(visitor) on all child elements and then visitor.finishModelObject(this)
 boolean canHaveDependencies()
          Returns if this object potentially has dependencies to other objects.
static AModelObject[] collectionToArray(java.util.Collection coll)
           
 int compareTo(java.lang.Object object)
           
 int countAllElementsRecursivly()
          Returns the number of all contained elements in this model object including this object.
abstract  int getChildCount()
          Returns the current number of children
abstract  AModelObject[] getChildren()
          Returns the children.
abstract  java.lang.String getName()
          Returns the name
 int getNumberOfAncestors()
          Returns the number of parent objects up to the root of the hierarchy
 java.lang.Object getProperty(java.lang.String propertyName)
          Returns the property associated with the given name.
 java.lang.String[] getPropertyNames()
          Returns all currently known properties.
abstract  Workset getWorkset()
          Returns the workset this object belongs to
 void setProperty(java.lang.String propertyName, java.lang.Object object)
          Sets the value of the property with the specified name to the given object.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.pfsw.odem.IExplorationModelObject
getContext
 

Field Detail

EMPTY_MODEL_OBJECT_ARRAY

public static final AModelObject[] EMPTY_MODEL_OBJECT_ARRAY
Constructor Detail

AModelObject

public AModelObject()
Initialize the new instance with default values.

Method Detail

collectionToArray

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

canHaveDependencies

public boolean canHaveDependencies()
Returns if this object potentially has dependencies to other objects. That is, it can be analyzed by CDA regarding its dependencies.


compareTo

public int compareTo(java.lang.Object object)
Specified by:
compareTo in interface java.lang.Comparable

getWorkset

public abstract Workset getWorkset()
Returns the workset this object belongs to


getName

public abstract java.lang.String getName()
Returns the name

Specified by:
getName in interface IExplorationModelObject

getChildCount

public abstract int getChildCount()
Returns the current number of children


getChildren

public abstract AModelObject[] getChildren()
Returns the children. If there are no children it must return an empty array and never null


apply

public boolean apply(AModelObjectVisitor visitor)
Calls the visitor.startModelObject(this) then calls apply(visitor) on all child elements and then visitor.finishModelObject(this)

Returns:
true, if visiting of object should be countinued

countAllElementsRecursivly

public int countAllElementsRecursivly()
Returns the number of all contained elements in this model object including this object.


getNumberOfAncestors

public int getNumberOfAncestors()
Returns the number of parent objects up to the root of the hierarchy


getProperty

public java.lang.Object getProperty(java.lang.String propertyName)
Returns the property associated with the given name. A null value indicates that a property with the specified name does not exist.

Specified by:
getProperty in interface IObjectProperties
Parameters:
propertyName - A valid name (must not be null or empty string)
Returns:
The object associated with the given name or null if property unknown

setProperty

public void setProperty(java.lang.String propertyName,
                        java.lang.Object object)
Sets the value of the property with the specified name to the given object. This replaces ny object that might have been kept under the given name before.

If the given object is null, the property and any associated value will be removed.

Specified by:
setProperty in interface IObjectProperties
Parameters:
propertyName - A valid name (must not be null or empty string)
object - The object to keep under the specified property name

getPropertyNames

public java.lang.String[] getPropertyNames()
Returns all currently known properties. If no property is known an empty array will be returned (never null).

Specified by:
getPropertyNames in interface IObjectProperties
Returns:
All the names of available properties