de.caff.generics.handler

## Class DeletingLoopItemHandler<T,S>

- java.lang.Object
- - de.caff.generics.handler.DeletingLoopItemHandler<T,S>

- All Implemented Interfaces:
    LoopHandler, LoopItemHandler<S>
  Direct Known Subclasses:
    FilteringLoopItemHandler

      public abstract class DeletingLoopItemHandler<T,S>
      extends java.lang.Object
      implements LoopItemHandler<S>

  A loop item handler which converts incoming items, while allowing to discard some of them.
  Author:
    Rammi
  See Also:
    `ConvertingLoopItemHandler`, `MultiConvertingLoopItemHandler`, `ConvertingFragileLoopItemHandler`, `DeletingFragileLoopItemHandler`, `MultiConvertingFragileLoopItemHandler`, `FilteringLoopItemHandler`

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected T` | `deleteMark`
    `protected Function1<T,S>` | `typeConverter`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `DeletingLoopItemHandler(Function1<T,S> typeConverter, T deleteMark)` Constructor.

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `afterFinish()` Called after the loop has finished.
    `void` | `beforeStart()` Called before the loop is started.
    `boolean` | `handle(S item)` Handle an item.
    `protected abstract boolean` | `handleConverted(T converted, S incoming)` Handle the converted item.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### typeConverter

          @NotNull
          protected final Function1<T,S> typeConverter

    - #### deleteMark

          protected final T deleteMark

  - ### Constructor Detail

    - #### DeletingLoopItemHandler

          protected DeletingLoopItemHandler(@NotNull
                                            Function1<T,S> typeConverter,
                                            @Nullable
                                            T deleteMark)

      Constructor.
      Parameters:
        `typeConverter` - type converter which converts the incoming types to the collected types.
        `deleteMark` - special value returned by `typeConverter` which results in dletion of the given item

  - ### Method Detail

    - #### handleConverted

          protected abstract boolean handleConverted(T converted,
                                                     S incoming)

      Handle the converted item.
      Parameters:
        `converted` - converted item
        `incoming` - incoming item
      Returns:
        `true` go on with loop
        `false` break loop

    - #### handle

          public boolean handle(S item)

      Handle an item.
      Specified by:
        `handle` in interface `LoopItemHandler<S>`
      Parameters:
        `item` - item to handle
      Returns:
        `true` go on with loop
        `false` break loop

    - #### beforeStart

          public void beforeStart()

      Called before the loop is started.
      Specified by:
        `beforeStart` in interface `LoopHandler`

    - #### afterFinish

          public void afterFinish()

      Called after the loop has finished.
      Specified by:
        `afterFinish` in interface `LoopHandler`