org.fopps.model
Class NumericFeature

java.lang.Object
  |
  +--org.fopps.model.AbstractItem
        |
        +--org.fopps.model.TreeItem
              |
              +--org.fopps.model.Feature
                    |
                    +--org.fopps.model.NumericFeature

public class NumericFeature
extends Feature

NumericFeature is a special kind of feature and represents numeric values. Numeric features are not able to have child nodes, since NumericFeature is intended for non-discrete values (e. g. calibration parameters) and the number of children may be infinite.

If the range of values is small and discrete, use alternatives instead of a numeric features.

Author:
Oliver Wieland

Field Summary
static java.lang.Number ZERO_BYTE
           
static java.lang.Number ZERO_DOUBLE
           
static java.lang.Number ZERO_FLOAT
           
static java.lang.Number ZERO_INTEGER
           
static java.lang.Number ZERO_LONG
           
static java.lang.Number ZERO_SHORT
           
 
Fields inherited from class org.fopps.model.Feature
ROOT_FEATURE_NAME
 
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
NumericFeature(java.lang.String name, TreeItem mParent, Validator pValidator)
          Creates a new numeric feature.
NumericFeature(java.lang.String name, Validator pValidator)
          Same as NumericFeature(name, null, pValidator)
 
Method Summary
 java.lang.Number getDefaultValue()
          Returns the default value
 Validator getValidator()
          Returns the current validator instance or null, if no validator has been assigned.
 java.lang.Number getValue()
          Returns the current value of the feature
 boolean isAlternative()
          Returns true, if feature is an alternative.
protected  boolean isValid(java.lang.Number pValue)
           
 void setAlternative(boolean alternative)
          Does nothing, since numeric features cannot have child nodes.
 void setDefaultValue(java.lang.Number pDefaultValue)
          Sets a new default value.
 void setToDefault()
          Sets the value to the default value.
 void setValue(java.lang.Number pValue)
          Sets a new value.
 
Methods inherited from class org.fopps.model.Feature
addAttachment, buildSymbolicVar, createDefaultVar, fireItemChanged, getAttachments, getBinding, getSymbolicVar, hasAttachments, isAvailable, isEnabledByDefault, isOptional, removeAllAttachments, removeAttachment, setAttachments, setAvailable, setBinding, setEnabledByDefault, setOptional, setSymbolicVar, toString, validateAttachments
 
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

ZERO_BYTE

public static final java.lang.Number ZERO_BYTE

ZERO_SHORT

public static final java.lang.Number ZERO_SHORT

ZERO_LONG

public static final java.lang.Number ZERO_LONG

ZERO_INTEGER

public static final java.lang.Number ZERO_INTEGER

ZERO_DOUBLE

public static final java.lang.Number ZERO_DOUBLE

ZERO_FLOAT

public static final java.lang.Number ZERO_FLOAT
Constructor Detail

NumericFeature

public NumericFeature(java.lang.String name,
                      Validator pValidator)
Same as NumericFeature(name, null, pValidator)


NumericFeature

public NumericFeature(java.lang.String name,
                      TreeItem mParent,
                      Validator pValidator)
Creates a new numeric feature. If a validator was passed, the value is set to the first valid value of the validator. Otherwise it is set to ZERO_INTEGER.

Parameters:
name - name of the feature
mParent - Parent feature
pValidator - Validator instance to verify valid values
Method Detail

isAlternative

public boolean isAlternative()
Returns true, if feature is an alternative. Numeric features return always false

Overrides:
isAlternative in class Feature

setAlternative

public void setAlternative(boolean alternative)
Does nothing, since numeric features cannot have child nodes.

Overrides:
setAlternative in class Feature

getValidator

public Validator getValidator()
Returns the current validator instance or null, if no validator has been assigned.


getDefaultValue

public java.lang.Number getDefaultValue()
Returns the default value


setDefaultValue

public void setDefaultValue(java.lang.Number pDefaultValue)
                     throws ValidatorException
Sets a new default value. The current value is not changed.

Throws:
ValidatorException, - if value was not accepted by the validator
ValidatorException
See Also:
setToDefault()

getValue

public java.lang.Number getValue()
Returns the current value of the feature


setValue

public void setValue(java.lang.Number pValue)
              throws ValidatorException
Sets a new value.

Throws:
ValidatorException, - if value was not accepted by the validator
ValidatorException

setToDefault

public void setToDefault()
Sets the value to the default value. If no default value exists, the method does nothing.

See Also:
setDefaultValue(java.lang.Number)

isValid

protected boolean isValid(java.lang.Number pValue)
                   throws ValidatorException
ValidatorException


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