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

## org.apache.cocoon.forms.formmodel
Interface CalculatedFieldAlgorithm

All Known Implementing Classes:
  AbstractBaseAlgorithm, JavaScript

public interface CalculatedFieldAlgorithm

Common interface for an algorithm to calculate the value of a `CalculatedField`.

Version:
  $Id: CalculatedFieldAlgorithm.java 587759 2007-10-24 03:00:37Z vgritsenko $

Method Summary
`Object` | `calculate(Form form, Widget parent, Datatype datatype)` Performs the actual calculation.
`Iterator` | `getTriggerWidgets()` Returns an iterator on trigger widget paths.
`boolean` | `isSuitableFor(Datatype dataType)` Checks wether this algorithm is able to return the given datatype.

Method Detail

### isSuitableFor

    public boolean isSuitableFor(Datatype dataType)

  Checks wether this algorithm is able to return the given datatype. For example, an arithmetic algorithm like sum should check that the given datatype is a number.

  Parameters:
    `dataType` - The target datatype.
  Returns:
    true if this algorithm can return a compatible value, false otherwise.

### calculate

    public Object calculate(Form form,
                            Widget parent,
                            Datatype datatype)

  Performs the actual calculation.

  Parameters:
    `form` - The form.
    `parent` - The parent widget of the `CalculatedField` widget (may be the same as form)
    `datatype` - The target datatype.
  Returns:
    the calculated value for the `CalculatedField`.

### getTriggerWidgets

    public Iterator getTriggerWidgets()

  Returns an iterator on trigger widget paths. When the value of a trigger widget changes, then the `CalculatedField` value must be recalculated.

  Returns:
    An iterator of Strings representing widget paths as interpreted by `WidgetFinder`.

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

Copyright © 1999-2008 The Apache Software Foundation. All Rights Reserved.