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.motifDiscovery.history
Class RestrictedRepeatHistory

    java.lang.Object
      de.jstacs.motifDiscovery.history.RestrictedRepeatHistory

All Implemented Interfaces:
  History, Storable, Cloneable

    public class RestrictedRepeatHistory

extends Object
implements History

This class implements a history that allows operations (i.e. a pair of `int`), that are not a priorily forbidden and that are done before less than a specified threshold. This enables the user for instance to allow each operation exactly once. Furthermore, this class has a switch that allows to forbid an operation for which the reverse operation has been performed in the last step.
If shrink operations are allowed by the user then a shrink operation is allow anytime. This helps to keep the motif short.

Author:
  Jens Keilwagen

Constructor Summary
`RestrictedRepeatHistory()` This constructor creates an instance that allows to shift, shrink, and expand the motif, to do the reverse operation, and to do each operation at most once.
`RestrictedRepeatHistory(boolean allowReverse)` This constructor creates an instance that allows to shift, shrink, and expand the motif, and allows to do each operation at most once.
`RestrictedRepeatHistory(boolean allowShift, boolean allowShrink, boolean allowExpand)` This constructor creates an instance that allows to do each operation at most once.
`RestrictedRepeatHistory(boolean allowShift, boolean allowShrink, boolean allowExpand, boolean allowReverse, int threshold)` This constructor creates an instance with user specified allowed operations and `threshold`.
`RestrictedRepeatHistory(int threshold)` This constructor creates an instance that allows to shift shrink and expand the motif.
`RestrictedRepeatHistory(StringBuffer xml)` This is the constructor for the interface `Storable`.

Method Summary
`void` | `clear()` This method clears the history, i.e. it removes all operations from the history.
`RestrictedRepeatHistory` | `clone()` This method returns a deep copy of the instance
`boolean` | `operationAllowed(int... op)` Returns `true` if the specified operation is allowed, i.e. it does not conflict with any operation from the history.
`void` | `operationPerfomed(int... op)` This method puts an operation to the history.
`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, toString, wait, wait, wait`

Constructor Detail

### RestrictedRepeatHistory

    public RestrictedRepeatHistory()

  This constructor creates an instance that allows to shift, shrink, and expand the motif, to do the reverse operation, and to do each operation at most once.

### RestrictedRepeatHistory

    public RestrictedRepeatHistory(boolean allowReverse)

  This constructor creates an instance that allows to shift, shrink, and expand the motif, and allows to do each operation at most once.

  Parameters:
    `allowReverse` - whether it is allowed to do the reverse operation as next operation or not

### RestrictedRepeatHistory

    public RestrictedRepeatHistory(int threshold)

  This constructor creates an instance that allows to shift shrink and expand the motif.

  Parameters:
    `threshold` - the number of times each operation can be done
  Throws:
    `IllegalArgumentException` - if the `threshold` is below 1

### RestrictedRepeatHistory

    public RestrictedRepeatHistory(boolean allowShift,
                                   boolean allowShrink,
                                   boolean allowExpand)

  This constructor creates an instance that allows to do each operation at most once.

  Parameters:
    `allowShift` - whether it is allowed to shift the motif
    `allowShrink` - whether it is allowed to shrink the motif
    `allowExpand` - whether it is allowed to expand the motif

### RestrictedRepeatHistory

    public RestrictedRepeatHistory(boolean allowShift,
                                   boolean allowShrink,
                                   boolean allowExpand,
                                   boolean allowReverse,
                                   int threshold)
                            throws IllegalArgumentException

  This constructor creates an instance with user specified allowed operations and `threshold`.

  Parameters:
    `allowShift` - whether it is allowed to shift the motif
    `allowShrink` - whether it is allowed to shrink the motif
    `allowExpand` - whether it is allowed to expand the motif
    `allowReverse` - whether it is allowed to do the reverse operation as next operation or not
    `threshold` - the number of times each operation can be done
  Throws:
    `IllegalArgumentException` - if the `threshold` is below 1

### RestrictedRepeatHistory

    public RestrictedRepeatHistory(StringBuffer xml)
                            throws NonParsableException

  This is the constructor for the interface `Storable`.

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

Method Detail

### 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

### clone

    public RestrictedRepeatHistory clone()
                                  throws CloneNotSupportedException

  Description copied from interface: `History`
  This method returns a deep copy of the instance

  Specified by:
    `clone` in interface `History`
  Overrides:
    `clone` in class `Object`
  Returns:
    a deep copy
  Throws:
    `CloneNotSupportedException` - if not possible
  See Also:
    `Cloneable`, `Object.clone()`

### clear

    public void clear()

  Description copied from interface: `History`
  This method clears the history, i.e. it removes all operations from the history.

  Specified by:
    `clear` in interface `History`

### operationAllowed

    public boolean operationAllowed(int... op)

  Description copied from interface: `History`
  Returns `true` if the specified operation is allowed, i.e. it does not conflict with any operation from the history.

  Specified by:
    `operationAllowed` in interface `History`
  Parameters:
    `op` - the operation to be tested
  Returns:
    `true` if the specified operation is allowed

### operationPerfomed

    public void operationPerfomed(int... op)

  Description copied from interface: `History`
  This method puts an operation to the history.

  Specified by:
    `operationPerfomed` in interface `History`
  Parameters:
    `op` - the performed operation

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