com.ibm.rational.rpe.common.data
Class Feature

java.lang.Object
  extended by com.ibm.rational.rpe.common.data.Feature
All Implemented Interfaces:
com.ibm.rational.rpe.common.template.visitor.Visitable

public class Feature
extends java.lang.Object
implements com.ibm.rational.rpe.common.template.visitor.Visitable

Author:
Calin Code review 2008.02.22: remove the ID from constructors, Spurlos Redesigned for memory efficiency

Constructor Summary
Feature()
           
Feature(java.lang.String id, java.lang.String tag)
           
 
Method Summary
 void addFeature(Feature feature)
           
 void addFeature(int location, Feature feature)
           
 void addFeatures(java.util.Collection<Feature> other)
           
 void addProperties(java.util.Collection<Property> properties)
           
 void addProperty(Property property)
           
 void addPropertyAfter(Property property, Property other)
          Deprecated. 
 void addPropertyBefore(Property property, Property other)
          Deprecated. 
 void copyContent(Feature other)
          Copies the content of another feature.
 Feature copyOf()
           
 java.util.List<Feature> getFeatures()
          Returns an unmodifiable collection of Features.
 java.lang.String getId()
           
 Feature getNewInstance()
           
 java.util.List<Property> getProperties()
          Returns an unmodifiable collection of Properties.
 Property getProperty(java.lang.String name)
           
 Property getPropertyFast(java.lang.String name)
          In most cases the property looked for is in the first child feature Searching these locations first will result in an overall improved performance The properties cannot be sorted before searching this order is important in some scenarios Also given the small number of properties per feature there would be no real gain in doing so
 java.lang.String getTag()
           
 java.lang.String getType()
           
 void removeAll(java.util.Collection<Feature> deleted)
           
 void removeAllFeatures()
           
 void removeAllProperties()
           
 boolean removeFeature(Feature feature)
           
 boolean removeProperty(Property prop)
           
 void setId(java.lang.String id)
           
 void setTag(java.lang.String tag)
           
 void setType(java.lang.String type)
           
 void sort(java.util.Comparator<Feature> featureComparator, java.util.Comparator<Property> propertyComparator, boolean deep)
           
 void visit(com.ibm.rational.rpe.common.template.visitor.Visitable parent, com.ibm.rational.rpe.common.template.visitor.Visitor v)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Feature

public Feature()

Feature

public Feature(java.lang.String id,
               java.lang.String tag)
Method Detail

getNewInstance

public Feature getNewInstance()

getPropertyFast

public Property getPropertyFast(java.lang.String name)
In most cases the property looked for is in the first child feature Searching these locations first will result in an overall improved performance The properties cannot be sorted before searching this order is important in some scenarios Also given the small number of properties per feature there would be no real gain in doing so


getProperty

public Property getProperty(java.lang.String name)

setTag

public void setTag(java.lang.String tag)

getTag

public java.lang.String getTag()

setId

public void setId(java.lang.String id)

getId

public java.lang.String getId()

setType

public void setType(java.lang.String type)

getType

public java.lang.String getType()

addProperty

public void addProperty(Property property)

addProperties

public void addProperties(java.util.Collection<Property> properties)

addPropertyBefore

@Deprecated
public void addPropertyBefore(Property property,
                                         Property other)
Deprecated. 

This will be removed.

Parameters:
property -
other -

addPropertyAfter

@Deprecated
public void addPropertyAfter(Property property,
                                        Property other)
Deprecated. 

This will be removed.

Parameters:
property -
other -

getProperties

public java.util.List<Property> getProperties()
Returns an unmodifiable collection of Properties. The result is never null. The return type will be changed to Collection in a future release.


removeProperty

public boolean removeProperty(Property prop)

addFeature

public void addFeature(Feature feature)

addFeatures

public void addFeatures(java.util.Collection<Feature> other)

addFeature

public void addFeature(int location,
                       Feature feature)

removeFeature

public boolean removeFeature(Feature feature)

removeAll

public void removeAll(java.util.Collection<Feature> deleted)

getFeatures

public java.util.List<Feature> getFeatures()
Returns an unmodifiable collection of Features. The result is never null. The return type will be changed to Collection in a future release


copyOf

public Feature copyOf()

copyContent

public void copyContent(Feature other)
Copies the content of another feature. This is different from clone as no duplicates are created for the child properties and features.

Parameters:
other -

visit

public void visit(com.ibm.rational.rpe.common.template.visitor.Visitable parent,
                  com.ibm.rational.rpe.common.template.visitor.Visitor v)
Specified by:
visit in interface com.ibm.rational.rpe.common.template.visitor.Visitable

removeAllProperties

public void removeAllProperties()

removeAllFeatures

public void removeAllFeatures()

sort

public void sort(java.util.Comparator<Feature> featureComparator,
                 java.util.Comparator<Property> propertyComparator,
                 boolean deep)