-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
113 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package io.github.cbuschka.objset; | ||
|
||
import java.util.function.BiFunction; | ||
import java.util.function.Function; | ||
|
||
public interface BiSelectJoin<Element1, Element2, Element3> { | ||
<Key> FilterableTriSelect<Element1, Element2, Element3> on(BiFunction<Element1, Element2, Key> element1KeyFunc, Function<Element3, Key> element2KeyFunc); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package io.github.cbuschka.objset; | ||
|
||
import java.util.function.Function; | ||
|
||
public interface UniSelectJoin<Element1, Element2> { | ||
<Key> FilterableBiSelect<Element1, Element2> on(Function<Element1, Key> element1KeyFunc, Function<Element2, Key> element2KeyFunc); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
src/main/java/io/github/cbuschka/objset/impl/BiSelectJoinImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package io.github.cbuschka.objset.impl; | ||
|
||
import io.github.cbuschka.objset.*; | ||
import lombok.AllArgsConstructor; | ||
|
||
import java.util.function.BiFunction; | ||
import java.util.function.Function; | ||
|
||
@AllArgsConstructor | ||
class BiSelectJoinImpl<Element1, Element2, Element3> implements BiSelectJoin<Element1, Element2, Element3> { | ||
private final JoinMode joinMode; | ||
private final Iterable<Pair<Element1, Element2>> source; | ||
private final Iterable<Element3> element3s; | ||
|
||
@Override | ||
public <Key> FilterableTriSelect<Element1, Element2, Element3> on(BiFunction<Element1, Element2, Key> element1And2KeyFunc, Function<Element3, Key> element3KeyFunc) { | ||
return new TriSelectImpl<>(JoinIterator.of(joinMode, source, (t) -> element1And2KeyFunc.apply(t.element1(), t.element2()), element3s, element3KeyFunc, (left, right) -> Triple.of(left.element1(), left.element2(), right))); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package io.github.cbuschka.objset.impl; | ||
|
||
enum JoinMode { | ||
INNER, | ||
LEFT_OUTER, | ||
RIGHT_OUTER, | ||
FULL_OUTER; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
src/main/java/io/github/cbuschka/objset/impl/UniSelectJoinImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package io.github.cbuschka.objset.impl; | ||
|
||
import io.github.cbuschka.objset.FilterableBiSelect; | ||
import io.github.cbuschka.objset.Pair; | ||
import io.github.cbuschka.objset.UniSelectJoin; | ||
import lombok.AllArgsConstructor; | ||
|
||
import java.util.function.Function; | ||
|
||
@AllArgsConstructor | ||
class UniSelectJoinImpl<Element1, Element2> implements UniSelectJoin<Element1, Element2> { | ||
private final JoinMode joinMode; | ||
private final Iterable<Element1> elements; | ||
private final Iterable<Element2> element2s; | ||
|
||
@Override | ||
public <Key> FilterableBiSelect<Element1, Element2> on(Function<Element1, Key> element1KeyFunc, Function<Element2, Key> element2KeyFunc) { | ||
return new BiSelectImpl<>(JoinIterator.of(joinMode, elements, element1KeyFunc, element2s, element2KeyFunc, Pair::of)); | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters