Skip to content

Conversation

@ge0ffrey
Copy link
Contributor

@ge0ffrey ge0ffrey commented Dec 27, 2025

  • Conference scheduling: direct contains usage
  • Conference scheduling: overlapping count code
  • All other quickstarts

@ge0ffrey ge0ffrey marked this pull request as ready for review January 15, 2026 20:46
Copilot AI review requested due to automatic review settings January 15, 2026 20:46
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces new specialized Joiners (contain, containedIn, and containAny) to replace generic filtering joiners in the conference scheduling constraint provider, improving code readability and expressiveness while maintaining semantic equivalence.

Changes:

  • Replaced individual Joiners static imports with a wildcard import
  • Refactored 10 constraint methods to use new specialized joiners instead of filtering lambdas
  • Maintained all existing penalty calculations and scoring logic

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

import static ai.timefold.solver.core.api.score.stream.Joiners.greaterThan;
import static ai.timefold.solver.core.api.score.stream.Joiners.lessThan;
import static ai.timefold.solver.core.api.score.stream.Joiners.overlapping;
import static ai.timefold.solver.core.api.score.stream.Joiners.*;
Copy link

Copilot AI Jan 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wildcard static imports can reduce code clarity and IDE support. Consider using explicit imports for each Joiner method (equal, greaterThan, lessThan, overlapping, filtering, contain, containedIn, containAny) to improve code maintainability and make dependencies more explicit.

Suggested change
import static ai.timefold.solver.core.api.score.stream.Joiners.*;
import static ai.timefold.solver.core.api.score.stream.Joiners.equal;
import static ai.timefold.solver.core.api.score.stream.Joiners.greaterThan;
import static ai.timefold.solver.core.api.score.stream.Joiners.lessThan;
import static ai.timefold.solver.core.api.score.stream.Joiners.overlapping;
import static ai.timefold.solver.core.api.score.stream.Joiners.filtering;
import static ai.timefold.solver.core.api.score.stream.Joiners.contain;
import static ai.timefold.solver.core.api.score.stream.Joiners.containedIn;
import static ai.timefold.solver.core.api.score.stream.Joiners.containAny;

Copilot uses AI. Check for mistakes.
.join(Speaker.class,
filtering((talk, speaker) -> talk.hasSpeaker(speaker)
&& speaker.getUnavailableTimeslots().contains(talk.getTimeslot())))
contain(Talk::getSpeakers, speaker -> speaker),
Copy link

Copilot AI Jan 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The lambda expression speaker -> speaker is an identity function. Depending on the API design, this could potentially be simplified to a method reference or omitted if the API supports it. Verify if the Joiners API provides a simpler alternative for identity mapping.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants