Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## de.jstacs.parameters.validation
Class NumberValidator<E extends Comparable<? extends Number>>

    java.lang.Object
      de.jstacs.parameters.validation.NumberValidator<E>

Type Parameters:
  `E` - the subclass of `Number` to be validated

All Implemented Interfaces:
  GalaxyConvertible, ParameterValidator, Storable, Cloneable

    public class NumberValidator<E extends Comparable<? extends Number>>

extends Object
implements ParameterValidator, GalaxyConvertible

Class that validates all subclasses of `Number` that implement `Comparable` (e.g. `Double, Long, Float`) for compliance with a specified lower and upper bound.

Author:
  Jan Grau

Constructor Summary
`NumberValidator(E lowerBound, E upperBound)` Constructs a `NumberValidator` for a given upper and lower bound.
`NumberValidator(StringBuffer representation)` The standard constructor for the interface `Storable`.

Method Summary
`boolean` | `checkValue(Object value)` Returns `true` if the value is valid and `false` otherwise.
`NumberValidator` | `clone()` This method returns a deep copy of the current instance.
`void` | `fromGalaxy(String namePrefix, StringBuffer command)` Parses the contents of `command` in the format defined by `configBuffer` of `GalaxyConvertible.toGalaxy(String, String, int, StringBuffer, StringBuffer)` and sets the values of the `Parameter` or `ParameterSet` accordingly.
`void` | `fromXML(StringBuffer representation)` Parses a `NumberValidator` from the XML representation as returned by `toXML()`.
`String` | `getErrorMessage()` Returns the error message if `ParameterValidator.checkValue(Object)` returned false.
`E` | `getLowerBound()` Returns the lower bound of the `NumberValidator`.
`void` | `toGalaxy(String namePrefix, String configPrefix, int depth, StringBuffer descBuffer, StringBuffer configBuffer)` Creates an Galaxy XML-representation of the parameters and appends it to `descBuffer` and variable configuration and appends it to `configBuffer`.
`String` | `toString()`
`StringBuffer` | `toXML()` This method returns an XML representation as `StringBuffer` of an instance of the implementing class.

Methods inherited from class java.lang.Object
`equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### NumberValidator

    public NumberValidator(E lowerBound,
                           E upperBound)

  Constructs a `NumberValidator` for a given upper and lower bound.

  Parameters:
    `lowerBound` - the lower bound
    `upperBound` - the upper bound

### NumberValidator

    public NumberValidator(StringBuffer representation)
                    throws NonParsableException

  The standard constructor for the interface `Storable`. Constructs a `NumberValidator` out of a XML representation.

  Parameters:
    `representation` - the XML representation as `StringBuffer`
  Throws:
    `NonParsableException` - if the representation could not be parsed

Method Detail

### clone

    public NumberValidator clone()

  Description copied from interface: `ParameterValidator`
  This method returns a deep copy of the current instance.

  Specified by:
    `clone` in interface `ParameterValidator`
  Overrides:
    `clone` in class `Object`
  Returns:
    a deep copy of the current index
  See Also:
    `Cloneable`

### getLowerBound

    public E getLowerBound()

  Returns the lower bound of the `NumberValidator`.

  Returns:
    the lower bound of the `NumberValidator`

### getErrorMessage

    public String getErrorMessage()

  Description copied from interface: `ParameterValidator`
  Returns the error message if `ParameterValidator.checkValue(Object)` returned false.

  Specified by:
    `getErrorMessage` in interface `ParameterValidator`
  Returns:
    the error message

### checkValue

    public boolean checkValue(Object value)

  Description copied from interface: `ParameterValidator`
  Returns `true` if the value is valid and `false` otherwise.

  Specified by:
    `checkValue` in interface `ParameterValidator`
  Parameters:
    `value` - the `Object` to be checked
  Returns:
    if `value` is valid

### fromXML

    public void fromXML(StringBuffer representation)
                 throws NonParsableException

  Parses a `NumberValidator` from the XML representation as returned by `toXML()`.

  Parameters:
    `representation` - the XML representation
  Throws:
    `NonParsableException` - if the XML code could not be parsed

### toXML

    public StringBuffer toXML()

  Description copied from interface: `Storable`
  This method returns an XML representation as `StringBuffer` of an instance of the implementing class.

  Specified by:
    `toXML` in interface `Storable`
  Returns:
    the XML representation

### toString

    public String toString()

  Overrides:
    `toString` in class `Object`

### toGalaxy

    public void toGalaxy(String namePrefix,
                         String configPrefix,
                         int depth,
                         StringBuffer descBuffer,
                         StringBuffer configBuffer)
                  throws Exception

  Description copied from interface: `GalaxyConvertible`
  Creates an Galaxy XML-representation of the parameters and appends it to `descBuffer` and variable configuration and appends it to `configBuffer`. The variable configuation is also used to parse user-supplied values returned by Galaxy.

  Specified by:
    `toGalaxy` in interface `GalaxyConvertible`
  Parameters:
    `namePrefix` - the prefix of the variable name used in Galaxy
    `configPrefix` - the prefix for conditionals
    `depth` - the depth in the parameter hierarchy, used for graphical representation of nesting
    `descBuffer` - the buffer for the parameter description
    `configBuffer` - the buffer for the configuration line
  Throws:
    `Exception` - if the conversion fails

### fromGalaxy

    public void fromGalaxy(String namePrefix,
                           StringBuffer command)
                    throws Exception

  Description copied from interface: `GalaxyConvertible`
  Parses the contents of `command` in the format defined by `configBuffer` of `GalaxyConvertible.toGalaxy(String, String, int, StringBuffer, StringBuffer)` and sets the values of the `Parameter` or `ParameterSet` accordingly.

  Specified by:
    `fromGalaxy` in interface `GalaxyConvertible`
  Parameters:
    `namePrefix` - the prefix of the variable name
    `command` - the command string
  Throws:
    `Exception` - if the command string could not be parsed

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD