GeneralJavaUtils/src/dev/asdf00/general/utils/list/PrimitiveList.java
2023-04-18 19:00:51 +02:00

159 lines
5.2 KiB
Java

package dev.asdf00.general.utils.list;
import dev.asdf00.general.utils.list.internal.AbstractBaseList;
import dev.asdf00.general.utils.list.internal.ByteList;
public abstract class PrimitiveList<T> extends AbstractBaseList<T> {
public static <T> PrimitiveList<T> create(Class<T> boxedType) {
if (Byte.class == boxedType) {
return (PrimitiveList<T>) new ByteList();
} else if (Short.class.equals(boxedType)) {
return null;
} else if (Integer.class.equals(boxedType)) {
return null;
} else if (Long.class.equals(boxedType)) {
return null;
} else if (Float.class.equals(boxedType)) {
return null;
} else if (Double.class.equals(boxedType)) {
return null;
} else if (Character.class.equals(boxedType)) {
return null;
} else if (Boolean.class.equals(boxedType)) {
return null;
} else {
throw new IllegalArgumentException("%s is not a boxed type!".formatted(boxedType));
}
}
public void addByte(byte value) {
throw new UnsupportedOperationException("this list is not of type Byte!");
}
public void addShort(short value) {
throw new UnsupportedOperationException("this list is not of type Short!");
}
public void addInt(int value) {
throw new UnsupportedOperationException("this list is not of type Integer!");
}
public void addLong(long value) {
throw new UnsupportedOperationException("this list is not of type Long!");
}
public void addFloat(float value) {
throw new UnsupportedOperationException("this list is not of type Float!");
}
public void addDouble(double value) {
throw new UnsupportedOperationException("this list is not of type Double!");
}
public void addChar(char value) {
throw new UnsupportedOperationException("this list is not of type Character!");
}
public void addBoolean(boolean value) {
throw new UnsupportedOperationException("this list is not of type Boolean!");
}
public byte getByte(int index) {
throw new UnsupportedOperationException("this list is not of type Byte!");
}
public short getShort(int index) {
throw new UnsupportedOperationException("this list is not of type Short!");
}
public int getInt(int index) {
throw new UnsupportedOperationException("this list is not of type Integer!");
}
public long getLong(int index) {
throw new UnsupportedOperationException("this list is not of type Long!");
}
public float getFloat(int index) {
throw new UnsupportedOperationException("this list is not of type Float!");
}
public double getDouble(int index) {
throw new UnsupportedOperationException("this list is not of type Double!");
}
public char getChar(int index) {
throw new UnsupportedOperationException("this list is not of type Character!");
}
public boolean getBoolean(int index) {
throw new UnsupportedOperationException("this list is not of type Boolean!");
}
public byte[] toByteArray() {
throw new UnsupportedOperationException("this list is not of type Byte!");
}
public short[] toShortArray() {
throw new UnsupportedOperationException("this list is not of type Short!");
}
public int[] toIntArray() {
throw new UnsupportedOperationException("this list is not of type Integer!");
}
public long[] toLongArray() {
throw new UnsupportedOperationException("this list is not of type Long!");
}
public float[] toFloatArray() {
throw new UnsupportedOperationException("this list is not of type Float!");
}
public double[] toDoubleArray() {
throw new UnsupportedOperationException("this list is not of type Double!");
}
public char[] toCharArray() {
throw new UnsupportedOperationException("this list is not of type Character!");
}
public boolean[] toBooleanArray() {
throw new UnsupportedOperationException("this list is not of type Boolean!");
}
public byte[] finalizeAsByteArray() {
throw new UnsupportedOperationException("this list is not of type Byte!");
}
public short[] finalizeAsShortArray() {
throw new UnsupportedOperationException("this list is not of type Short!");
}
public int[] finalizeAsIntArray() {
throw new UnsupportedOperationException("this list is not of type Integer!");
}
public long[] finalizeAsLongArray() {
throw new UnsupportedOperationException("this list is not of type Long!");
}
public float[] finalizeAsFloatArray() {
throw new UnsupportedOperationException("this list is not of type Float!");
}
public double[] finalizeAsDoubleArray() {
throw new UnsupportedOperationException("this list is not of type Double!");
}
public char[] finalizeAsCharArray() {
throw new UnsupportedOperationException("this list is not of type Character!");
}
public boolean[] finalizeAsBooleanArray() {
throw new UnsupportedOperationException("this list is not of type Boolean!");
}
public abstract boolean isFinalized();
}