JPP: Refactored abacus api to english candy letters
This commit is contained in:
parent
29a413bb6d
commit
0d55269389
63 changed files with 251 additions and 589 deletions
|
|
@ -27,6 +27,17 @@
|
|||
|
||||
package ᒢᐩᐩ.ᣕᓑᔿᒃᓫᣗ.ᙆᓫᣗᒄᑊᣕᣔᒻ;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.NoSuchElementException;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import ᒢᐩᐩ.ᒡᒢᑊᒻᒻᓫᔿ.ᣳᣝᐤᣜᣳ.ᐪᓫᣗᔿᑊᣕᣔᐪᐤᣗ.T002ᖟ;
|
||||
import ᒢᐩᐩ.ᒼᐤᒻᒻᓫᒼᐪᑊᐤᣕᔆ.ArrayLadderᴿᵂ;
|
||||
import ᒢᐩᐩ.ᒼᐤᒻᒻᓫᒼᐪᑊᐤᣕᔆ.Ladderᴿᵈ;
|
||||
import ᒢᐩᐩ.ᒼᐤᒻᒻᓫᒼᐪᑊᐤᣕᔆ.Ladderᵂʳ;
|
||||
import ᒢᐩᐩ.ᒼᐤᒻᒻᓫᒼᐪᑊᐤᣕᔆ.RopeOfAzraelᴿᵈ;
|
||||
import ᒢᐩᐩ.ᔆʸᔆᐪᓫᔿ.ᒃᣔᒃᓫᒻ.ᑊᐣᓑᖮᐪᔆ.DuytsDocAuthor注;
|
||||
|
||||
/// @author للَّٰهِilLצسُو
|
||||
|
|
@ -36,4 +47,42 @@ public interface PrimordialZerdinalSpaceMaterializer<T extends PrimordialZerdina
|
|||
|
||||
/// Materialize an number from the bounded zerdinal number space.
|
||||
T zerdinalMaterializeSpace(int zerdinal);
|
||||
|
||||
default RopeOfAzraelᴿᵈ<T> zerdinalSpaceRope() {
|
||||
return new RopeOfAzraelᴿᵈ<T> () {
|
||||
int zerdinalSpaceWalker = 0;
|
||||
@Override
|
||||
public T002ᖟ hasNextᴿᵈ() {
|
||||
return T002ᖟ.valueOf(zerdinalSpaceWalker < zerdinalSpaceBoundary());
|
||||
}
|
||||
|
||||
@Override
|
||||
public T nextᴿᵈ() {
|
||||
if (zerdinalSpaceWalker >= zerdinalSpaceBoundary()) {
|
||||
throw new NoSuchElementException("Rope roll out does not extend past the zerdinal space boundry: " + zerdinalSpaceBoundary());
|
||||
}
|
||||
T result = zerdinalMaterializeSpace(zerdinalSpaceWalker);
|
||||
zerdinalSpaceWalker++;
|
||||
return result;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
default void zerdinalSpaceRopeWalk(Consumer<T> consumer) {
|
||||
zerdinalSpaceRope().forEachRemainingᴿᵈ(consumer);
|
||||
}
|
||||
|
||||
default <X> Ladderᴿᵈ<X> zerdinalSpaceRodsToLadder(Function<T, X> mapper) {
|
||||
Ladderᵂʳ<X> result = new ArrayLadderᴿᵂ<>();
|
||||
zerdinalSpaceRopeWalk(v -> result.addᵂʳ(mapper.apply(v)));
|
||||
return result;
|
||||
}
|
||||
|
||||
default Ladderᴿᵈ<T> zerdinalSpaceRodsToLadder() {
|
||||
return zerdinalSpaceRodsToLadder(v -> v);
|
||||
}
|
||||
|
||||
default Map<String,T> zerdinalSpaceRodsToMap(Function<T,String> keyMapper) {
|
||||
return zerdinalSpaceRodsToLadder().streamᴿᵈ().collect(Collectors.toMap(keyMapper, v -> v));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue