Package org.optaplanner.core.impl.score.stream

## Class InnerConstraintFactory<Solution_>

- java.lang.Object
- - org.optaplanner.core.impl.score.stream.InnerConstraintFactory<Solution_>

- All Implemented Interfaces:
    `ConstraintFactory`
  Direct Known Subclasses:
    `BavetConstraintFactory`, `DroolsConstraintFactory`

      public abstract class InnerConstraintFactory<Solution_>
      extends Object
      implements ConstraintFactory

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `InnerConstraintFactory()` |

  - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `<A> void` | `assertValidFromType​(Class<A> fromType)` |
    `static <Constraint_ extends Constraint,​Score_> Map<Constraint_,​Score_>` | `extractConstraintToWeightMap​(List<Constraint_> constraintList, Function<Constraint_,​Score_> weightExtractor, Score_ zeroScore)` |
    `<A> UniConstraintStream<A>` | `from​(Class<A> fromClass)` | Start a `ConstraintStream` of all instances of the fromClass that are known as `problem facts` or `planning entities`.
    `<A> BiConstraintStream<A,​A>` | `fromUniquePair​(Class<A> fromClass, BiJoiner<A,​A> joiner)` | Create a new `BiConstraintStream` for every unique combination of A and another A with a higher `PlanningId` for which the `BiJoiner` is true (for the properties it extracts from both facts).
    `abstract SolutionDescriptor<Solution_>` | `getSolutionDescriptor()` |

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

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

    - ### Methods inherited from interface org.optaplanner.core.api.score.stream.ConstraintFactory

      `fromUnfiltered, fromUniquePair, fromUniquePair, fromUniquePair, fromUniquePair, fromUniquePair, getDefaultConstraintPackage`

- - ### Constructor Detail

    - #### InnerConstraintFactory

          public InnerConstraintFactory()

  - ### Method Detail

    - #### from

          public <A> UniConstraintStream<A> from​(Class<A> fromClass)

      Description copied from interface: `ConstraintFactory`
      Start a `ConstraintStream` of all instances of the fromClass that are known as `problem facts` or `planning entities`.

      If the fromClass is a `PlanningEntity`, then it will be automatically `filtered` to only contain fully initialized entities, for which each genuine `PlanningVariable` (of the fromClass or a superclass thereof) is initialized (so when the value is not null - unless `PlanningVariable.nullable()` is modified). This filtering will NOT automatically apply to genuine planning variables of subclass planning entities of the fromClass.

      Specified by:
        `from` in interface `ConstraintFactory`
      Type Parameters:
        `A` - the type of the matched problem fact or `planning entity`
      Parameters:
        `fromClass` - never null
      Returns:
        never null

    - #### fromUniquePair

          public <A> BiConstraintStream<A,​A> fromUniquePair​(Class<A> fromClass,
                                                                  BiJoiner<A,​A> joiner)

      Description copied from interface: `ConstraintFactory`
      Create a new `BiConstraintStream` for every unique combination of A and another A with a higher `PlanningId` for which the `BiJoiner` is true (for the properties it extracts from both facts).

      Important: This is faster and more scalable than not using a `ConstraintFactory.fromUniquePair(Class)` joiner} followed by a `filter`, because it applies hashing and/or indexing on the properties, so it doesn't create nor checks almost every combination of A and A.

      This method is syntactic sugar for `UniConstraintStream.join(Class, BiJoiner)`. It automatically adds a `lessThan` joiner on the `PlanningId` of A.

      This method has overloaded methods with multiple `BiJoiner` parameters.

      Specified by:
        `fromUniquePair` in interface `ConstraintFactory`
      Type Parameters:
        `A` - the type of the matched problem fact or `planning entity`
      Parameters:
        `fromClass` - never null
        `joiner` - never null
      Returns:
        a stream that matches every unique combination of A and another A for which the `BiJoiner` is true

    - #### assertValidFromType

          public <A> void assertValidFromType​(Class<A> fromType)

    - #### extractConstraintToWeightMap

          public static <Constraint_ extends Constraint,​Score_> Map<Constraint_,​Score_> extractConstraintToWeightMap​(List<Constraint_> constraintList,
                                                                                                                                 Function<Constraint_,​Score_> weightExtractor,
                                                                                                                                 Score_ zeroScore)

    - #### getSolutionDescriptor

          public abstract SolutionDescriptor<Solution_> getSolutionDescriptor()

      Returns:
        never null