com.hammurapi.extract

## Class Or<T,C>

- java.lang.Object
- - com.hammurapi.extract.ExtractorBase<T,Boolean,C>
  - - com.hammurapi.extract.Or<T,C>

- Type Parameters:
    `T` -
  All Implemented Interfaces:
    CompositePredicate<T,List<Predicate<T,C>>,C,Or<T,C>>, Extractor<T,Boolean,C>, FacadeExtractor<T,Boolean,C>, Mappable<T,Boolean,C>, Predicate<T,C>, Serializable, Cloneable

      public class Or<T,C>
      extends ExtractorBase<T,Boolean,C>
      implements CompositePredicate<T,List<Predicate<T,C>>,C,Or<T,C>>, Serializable

  Non-commutative OR.
  See Also:
    Serialized Form

- - ### Field Summary

    - ### Fields inherited from class com.hammurapi.extract.ExtractorBase

      `cost, costUnit, initialCost, invocations, nanos, totalCost`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `Or(double initialCost, TimeUnit costUnit)`
    `Or(double initialCost, TimeUnit costUnit, Iterable<Predicate<T,C>> parts)`
    `Or(double initialCost, TimeUnit costUnit, Predicate<T,C>... parts)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `Or<T,C>` | `add(Predicate<T,C> part)`
    `Object` | `clone()`
    `ComparisonResult` | `compareTo(Extractor<T,Boolean,C> otherPredicate)` Basic comparisons with True and False.
    `protected Boolean` | `extractInternal(C context, Map<C,Map<Extractor<T,? super Boolean,C>,? super Boolean>> cache, T... obj)`
    `double` | `getCost()`
    `List<Predicate<T,C>>` | `getParts()`
    `boolean` | `isContextDependent()`
    `Extractor<T,Boolean,C>` | `map(int[] map)` Applies mapping to extractor.
    `Predicate<T,C>` | `normalize()` Normalizes predicate by removing less restrictive parts in AND or more restrictive parts in OR, and analyzing if predicate is always TRUE or always FALSE.
    `Set<Integer>` | `parameterIndices()`
    `Predicate<T,C>` | `remove(Predicate<T,C> part)`
    `String` | `toString()`

    - ### Methods inherited from class com.hammurapi.extract.ExtractorBase

      `createCacheEntry, equals, extract`

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

      `finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

    - ### Methods inherited from interface com.hammurapi.extract.Extractor

      `extract`

- - ### Constructor Detail

    - #### Or

          public Or(double initialCost,
            TimeUnit costUnit)

    - #### Or

          public Or(double initialCost,
            TimeUnit costUnit,
            Predicate<T,C>... parts)

    - #### Or

          public Or(double initialCost,
            TimeUnit costUnit,
            Iterable<Predicate<T,C>> parts)

  - ### Method Detail

    - #### getParts

          public List<Predicate<T,C>> getParts()

      Specified by:
        `getParts` in interface `CompositePredicate<T,List<Predicate<T,C>>,C,Or<T,C>>`
      Returns:
        Sub-predicates.

    - #### compareTo

          public ComparisonResult compareTo(Extractor<T,Boolean,C> otherPredicate)

      Description copied from class: `ExtractorBase`
      Basic comparisons with True and False.
      Specified by:
        `compareTo` in interface `Extractor<T,Boolean,C>`
      Overrides:
        `compareTo` in class `ExtractorBase<T,Boolean,C>`
      Parameters:
        `otherPredicate` - Other extractor
      Returns:
        Comparison result.

    - #### extractInternal

          protected Boolean extractInternal(C context,
                                Map<C,Map<Extractor<T,? super Boolean,C>,? super Boolean>> cache,
                                T... obj)

      Specified by:
        `extractInternal` in class `ExtractorBase<T,Boolean,C>`

    - #### parameterIndices

          public Set<Integer> parameterIndices()

      Specified by:
        `parameterIndices` in interface `Extractor<T,Boolean,C>`
      Returns:
        Indexes of objects which this extractor uses for computations.

    - #### remove

          public Predicate<T,C> remove(Predicate<T,C> part)

      Specified by:
        `remove` in interface `CompositePredicate<T,List<Predicate<T,C>>,C,Or<T,C>>`
      Returns:
        Returns composite predicate of the same type without given part. If there is one remaining part then this part is returned.

    - #### normalize

          public Predicate<T,C> normalize()

      Description copied from interface: `CompositePredicate`
      Normalizes predicate by removing less restrictive parts in AND or more restrictive parts in OR, and analyzing if predicate is always TRUE or always FALSE.
      Specified by:
        `normalize` in interface `CompositePredicate<T,List<Predicate<T,C>>,C,Or<T,C>>`
      Returns:
        Normalized predicate, True if predicate always evaluates to true, False if predicate always evaluates to false.

    - #### isContextDependent

          public boolean isContextDependent()

      Specified by:
        `isContextDependent` in interface `Extractor<T,Boolean,C>`
      Returns:
        True if extractor uses context for extraction. False if only object(s) are used.

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

    - #### getCost

          public double getCost()

      Specified by:
        `getCost` in interface `Extractor<T,Boolean,C>`
      Overrides:
        `getCost` in class `ExtractorBase<T,Boolean,C>`
      Returns:
        Extractor evaluation cost. Cost is used for optimization of computation intensive algorithms. E.g. in Store it is used for selection of indices for query operations.

    - #### map

          public Extractor<T,Boolean,C> map(int[] map)

      Description copied from interface: `Mappable`
      Applies mapping to extractor.
      Specified by:
        `map` in interface `Mappable<T,Boolean,C>`
      Returns:
        Extractor with changed mapping or null if mapping is not possible.

    - #### clone

          public Object clone()
                       throws CloneNotSupportedException

      Overrides:
        `clone` in class `Object`
      Throws:
        `CloneNotSupportedException`

    - #### add

          public Or<T,C> add(Predicate<T,C> part)

      Specified by:
        `add` in interface `CompositePredicate<T,List<Predicate<T,C>>,C,Or<T,C>>`