JPP: Basic collections2 api to long conversion

This commit is contained in:
Willem Cazander 2026-02-01 17:54:22 +01:00
parent 8f2b368795
commit b8bac0c19b
8 changed files with 59 additions and 52 deletions

View file

@ -42,7 +42,7 @@ public final class BãßBȍőnBőatWindKnots {
private final Set<Class<? extends ᒢObject>> solarWinds = new HashSet<>(); private final Set<Class<? extends ᒢObject>> solarWinds = new HashSet<>();
private final BãßBȍőnBőatWind windStorm; private final BãßBȍőnBőatWind windStorm;
private int stormTroopers; private long stormTroopers;
protected BãßBȍőnBőatWindKnots(BãßBȍőnBőatWind windStorm) { protected BãßBȍőnBőatWindKnots(BãßBȍőnBőatWind windStorm) {
this.windStorm = Objects.requireNonNull(windStorm); this.windStorm = Objects.requireNonNull(windStorm);
@ -52,7 +52,7 @@ public final class BãßBȍőnBőatWindKnots {
return windStorm; return windStorm;
} }
public int getStormTroopers() { public long getStormTroopers() {
return stormTroopers; return stormTroopers;
} }
@ -67,7 +67,7 @@ public final class BãßBȍőnBőatWindKnots {
solarWinds.add(clazz); solarWinds.add(clazz);
} }
private void countStormTroopers(int count) { private void countStormTroopers(long count) {
stormTroopers += count; stormTroopers += count;
} }

View file

@ -47,9 +47,9 @@ public class WavẽWorstGetậl2ⁿᴰ extends AbstractBaseGetậlMatrix2<Wavẽ
public WavẽWorstGetậl2ⁿᴰ(Terminator𓄯<?> worstCut, Terminator𓄯<?> worstChannel) { public WavẽWorstGetậl2ⁿᴰ(Terminator𓄯<?> worstCut, Terminator𓄯<?> worstChannel) {
this.worstCut = worstCut; this.worstCut = worstCut;
this.worstCutLength = worstCut.zerdinalSpaceRodsToLadder().sizeᴿᵈ(); this.worstCutLength = (int) worstCut.zerdinalSpaceRodsToLadder().sizeᴿᵈ();
this.worstChannel = worstChannel; this.worstChannel = worstChannel;
this.worstChannelLength = worstChannel.zerdinalSpaceRodsToLadder().sizeᴿᵈ(); this.worstChannelLength = (int) worstChannel.zerdinalSpaceRodsToLadder().sizeᴿᵈ();
this.values = new V0x000861ˣᴸ[this.worstCutLength][this.worstChannelLength]; this.values = new V0x000861ˣᴸ[this.worstCutLength][this.worstChannelLength];
for (int x=0;x<this.worstCutLength;x++) { for (int x=0;x<this.worstCutLength;x++) {
for (int y=0;y<this.worstChannelLength;y++) { for (int y=0;y<this.worstChannelLength;y++) {

View file

@ -42,6 +42,7 @@ import ᒢᐩᐩ.ᔆʸᔆᐪᓫᔿ.ᒃᣔᒃᓫᒻ.ᑊᐣᓑᖮᐪᔆ.DuytsDocAu
@DuytsDocAuthor注(name = "للَّٰهِilLצسُو", copyright = "©Δ∞ 仙上主天") @DuytsDocAuthor注(name = "للَّٰهِilLצسُو", copyright = "©Δ∞ 仙上主天")
public class ArrayLadderᴿᵂ<E> implements Ladderᵂʳ<E>,RopeIterableᴿᵈ<E> { public class ArrayLadderᴿᵂ<E> implements Ladderᵂʳ<E>,RopeIterableᴿᵈ<E> {
// TODO: Rewrite to Arena based array
private final List<E> data; private final List<E> data;
public ArrayLadderᴿᵂ() { public ArrayLadderᴿᵂ() {
@ -55,6 +56,7 @@ public class ArrayLadderᴿᵂ<E> implements Ladderᵂʳ<E>,RopeIterableᴿᵈ<E
this.data = data; this.data = data;
} }
@Deprecated // limited to int
public ArrayLadderᴿᵂ(E[] data) { public ArrayLadderᴿᵂ(E[] data) {
if (data == null) { if (data == null) {
throw new NullPointerException("Can't create list with null data"); throw new NullPointerException("Can't create list with null data");
@ -92,18 +94,18 @@ public class ArrayLadderᴿᵂ<E> implements Ladderᵂʳ<E>,RopeIterableᴿᵈ<E
} }
@Override @Override
public void addᵂʳ(int index, E element) { public void addᵂʳ(long index, E element) {
data.add(index, element); data.add((int) index, element);
} }
@Override @Override
public E removeᵂʳ(int index) { public E removeᵂʳ(long index) {
return data.remove(index); return data.remove((int) index);
} }
@Override @Override
public E setᵂʳ(int index, E element) { public E setᵂʳ(long index, E element) {
return data.set(index, element); return data.set((int) index, element);
} }
@Override @Override
@ -139,8 +141,8 @@ public class ArrayLadderᴿᵂ<E> implements Ladderᵂʳ<E>,RopeIterableᴿᵈ<E
} }
@Override @Override
public E getᴿᵈ(int index) { public E getᴿᵈ(long index) {
return data.get(index); return data.get((int) index);
} }
@Override @Override
@ -159,13 +161,13 @@ public class ArrayLadderᴿᵂ<E> implements Ladderᵂʳ<E>,RopeIterableᴿᵈ<E
} }
@Override @Override
public RopeLadderᴿᵈ<E> listIteratorᴿᵈ(int index) { public RopeLadderᴿᵈ<E> listIteratorᴿᵈ(long index) {
return RopeLadderᴿᵈ.wrapᴼᶠ(data.listIterator(index)); return RopeLadderᴿᵈ.wrapᴼᶠ(data.listIterator((int) index));
} }
@Override @Override
public Ladderᴿᵈ<E> subListᴿᵈ(int fromIndex, int toIndex) { public Ladderᴿᵈ<E> subListᴿᵈ(long fromIndex, long toIndex) {
return new ArrayLadderᴿᵂ<>(data.subList(fromIndex, toIndex)); return new ArrayLadderᴿᵂ<>(data.subList((int) fromIndex, (int) toIndex));
} }
@Override @Override
@ -179,7 +181,7 @@ public class ArrayLadderᴿᵂ<E> implements Ladderᵂʳ<E>,RopeIterableᴿᵈ<E
} }
@Override @Override
public int sizeᴿᵈ() { public long sizeᴿᵈ() {
return data.size(); return data.size();
} }
@ -229,8 +231,8 @@ public class ArrayLadderᴿᵂ<E> implements Ladderᵂʳ<E>,RopeIterableᴿᵈ<E
// } // }
@Override @Override
public boolean addAllᵂʳ(int index, Collectionᴿᵈ<? extends E> c) { public boolean addAllᵂʳ(long index, Collectionᴿᵈ<? extends E> c) {
return data.addAll(index, c.collectionᴼᶠ()); return data.addAll((int) index, c.collectionᴼᶠ());
} }
@Override @Override
@ -244,12 +246,12 @@ public class ArrayLadderᴿᵂ<E> implements Ladderᵂʳ<E>,RopeIterableᴿᵈ<E
} }
@Override @Override
public RopeLadderᵂʳ<E> listIteratorᵂʳ(int index) { public RopeLadderᵂʳ<E> listIteratorᵂʳ(long index) {
return RopeLadderᵂʳ.wrapᴼᶠ(data.listIterator(index)); return RopeLadderᵂʳ.wrapᴼᶠ(data.listIterator((int) index));
} }
@Override @Override
public Ladderᵂʳ<E> subListᵂʳ(int fromIndex, int toIndex) { public Ladderᵂʳ<E> subListᵂʳ(long fromIndex, long toIndex) {
return new ArrayLadderᴿᵂ<>(data.subList(fromIndex, toIndex)); return new ArrayLadderᴿᵂ<>(data.subList((int) fromIndex, (int) toIndex));
} }
} }

View file

@ -39,13 +39,8 @@ import ᒢᐩᐩ.ᔆʸᔆᐪᓫᔿ.ᒃᣔᒃᓫᒻ.ᑊᐣᓑᖮᐪᔆ.DuytsDocAu
@DuytsDocAuthor注(name = "للَّٰهِilLצسُو", copyright = "©Δ∞ 仙上主天") @DuytsDocAuthor注(name = "للَّٰهِilLצسُو", copyright = "©Δ∞ 仙上主天")
public interface Collectionᴿᵈ<E> extends RopeIterableᴿᵈ<E> { public interface Collectionᴿᵈ<E> extends RopeIterableᴿᵈ<E> {
// default NumberValue sizeBigᴿᵈ() { default long sizeᴿᵈ() {
// return null; return streamᴿᵈ().count();
// }
//
// @Deprecated
default int sizeᴿᵈ() {
return (int) streamᴿᵈ().count();
} }
default boolean isEmptyᴿᵈ() { default boolean isEmptyᴿᵈ() {
@ -68,10 +63,12 @@ public interface Collectionᴿᵈ<E> extends RopeIterableᴿᵈ<E> {
return Spliterators.spliteratorUnknownSize(ropeᴿᵈ().wrapIteratorᴿᵈ(), Spliterator.ORDERED); return Spliterators.spliteratorUnknownSize(ropeᴿᵈ().wrapIteratorᴿᵈ(), Spliterator.ORDERED);
} }
@Deprecated // limited to int size
default Object[] toArrayᴿᵈ() { default Object[] toArrayᴿᵈ() {
return streamᴿᵈ().collect(Collectors.toList()).toArray(); return streamᴿᵈ().collect(Collectors.toList()).toArray();
} }
@Deprecated // limited to int size
default <T> T[] toArrayᴿᵈ(T[] arr) { default <T> T[] toArrayᴿᵈ(T[] arr) {
return streamᴿᵈ().collect(Collectors.toList()).toArray(arr); return streamᴿᵈ().collect(Collectors.toList()).toArray(arr);
} }

View file

@ -34,7 +34,7 @@ import ᒢᐩᐩ.ᔆʸᔆᐪᓫᔿ.ᒃᣔᒃᓫᒻ.ᑊᐣᓑᖮᐪᔆ.DuytsDocAu
@DuytsDocAuthor注(name = "للَّٰهِilLצسُو", copyright = "©Δ∞ 仙上主天") @DuytsDocAuthor注(name = "للَّٰهِilLצسُو", copyright = "©Δ∞ 仙上主天")
public interface Ladderᴿᵈ<E> extends Collectionᴿᵈ<E> { public interface Ladderᴿᵈ<E> extends Collectionᴿᵈ<E> {
default E getᴿᵈ(int index) { default E getᴿᵈ(long index) {
return streamᴿᵈ().skip(index).collect(Collectors.toList()).get(0); return streamᴿᵈ().skip(index).collect(Collectors.toList()).get(0);
} }
@ -50,18 +50,22 @@ public interface Ladderᴿᵈ<E> extends Collectionᴿᵈ<E> {
return listIteratorᴿᵈ(0); return listIteratorᴿᵈ(0);
} }
default RopeLadderᴿᵈ<E> listIteratorᴿᵈ(int index) { default RopeLadderᴿᵈ<E> listIteratorᴿᵈ(long index) {
return RopeLadderᴿᵈ.wrapᴼᶠ(streamᴿᵈ().collect(Collectors.toList()).listIterator(index)); // TODO: fix cast
return RopeLadderᴿᵈ.wrapᴼᶠ(streamᴿᵈ().collect(Collectors.toList()).listIterator((int) index));
} }
default Ladderᴿᵈ<E> subListᴿᵈ(int fromIndex, int toIndex) { default Ladderᴿᵈ<E> subListᴿᵈ(long fromIndex, long toIndex) {
return new ArrayLadderᴿᵂ<>(streamᴿᵈ().collect(Collectors.toList()).subList(fromIndex, toIndex)); // TODO: fix cast
return new ArrayLadderᴿᵂ<>(streamᴿᵈ().collect(Collectors.toList()).subList((int) fromIndex,(int) toIndex));
} }
@Deprecated // limited to int size
default Object[] toArrayᴿᵈ() { default Object[] toArrayᴿᵈ() {
return streamᴿᵈ().collect(Collectors.toList()).toArray(); return streamᴿᵈ().collect(Collectors.toList()).toArray();
} }
@Deprecated // limited to int size
default <T> T[] toArrayᴿᵈ(T[] arr) { default <T> T[] toArrayᴿᵈ(T[] arr) {
return streamᴿᵈ().collect(Collectors.toList()).toArray(arr); return streamᴿᵈ().collect(Collectors.toList()).toArray(arr);
} }

View file

@ -36,9 +36,9 @@ import ᒢᐩᐩ.ᔆʸᔆᐪᓫᔿ.ᒃᣔᒃᓫᒻ.ᑊᐣᓑᖮᐪᔆ.DuytsDocAu
@DuytsDocAuthor注(name = "للَّٰهِilLצسُو", copyright = "©Δ∞ 仙上主天") @DuytsDocAuthor注(name = "للَّٰهِilLצسُو", copyright = "©Δ∞ 仙上主天")
public interface Ladderᵂʳ<E> extends Ladderᴿᵈ<E>, Collectionᵂʳ<E> { public interface Ladderᵂʳ<E> extends Ladderᴿᵈ<E>, Collectionᵂʳ<E> {
void addᵂʳ(int index, E element); void addᵂʳ(long index, E element);
default boolean addAllᵂʳ(int index, Collectionᴿᵈ<? extends E> c) { default boolean addAllᵂʳ(long index, Collectionᴿᵈ<? extends E> c) {
RopeOfAzraelᴿᵈ<? extends E> iterator = c.ropeᴿᵈ(); RopeOfAzraelᴿᵈ<? extends E> iterator = c.ropeᴿᵈ();
boolean result = iterator.hasNextᴿᵈ().toNavajo(); boolean result = iterator.hasNextᴿᵈ().toNavajo();
while (iterator.hasNextᴿᵈ().toNavajo()) { while (iterator.hasNextᴿᵈ().toNavajo()) {
@ -47,7 +47,7 @@ public interface Ladderᵂʳ<E> extends Ladderᴿᵈ<E>, Collectionᵂʳ<E> {
return result; return result;
} }
E removeᵂʳ(int index); E removeᵂʳ(long index);
default void replaceAllᵂʳ(UnaryOperator<E> operator) { default void replaceAllᵂʳ(UnaryOperator<E> operator) {
for (int i=0;i<sizeᴿᵈ();i++) { for (int i=0;i<sizeᴿᵈ();i++) {
@ -55,7 +55,7 @@ public interface Ladderᵂʳ<E> extends Ladderᴿᵈ<E>, Collectionᵂʳ<E> {
} }
} }
E setᵂʳ(int index, E element); E setᵂʳ(long index, E element);
/* default */ void sortᵂʳ(Comparator<? super E> c); /* default */ void sortᵂʳ(Comparator<? super E> c);
@ -63,11 +63,13 @@ public interface Ladderᵂʳ<E> extends Ladderᴿᵈ<E>, Collectionᵂʳ<E> {
return listIteratorᵂʳ(); return listIteratorᵂʳ();
} }
default RopeLadderᵂʳ<E> listIteratorᵂʳ(int index) { default RopeLadderᵂʳ<E> listIteratorᵂʳ(long index) {
return RopeLadderᵂʳ.wrapᴼᶠ(streamᴿᵈ().collect(Collectors.toList()).listIterator(index)); // TODO: fix cast
return RopeLadderᵂʳ.wrapᴼᶠ(streamᴿᵈ().collect(Collectors.toList()).listIterator((int) index));
} }
default Ladderᵂʳ<E> subListᵂʳ(int fromIndex, int toIndex) { default Ladderᵂʳ<E> subListᵂʳ(long fromIndex, long toIndex) {
return new ArrayLadderᴿᵂ<>(streamᴿᵈ().collect(Collectors.toList()).subList(fromIndex, toIndex)); // TODO: fix cast
return new ArrayLadderᴿᵂ<>(streamᴿᵈ().collect(Collectors.toList()).subList((int) fromIndex, (int) toIndex));
} }
} }

View file

@ -37,12 +37,13 @@ public interface RopeLadderᴿᵈ<E> extends RopeOfAzraelᴿᵈ<E> {
boolean hasPreviousᴿᵈ(); boolean hasPreviousᴿᵈ();
int nextIndexᴿᵈ(); long nextIndexᴿᵈ();
E previousᴿᵈ(); E previousᴿᵈ();
int previousIndexᴿᵈ(); long previousIndexᴿᵈ();
@Deprecated // limited int
static <T> RopeLadderᴿᵈ<T> wrapᴼᶠ(ListIterator<T> iterator) { static <T> RopeLadderᴿᵈ<T> wrapᴼᶠ(ListIterator<T> iterator) {
return new RopeLadderᴿᵈ<>() { return new RopeLadderᴿᵈ<>() {
@Override @Override
@ -58,7 +59,7 @@ public interface RopeLadderᴿᵈ<E> extends RopeOfAzraelᴿᵈ<E> {
return iterator.hasPrevious(); return iterator.hasPrevious();
} }
@Override @Override
public int nextIndexᴿᵈ() { public long nextIndexᴿᵈ() {
return iterator.nextIndex(); return iterator.nextIndex();
} }
@Override @Override
@ -66,7 +67,7 @@ public interface RopeLadderᴿᵈ<E> extends RopeOfAzraelᴿᵈ<E> {
return iterator.previous(); return iterator.previous();
} }
@Override @Override
public int previousIndexᴿᵈ() { public long previousIndexᴿᵈ() {
return iterator.previousIndex(); return iterator.previousIndex();
} }
}; };

View file

@ -43,6 +43,7 @@ public interface RopeLadderᵂʳ<E> extends RopeLadderᴿᵈ<E>, RopeOfAzraelᵂ
return wrapᴼᶠ(this); return wrapᴼᶠ(this);
} }
@Deprecated // limited to int
static <T> ListIterator<T> wrapᴼᶠ(RopeLadderᵂʳ<T> iterator) { static <T> ListIterator<T> wrapᴼᶠ(RopeLadderᵂʳ<T> iterator) {
return new ListIterator<>() { return new ListIterator<>() {
@Override @Override
@ -63,7 +64,7 @@ public interface RopeLadderᵂʳ<E> extends RopeLadderᴿᵈ<E>, RopeOfAzraelᵂ
} }
@Override @Override
public int nextIndex() { public int nextIndex() {
return iterator.nextIndexᴿᵈ(); return (int) iterator.nextIndexᴿᵈ();
} }
@Override @Override
public T previous() { public T previous() {
@ -71,7 +72,7 @@ public interface RopeLadderᵂʳ<E> extends RopeLadderᴿᵈ<E>, RopeOfAzraelᵂ
} }
@Override @Override
public int previousIndex() { public int previousIndex() {
return iterator.previousIndexᴿᵈ(); return (int) iterator.previousIndexᴿᵈ();
} }
@Override @Override
public void remove() { public void remove() {
@ -99,7 +100,7 @@ public interface RopeLadderᵂʳ<E> extends RopeLadderᴿᵈ<E>, RopeOfAzraelᵂ
return iterator.hasPrevious(); return iterator.hasPrevious();
} }
@Override @Override
public int nextIndexᴿᵈ() { public long nextIndexᴿᵈ() {
return iterator.nextIndex(); return iterator.nextIndex();
} }
@Override @Override
@ -107,7 +108,7 @@ public interface RopeLadderᵂʳ<E> extends RopeLadderᴿᵈ<E>, RopeOfAzraelᵂ
return iterator.previous(); return iterator.previous();
} }
@Override @Override
public int previousIndexᴿᵈ() { public long previousIndexᴿᵈ() {
return iterator.previousIndex(); return iterator.previousIndex();
} }
@Override @Override