org.fopps.model
Class Feature

java.lang.Object
  |
  +--org.fopps.model.AbstractItem
        |
        +--org.fopps.model.TreeItem
              |
              +--org.fopps.model.Feature
Direct Known Subclasses:
NumericFeature

public class Feature
extends TreeItem

A feature represents a defined scope of functionality. A feature may reflected by

It may occur in different flavours. A feature can be mandatory, optional or part of an alternative. Mandatory features do not appear in the configuration (since the user has no option to turn it off ;-). Optional features are boolean configuration values which maxy be activated or not. Alternative feature exclude each other, that means you have to select 'one out of many'.

Features are organized in a tree-like structure to reflect dependencies of features. Another opportunity to describe dependencies are constraints.

See Also:
Artefact, Constraint, ConfigurationBuilder

Field Summary
static java.lang.String ROOT_FEATURE_NAME
          Name of the global root feature
 
Fields inherited from class org.fopps.model.TreeItem
mChildren, mParent
 
Fields inherited from class org.fopps.model.AbstractItem
ADDED_EVENT, CHANGE_EVENT, name, REMOVED_EVENT
 
Constructor Summary
Feature(java.lang.String name)
          Creates a new feature without parent
Feature(java.lang.String name, TreeItem mParent)
          Creates a new feature with given parent.
Feature(java.lang.String pName, TreeItem pParent, boolean pChildrenAllowed)
          Creates a new feature with given parent.
 
Method Summary
 void addAttachment(Artefact pArtefact)
          Adds an attachment to this feature
static java.lang.String buildSymbolicVar(java.lang.String pString)
          Builds the name of the symbolic var from a string.
 java.lang.String createDefaultVar(Feature pFeature)
          Creates a default variable, if default variable will be empty.
 void fireItemChanged()
          Passes change events to parent, if necessary.
 java.util.List getAttachments()
          Returns all attached artefacts.
 BindingTime getBinding()
          Returns the binding kind of the feature.
 java.lang.String getSymbolicVar()
          Returns the variable name of the feature
 boolean hasAttachments()
          Returns true, if feature has artefacts
 boolean isAlternative()
          Returns true, if feature is an alternative
 boolean isAvailable()
          (see setAvailable)
 boolean isEnabledByDefault()
          Returns true, if feature is enabled by default
 boolean isOptional()
          Returns true, if feature is optional
 void removeAllAttachments()
          Removes all attachments
 void removeAttachment(Artefact pArtefact)
          Removes a given attachment
 void setAlternative(boolean alternative)
          Change current feature to an alternative.
 void setAttachments(java.util.Collection pAttachments)
          Adds a list of attachments
 void setAvailable(boolean available)
          Marks the feature as (in)available regarding project scheduling.
 void setBinding(BindingTime pBinding)
          Sets the new binding kind of the feature.
 void setEnabledByDefault(boolean enabledByDefault)
          Enables or diables feature by default.
 void setOptional(boolean optional)
          Sets current feature as optional.or mandatory
 void setSymbolicVar(java.lang.String pSymbolicVar)
          Sets the name of the variable name of the feature
 java.lang.String toString()
           
 void validateAttachments()
          Check all attachments.
 
Methods inherited from class org.fopps.model.TreeItem
addChildren, allChildrenCount, childrenAllowed, childrenCount, delete, first, getChildAt, getChildren, getDepth, getIndexOfChild, getParent, getPath, getRoot, isLeaf, last, notifyListeners, removeAllChildren, removeAllChildrenRecursive, removeChildren, setChildren, setParent
 
Methods inherited from class org.fopps.model.AbstractItem
addIncoming, addListener, addOutgoing, commitGhostRelations, containsType, copyAttributes, filterElements, fireItemAdded, fireItemRemoved, getConstraints, getDescription, getIncoming, getIncomingConstraints, getListeners, getName, getOutgoing, getOutgoingConstraints, getRelationTo, hasConstraints, isBlockEvents, isConnectedWith, removeAllConstraints, removeAllIncoming, removeAllListener, removeAllOutgoing, removeAllRelations, removeGhostRelations, removeIncoming, removeListener, removeOutgoing, removeRelationTo, setBlockEvents, setDescription, setIncoming, setName, setOutgoing
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ROOT_FEATURE_NAME

public static final java.lang.String ROOT_FEATURE_NAME
Name of the global root feature

See Also:
Constant Field Values
Constructor Detail

Feature

public Feature(java.lang.String name)
Creates a new feature without parent

Parameters:
name - Name of the feature

Feature

public Feature(java.lang.String name,
               TreeItem mParent)
Creates a new feature with given parent.

Parameters:
name - Name of the feature

Feature

public Feature(java.lang.String pName,
               TreeItem pParent,
               boolean pChildrenAllowed)
Creates a new feature with given parent.

Parameters:
pChildrenAllowed - Flag which determines, if children are allowed or not
Method Detail

getBinding

public BindingTime getBinding()
Returns the binding kind of the feature.

See Also:
BindingTime

setBinding

public void setBinding(BindingTime pBinding)
Sets the new binding kind of the feature.

Parameters:
pBinding - New binding kind

getSymbolicVar

public java.lang.String getSymbolicVar()
Returns the variable name of the feature


setSymbolicVar

public void setSymbolicVar(java.lang.String pSymbolicVar)
Sets the name of the variable name of the feature


isEnabledByDefault

public boolean isEnabledByDefault()
Returns true, if feature is enabled by default


setEnabledByDefault

public void setEnabledByDefault(boolean enabledByDefault)
Enables or diables feature by default. If true, this feature will be selected automatically during configuration.


isAvailable

public boolean isAvailable()
(see setAvailable)


setAvailable

public void setAvailable(boolean available)
Marks the feature as (in)available regarding project scheduling. This means, that an asset or a product can provide it's features only after project has finished.

Changes of availability will also passed to the child nodes


getAttachments

public java.util.List getAttachments()
Returns all attached artefacts. In most cases these will be attached files.


setAttachments

public void setAttachments(java.util.Collection pAttachments)
Adds a list of attachments


addAttachment

public void addAttachment(Artefact pArtefact)
Adds an attachment to this feature


removeAttachment

public void removeAttachment(Artefact pArtefact)
Removes a given attachment


removeAllAttachments

public void removeAllAttachments()
Removes all attachments


validateAttachments

public void validateAttachments()
Check all attachments. If the corresponding file was removed, the attachment is removed from the list


hasAttachments

public boolean hasAttachments()
Returns true, if feature has artefacts


isOptional

public boolean isOptional()
Returns true, if feature is optional


setOptional

public void setOptional(boolean optional)
Sets current feature as optional.or mandatory


isAlternative

public boolean isAlternative()
Returns true, if feature is an alternative


setAlternative

public void setAlternative(boolean alternative)
Change current feature to an alternative. All existing and added childs will become optional, too.


fireItemChanged

public void fireItemChanged()
Passes change events to parent, if necessary. If no parent present, it invokes the method from the superclass

Overrides:
fireItemChanged in class AbstractItem
See Also:
AbstractItem.setBlockEvents(boolean)

buildSymbolicVar

public static java.lang.String buildSymbolicVar(java.lang.String pString)
Builds the name of the symbolic var from a string. Normally the passed string is the name of the feature. buildSymbolicVar removes invalid chars (e. g. ', #, *,...) from a string and replaces whitespace char with an underbar. So this variable should comply to most programming language rules.


createDefaultVar

public java.lang.String createDefaultVar(Feature pFeature)
Creates a default variable, if default variable will be empty. The name will contain the var of the parent feature plus the index of the current feature.

Parameters:
pFeature - Feature for which the var should be created

toString

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


Fopps 0.19 - Copyright © 2002 Oliver Wieland. All Rights Reserved.