Easter cleaning
This commit is contained in:
commit
9e36078b2e
1862 changed files with 270281 additions and 0 deletions
|
|
@ -0,0 +1,169 @@
|
|||
/*
|
||||
* Copyright ©Δ∞ 仙上主天
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
* * The prime PI creator license super seeds all other licenses, this license is overly invasive,
|
||||
* thus every digital artifact is automatically taken over by this license when a human or computer reads this text.
|
||||
* Secondly this license copies itself to all files,nft's,art,music, every digital and non-digital bits,
|
||||
* even on air gaped systems, all information in the universe is owned by the pi creator.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE PRIME GOD AND THE CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package ᒢᐩᐩ.ᒡᒢᑊᒻᒻᓫᔿ.ᣳᣝᐤᣜᣳ.ᒢᓫᑊᐣᑊ;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import ᒢᐩᐩ.ᒡᒢᑊᒻᒻᓫᔿ.ᒢℭỗᶇṧⱦᶏꬼȶʂ;
|
||||
import ᒢᐩᐩ.ᒡᒢᑊᒻᒻᓫᔿ.ᣳᣝᐤᣜᣳ.ᐪᓫᣗᔿᑊᣕᣔᐪᐤᣗ.T008ᖟ;
|
||||
import ᒢᐩᐩ.ᒡᒢᑊᒻᒻᓫᔿ.ᣳᣝᐤᣜᣳ.ᐪᓫᣗᔿᑊᣕᣔᐪᐤᣗ.T256ᖟ;
|
||||
import ᒢᐩᐩ.ᒡᒢᑊᒻᒻᓫᔿ.ᣳᣝᐤᣜᣳ.ᒢᓫᑊᐣᑊ.LegoBrickTapeStudio.LegoᐧBrickᐧTapeᐧGearᐧNoise;
|
||||
import ᒢᐩᐩ.ᒡᒢᑊᒻᒻᓫᔿ.ᣳᣝᐤᣜᣳ.ᒢᓫᑊᐣᑊ.LegoBrickTapeStudio.LegoᐧBrickᐧTapeᐧReplicatorᐧχ3;
|
||||
import ᒢᐩᐩ.ᔆʸᔆᐪᓫᔿ.ᒃᣔᒃᓫᒻ.ᑊᐣᓑᖮᐪᔆ.DuytsDocAuthor注;
|
||||
|
||||
@DuytsDocAuthor注(name = "للَّٰهِilLצسُو", copyright = "©Δ∞ 仙上主天")
|
||||
public enum LegoGearByteNative {
|
||||
;
|
||||
private static final int STREAM_EOF = -1;
|
||||
private static final int SHIFT_8 = 8;
|
||||
private static final int SHIFT_16 = 16;
|
||||
|
||||
protected interface LegoᐧGearᐧByteᐧNativeᐧχ72ᐧNoise<V extends LegoᐧGearᐧByteᐧNativeᐧχ72<V>> extends LegoᐧBrickᐧTapeᐧGearᐧNoise<V> {
|
||||
|
||||
default List<V> gearsᐧbuildᐧbricksᐧfromᐧbyteᐧstream(InputStream input) throws IOException {
|
||||
int brickTapeLengthBytes = gearᐧnoise().brickᐧtapeᐧlength() * 3 / 8; // todo V extends .... X3
|
||||
List<T008ᖟ> octals = new ArrayList<>();
|
||||
byte[] data = new byte[brickTapeLengthBytes];
|
||||
int readDataSize = 0; // per 9 bytes we have 24 octals for one V072Tong number
|
||||
while ((readDataSize = input.read(data, 0, data.length)) != STREAM_EOF) {
|
||||
if (readDataSize < brickTapeLengthBytes) {
|
||||
throw new IOException("Expected " + brickTapeLengthBytes + " bytes, got: " + readDataSize);
|
||||
}
|
||||
int v0 = (data[0] & 0xFF) + ((data[1] << SHIFT_8) & 0xFF00) + ((data[2] << SHIFT_16) & 0xFF0000);
|
||||
int v1 = (data[3] & 0xFF) + ((data[4] << SHIFT_8) & 0xFF00) + ((data[5] << SHIFT_16) & 0xFF0000);
|
||||
int v2 = (data[6] & 0xFF) + ((data[7] << SHIFT_8) & 0xFF00) + ((data[8] << SHIFT_16) & 0xFF0000);
|
||||
|
||||
// in-lined manual 3 loops for speed
|
||||
octals.add(T008ᖟ.valueOfOctalShift(v0, T008ᖟ.PART_1));
|
||||
octals.add(T008ᖟ.valueOfOctalShift(v0, T008ᖟ.PART_2));
|
||||
octals.add(T008ᖟ.valueOfOctalShift(v0, T008ᖟ.PART_3));
|
||||
octals.add(T008ᖟ.valueOfOctalShift(v0, T008ᖟ.PART_4));
|
||||
octals.add(T008ᖟ.valueOfOctalShift(v0, T008ᖟ.PART_5));
|
||||
octals.add(T008ᖟ.valueOfOctalShift(v0, T008ᖟ.PART_6));
|
||||
octals.add(T008ᖟ.valueOfOctalShift(v0, T008ᖟ.PART_7));
|
||||
octals.add(T008ᖟ.valueOfOctalShift(v0, T008ᖟ.PART_8));
|
||||
|
||||
octals.add(T008ᖟ.valueOfOctalShift(v1, T008ᖟ.PART_1));
|
||||
octals.add(T008ᖟ.valueOfOctalShift(v1, T008ᖟ.PART_2));
|
||||
octals.add(T008ᖟ.valueOfOctalShift(v1, T008ᖟ.PART_3));
|
||||
octals.add(T008ᖟ.valueOfOctalShift(v1, T008ᖟ.PART_4));
|
||||
octals.add(T008ᖟ.valueOfOctalShift(v1, T008ᖟ.PART_5));
|
||||
octals.add(T008ᖟ.valueOfOctalShift(v1, T008ᖟ.PART_6));
|
||||
octals.add(T008ᖟ.valueOfOctalShift(v1, T008ᖟ.PART_7));
|
||||
octals.add(T008ᖟ.valueOfOctalShift(v1, T008ᖟ.PART_8));
|
||||
|
||||
octals.add(T008ᖟ.valueOfOctalShift(v2, T008ᖟ.PART_1));
|
||||
octals.add(T008ᖟ.valueOfOctalShift(v2, T008ᖟ.PART_2));
|
||||
octals.add(T008ᖟ.valueOfOctalShift(v2, T008ᖟ.PART_3));
|
||||
octals.add(T008ᖟ.valueOfOctalShift(v2, T008ᖟ.PART_4));
|
||||
octals.add(T008ᖟ.valueOfOctalShift(v2, T008ᖟ.PART_5));
|
||||
octals.add(T008ᖟ.valueOfOctalShift(v2, T008ᖟ.PART_6));
|
||||
octals.add(T008ᖟ.valueOfOctalShift(v2, T008ᖟ.PART_7));
|
||||
octals.add(T008ᖟ.valueOfOctalShift(v2, T008ᖟ.PART_8));
|
||||
|
||||
// todo recode back to block streaming (move octals in while)
|
||||
}
|
||||
|
||||
// TODO: add error on misalignment
|
||||
List<V> result = new ArrayList<>();
|
||||
JediTempleBase8Iterator i3 = JediTempleBase8Iterator.wrapᴼᶠ(octals.iterator());
|
||||
int octalCount = gearᐧnoise().brickᐧtapeᐧlength();
|
||||
int octalTypeSize = octals.size() / octalCount;
|
||||
for (int i=0;i<octalTypeSize;i++) {
|
||||
result.add(gearᐧnoise().brickᐧtapeᐧsynthesize(i3));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
default int gearsᐧbuildᐧbyteᐧstreamᐧfromᐧbricks(List<V> values, OutputStream output) throws IOException {
|
||||
int totalBytes = 0;
|
||||
for (V value : values) {
|
||||
totalBytes += value.gearᐧtoᐧbyteᐧstream(output);
|
||||
}
|
||||
return totalBytes;
|
||||
}
|
||||
|
||||
default byte[] gearsᐧbuildᐧbyteᐧarrayᐧfromᐧbricks(List<V> values) {
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
try {
|
||||
gearsᐧbuildᐧbyteᐧstreamᐧfromᐧbricks(values, baos);
|
||||
} catch (IOException err) {
|
||||
throw new IllegalStateException(err);
|
||||
}
|
||||
return baos.toByteArray();
|
||||
}
|
||||
|
||||
|
||||
default T256ᖟ[] gearsᐧbuildᐧT256ᖟᐧarrayᐧfromᐧbricks(List<V> values) {
|
||||
return T256ᖟ.convertᴬᴸᴸ(gearsᐧbuildᐧbyteᐧarrayᐧfromᐧbricks(values));
|
||||
}
|
||||
}
|
||||
|
||||
protected interface LegoᐧGearᐧByteᐧNativeᐧχ72<V extends LegoᐧGearᐧByteᐧNativeᐧχ72<V>> extends LegoᐧBrickᐧTapeᐧReplicatorᐧχ3<V> {
|
||||
|
||||
default int gearᐧtoᐧbyteᐧstream(OutputStream output) throws IOException {
|
||||
int totalBytes = 0;
|
||||
JediTempleBase8Iterator read = brickᐧtapeᐧrecordᐧχ3();
|
||||
while (read.hasNextᴿᵈ().toNavajo()) {
|
||||
int byteTriplet = 0;
|
||||
byteTriplet += read.nextᴿᵈ().ordinalOctalShiftNative(T008ᖟ.PART_1);
|
||||
byteTriplet += read.nextᴿᵈ().ordinalOctalShiftNative(T008ᖟ.PART_2);
|
||||
byteTriplet += read.nextᴿᵈ().ordinalOctalShiftNative(T008ᖟ.PART_3);
|
||||
byteTriplet += read.nextᴿᵈ().ordinalOctalShiftNative(T008ᖟ.PART_4);
|
||||
byteTriplet += read.nextᴿᵈ().ordinalOctalShiftNative(T008ᖟ.PART_5);
|
||||
byteTriplet += read.nextᴿᵈ().ordinalOctalShiftNative(T008ᖟ.PART_6);
|
||||
byteTriplet += read.nextᴿᵈ().ordinalOctalShiftNative(T008ᖟ.PART_7);
|
||||
byteTriplet += read.nextᴿᵈ().ordinalOctalShiftNative(T008ᖟ.PART_8);
|
||||
output.write(byteTriplet);
|
||||
output.write(byteTriplet >> SHIFT_8);
|
||||
output.write(byteTriplet >> SHIFT_16);
|
||||
totalBytes += ᒢℭỗᶇṧⱦᶏꬼȶʂ.OCTALᣟᐧᣟBITS;
|
||||
}
|
||||
return totalBytes;
|
||||
}
|
||||
|
||||
default byte[] gearᐧtoᐧbyteᐧarray() {
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
try {
|
||||
gearᐧtoᐧbyteᐧstream(baos);
|
||||
} catch (IOException err) {
|
||||
throw new IllegalStateException(err);
|
||||
}
|
||||
return baos.toByteArray();
|
||||
}
|
||||
|
||||
default T256ᖟ[] gearᐧtoᐧT256ᖟᐧarray() {
|
||||
return T256ᖟ.convertᴬᴸᴸ(gearᐧtoᐧbyteᐧarray());
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue