Source code formatted
This commit is contained in:
parent
28eaab65bd
commit
9c2d5cfb24
4
.project
4
.project
@ -31,9 +31,5 @@
|
||||
<natures>
|
||||
<nature>org.eclipse.m2e.core.maven2Nature</nature>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
<nature>org.eclipse.cdt.core.cnature</nature>
|
||||
<nature>org.eclipse.cdt.core.ccnature</nature>
|
||||
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
|
||||
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
|
10
pom.xml
10
pom.xml
@ -73,7 +73,7 @@
|
||||
<dependency>
|
||||
<groupId>org.jogamp.jogl</groupId>
|
||||
<artifactId>jogl-all-main</artifactId>
|
||||
<version>2.3.2</version>
|
||||
<version>2.4</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jogamp.gluegen</groupId>
|
||||
@ -88,7 +88,7 @@
|
||||
<dependency>
|
||||
<groupId>org.fusesource.jansi</groupId>
|
||||
<artifactId>jansi</artifactId>
|
||||
<version>1.15</version>
|
||||
<version>1.17.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.lingala.zip4j</groupId>
|
||||
@ -214,17 +214,17 @@
|
||||
<dependency>
|
||||
<groupId>org.infinispan</groupId>
|
||||
<artifactId>infinispan-jcache</artifactId>
|
||||
<version>8.2.4.Final</version>
|
||||
<version>9.4.0.Beta1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>it.unimi.dsi</groupId>
|
||||
<artifactId>fastutil</artifactId>
|
||||
<version>7.2.0</version>
|
||||
<version>8.2.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.code.gson</groupId>
|
||||
<artifactId>gson</artifactId>
|
||||
<version>2.8.2</version>
|
||||
<version>2.8.5</version>
|
||||
</dependency>
|
||||
<!-- https://mvnrepository.com/artifact/commons-io/commons-io -->
|
||||
<dependency>
|
||||
|
@ -184,7 +184,7 @@ public class PngReaderApng extends PngReaderByte {
|
||||
@Override
|
||||
protected boolean countChunkTypeAsAncillary(String id) {
|
||||
// we don't count fdat as ancillary data
|
||||
return super.countChunkTypeAsAncillary(id) && !id.equals(id.equals(PngChunkFDAT.ID));
|
||||
return super.countChunkTypeAsAncillary(id) && !id.equals(""+id.equals(PngChunkFDAT.ID));
|
||||
}
|
||||
|
||||
};
|
||||
|
@ -34,7 +34,6 @@ public class ConsoleUtils {
|
||||
|
||||
public void println(int level) {
|
||||
if (StaticVars.outputLevel >= level) {
|
||||
final String time = getTimeString();
|
||||
if (StaticVars.outputLevel == 0) {
|
||||
println(System.out);
|
||||
} else {
|
||||
|
@ -1,7 +1,6 @@
|
||||
package org.warp.picalculator.deps;
|
||||
|
||||
import org.warp.picalculator.ClassUtils;
|
||||
import org.warp.picalculator.StaticVars;
|
||||
import org.warp.picalculator.gui.graphicengine.GraphicEngine;
|
||||
import org.warp.picalculator.gui.graphicengine.cpu.CPUEngine;
|
||||
import org.warp.picalculator.gui.graphicengine.framebuffer.FBEngine;
|
||||
|
@ -1,7 +1,6 @@
|
||||
package org.warp.picalculator.deps;
|
||||
|
||||
import org.warp.picalculator.ClassUtils;
|
||||
import org.warp.picalculator.ClassUtils.Var;
|
||||
|
||||
public class DGpio {
|
||||
|
||||
|
@ -2,9 +2,6 @@ package org.warp.picalculator.deps;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
|
||||
import org.warp.picalculator.ClassUtils;
|
||||
import org.warp.picalculator.ClassUtils.Var;
|
||||
|
||||
public class DJDTCompiler {
|
||||
|
||||
public static boolean compile(String[] strings, PrintWriter printWriter, PrintWriter printWriter2) {
|
||||
|
@ -1,7 +1,5 @@
|
||||
package org.warp.picalculator.deps;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Queue;
|
||||
import java.util.concurrent.Semaphore;
|
||||
|
||||
public class DSemaphore extends Semaphore {
|
||||
|
@ -3,7 +3,6 @@ package org.warp.picalculator.deps;
|
||||
import java.net.URL;
|
||||
import java.net.URLClassLoader;
|
||||
import java.net.URLStreamHandlerFactory;
|
||||
import java.security.AccessControlContext;
|
||||
|
||||
public class DURLClassLoader extends URLClassLoader {
|
||||
|
||||
|
@ -2,7 +2,6 @@ package org.warp.picalculator.deps;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
@ -17,7 +16,6 @@ import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.nio.file.StandardOpenOption;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@ -27,7 +25,6 @@ import java.util.stream.Stream;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.warp.picalculator.ClassUtils;
|
||||
import org.warp.picalculator.boot.Main;
|
||||
|
||||
public class StorageUtils {
|
||||
public static final boolean exists(Path f) {
|
||||
|
@ -1,8 +1,5 @@
|
||||
package org.warp.picalculator.deps.jogamp;
|
||||
|
||||
import org.warp.picalculator.ClassUtils;
|
||||
import org.warp.picalculator.ClassUtils.Var;
|
||||
|
||||
public class DJogamp {
|
||||
|
||||
//
|
||||
|
@ -2,11 +2,8 @@ package org.warp.picalculator.deps.nio;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import org.warp.picalculator.math.Function;
|
||||
|
||||
public class DFiles {
|
||||
|
||||
public static boolean deleteIfExists(DPath path) throws IOException {
|
||||
|
@ -23,7 +23,10 @@
|
||||
*/
|
||||
package cz.adamh.utils;
|
||||
|
||||
import java.io.*;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.nio.file.FileSystemNotFoundException;
|
||||
import java.nio.file.FileSystems;
|
||||
import java.nio.file.Files;
|
||||
|
@ -576,6 +576,7 @@ public class BigIntegerPoly implements Cloneable {
|
||||
*/
|
||||
final int l = ldegree();
|
||||
if (a.elementAt(l).compareTo(BigInteger.ZERO) != 0) {
|
||||
@SuppressWarnings("deprecation")
|
||||
final Vector<BigInteger> cand = BigIntegerMath.divisors(a.elementAt(l).abs());
|
||||
|
||||
/* check the divisors (both signs) */
|
||||
@ -615,8 +616,10 @@ public class BigIntegerPoly implements Cloneable {
|
||||
}
|
||||
|
||||
final BigInteger bsco = a.firstElement().abs();
|
||||
@SuppressWarnings("deprecation")
|
||||
final Vector<BigInteger> b = BigIntegerMath.divisors(bsco);
|
||||
final BigInteger csco = a.lastElement().abs();
|
||||
@SuppressWarnings("deprecation")
|
||||
final Vector<BigInteger> c = BigIntegerMath.divisors(csco);
|
||||
|
||||
/*
|
||||
|
@ -3,8 +3,6 @@ package org.warp.picalculator;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.Callable;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public class CacheUtils {
|
||||
|
@ -2,9 +2,7 @@ package org.warp.picalculator;
|
||||
|
||||
import java.lang.reflect.Array;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class ClassUtils {
|
||||
|
||||
|
@ -3,8 +3,8 @@ package org.warp.picalculator;
|
||||
import java.util.function.Function;
|
||||
|
||||
import org.warp.picalculator.boot.StartupArguments;
|
||||
import org.warp.picalculator.flow.Observable;
|
||||
import org.warp.picalculator.flow.BehaviorSubject;
|
||||
import org.warp.picalculator.flow.Observable;
|
||||
|
||||
public class StaticVars {
|
||||
public static final boolean enableVBO = true;
|
||||
|
@ -5,7 +5,6 @@ import java.io.IOException;
|
||||
import org.warp.picalculator.deps.DEngine;
|
||||
import org.warp.picalculator.deps.DSystem;
|
||||
import org.warp.picalculator.device.Keyboard;
|
||||
import org.warp.picalculator.event.Key;
|
||||
import org.warp.picalculator.event.KeyPressedEvent;
|
||||
import org.warp.picalculator.event.KeyReleasedEvent;
|
||||
import org.warp.picalculator.event.KeyboardEventListener;
|
||||
|
@ -1,7 +1,5 @@
|
||||
package org.warp.picalculator;
|
||||
|
||||
import org.warp.picalculator.MmapByteBuffer;
|
||||
|
||||
public class TestJNI {
|
||||
public TestJNI() {
|
||||
|
||||
|
@ -1,12 +1,8 @@
|
||||
package org.warp.picalculator;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.lang.management.ManagementFactory;
|
||||
import java.lang.management.OperatingSystemMXBean;
|
||||
import java.lang.reflect.Method;
|
||||
@ -15,12 +11,8 @@ import java.math.BigDecimal;
|
||||
import java.math.BigInteger;
|
||||
import java.math.RoundingMode;
|
||||
import java.net.URISyntaxException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.nevec.rjm.BigDecimalMath;
|
||||
import org.nevec.rjm.Rational;
|
||||
@ -30,7 +22,6 @@ import org.warp.picalculator.deps.nio.DFiles;
|
||||
import org.warp.picalculator.deps.nio.DPath;
|
||||
import org.warp.picalculator.deps.nio.DPaths;
|
||||
import org.warp.picalculator.device.HardwareDevice;
|
||||
import org.warp.picalculator.gui.DisplayManager;
|
||||
import org.warp.picalculator.gui.graphicengine.BinaryFont;
|
||||
import org.warp.picalculator.math.Function;
|
||||
import org.warp.picalculator.math.FunctionOperator;
|
||||
|
@ -1,9 +1,9 @@
|
||||
package org.warp.picalculator.boot;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import org.warp.picalculator.ConsoleUtils;
|
||||
import org.warp.picalculator.PICalculator;
|
||||
import org.warp.picalculator.flow.TestFlow;
|
||||
|
||||
public class Main {
|
||||
public static void main(String[] args) throws Exception {
|
||||
|
@ -167,5 +167,4 @@ public class StartupArgumentsImpl implements StartupArguments {
|
||||
return "StartupArguments = {\n\t\"isRaspberryModeAllowed\": \"" + isRaspberryModeAllowed + "\",\n\tisZoomed\": \"" + isZoomed + "\",\n\tisHeadlessEngineForced\": \"" + isHeadlessEngineForced + "\",\n\tisHeadless8EngineForced\": \"" + isHeadless8EngineForced + "\",\n\tisHeadless256EngineForced\": \"" + isHeadless256EngineForced + "\",\n\tisHeadless24bitEngineForced\": \"" + isHeadless24bitEngineForced + "\",\n\tisCPUEngineForced\": \"" + isCPUEngineForced + "\",\n\tisGPUEngineForced\": \"" + isGPUEngineForced + "\",\n\tisFrameBufferEngineForced\": \"" + isFrameBufferEngineForced + "\",\n\tisNoGUIEngineForced\": \"" + isNoGUIEngineForced + "\",\n\tisHTMLEngineForced\": \"" + isHTMLEngineForced + "\",\n\tisMSDOSModeEnabled\": \"" + isMSDOSModeEnabled + "\",\n\tisVerboseLoggingEnabled\": \"" + isVerboseLoggingEnabled + "\",\n\tisDebugEnabled\": \"" + isDebugEnabled + "\",\n\tisUncached\": \"" + isUncached + "\"\n}";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -5,21 +5,19 @@ import java.awt.event.KeyEvent;
|
||||
import org.warp.picalculator.ConsoleUtils;
|
||||
import org.warp.picalculator.PlatformUtils;
|
||||
import org.warp.picalculator.StaticVars;
|
||||
import org.warp.picalculator.deps.DGpio;
|
||||
import org.warp.picalculator.deps.jogamp.DJogamp;
|
||||
import org.warp.picalculator.device.chip.ParallelToSerial;
|
||||
import org.warp.picalculator.device.chip.SerialToParallel;
|
||||
import org.warp.picalculator.event.Key;
|
||||
import org.warp.picalculator.event.KeyPressedEvent;
|
||||
import org.warp.picalculator.event.KeyReleasedEvent;
|
||||
import org.warp.picalculator.event.KeyboardEventListener;
|
||||
import org.warp.picalculator.gui.DisplayManager;
|
||||
import org.warp.picalculator.gui.GUIErrorMessage;
|
||||
import org.warp.picalculator.gui.screens.KeyboardDebugScreen;
|
||||
import org.warp.picalculator.gui.screens.MarioScreen;
|
||||
import org.warp.picalculator.gui.screens.Screen;
|
||||
|
||||
import org.warp.picalculator.deps.DGpio;
|
||||
import org.warp.picalculator.deps.jogamp.DJogamp;
|
||||
|
||||
public class Keyboard {
|
||||
public static volatile boolean alpha = false;
|
||||
public static volatile boolean shift = false;
|
||||
@ -756,14 +754,10 @@ public class Keyboard {
|
||||
final Key k = keyMap[row][col][shift ? 1 : alpha ? 2 : 0];
|
||||
if (k != null) {
|
||||
keyPressed(k);
|
||||
} else {
|
||||
if (false) {
|
||||
|
||||
} else {
|
||||
keyPressed(Key.NONE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void stopKeyboard() {
|
||||
if (StaticVars.debugOn == false) {
|
||||
@ -832,29 +826,26 @@ public class Keyboard {
|
||||
}
|
||||
switch (k) {
|
||||
case SHIFT:
|
||||
Keyboard.shift = !Keyboard.shift;
|
||||
PlatformUtils.shiftChanged(Keyboard.shift);
|
||||
if (Keyboard.alpha)
|
||||
PlatformUtils.alphaChanged(Keyboard.alpha = false);
|
||||
PlatformUtils.shiftChanged(Keyboard.shift = !Keyboard.shift);
|
||||
refresh = true;
|
||||
break;
|
||||
case ALPHA:
|
||||
Keyboard.alpha = !Keyboard.alpha;
|
||||
PlatformUtils.alphaChanged(Keyboard.alpha);
|
||||
if (Keyboard.shift)
|
||||
PlatformUtils.shiftChanged(Keyboard.shift = false);
|
||||
PlatformUtils.alphaChanged(Keyboard.alpha = !Keyboard.alpha);
|
||||
refresh = true;
|
||||
break;
|
||||
default:
|
||||
if (k != Key.NONE) {
|
||||
if (Keyboard.shift)
|
||||
PlatformUtils.shiftChanged(Keyboard.shift = false);
|
||||
if (Keyboard.alpha)
|
||||
PlatformUtils.alphaChanged(Keyboard.alpha = false);
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (StaticVars.debugOn == false) {
|
||||
if (k != Key.SHIFT && Keyboard.shift) {
|
||||
Keyboard.shift = false;
|
||||
PlatformUtils.shiftChanged(Keyboard.shift);
|
||||
refresh = true;
|
||||
} else if (k != Key.ALPHA && Keyboard.alpha) {
|
||||
Keyboard.alpha = false;
|
||||
PlatformUtils.alphaChanged(Keyboard.alpha);
|
||||
refresh = true;
|
||||
}
|
||||
}
|
||||
if (refresh) {
|
||||
refreshRequest = true;
|
||||
}
|
||||
|
@ -12,7 +12,6 @@ import java.util.logging.Logger;
|
||||
import javax.imageio.ImageIO;
|
||||
|
||||
import org.warp.picalculator.ClassUtils;
|
||||
import org.warp.picalculator.PICalculator;
|
||||
import org.warp.picalculator.Utils;
|
||||
import org.warp.picalculator.deps.DSystem;
|
||||
|
||||
|
@ -1,16 +1,5 @@
|
||||
package org.warp.picalculator.event;
|
||||
|
||||
public enum Key {
|
||||
POWEROFF, debug_DEG, debug_RAD, debug_GRA, SHIFT, ALPHA, NONE, HISTORY_BACK,
|
||||
HISTORY_FORWARD, SURD_MODE, DRG_CYCLE, STEP, SIMPLIFY, BRIGHTNESS_CYCLE,
|
||||
BRIGHTNESS_CYCLE_REVERSE, DOT, NUM0, NUM1, NUM2, NUM3, NUM4, NUM5,
|
||||
NUM6, NUM7, NUM8, NUM9, PARENTHESIS_OPEN, PARENTHESIS_CLOSE, PLUS,
|
||||
MINUS, PLUS_MINUS, MULTIPLY, DIVIDE, EQUAL, DELETE, RESET, LEFT,
|
||||
RIGHT, UP, DOWN, OK, debug1, debug2, debug3, debug4, debug5, SQRT,
|
||||
ROOT, POWER_OF_2, POWER_OF_x, SINE, COSINE, TANGENT, ARCSINE, ARCCOSINE,
|
||||
ARCTANGENT, PI, SETTINGS, F1, F2, F3, F4, BACK, ZOOM_MODE, LOGARITHM,
|
||||
EULER_NUMBER, LETTER_A, LETTER_B, LETTER_C, LETTER_D, LETTER_E, LETTER_F,
|
||||
LETTER_G, LETTER_H, LETTER_I, LETTER_J, LETTER_K, LETTER_L, LETTER_M,
|
||||
LETTER_N, LETTER_O, LETTER_P, LETTER_Q, LETTER_R, LETTER_S, LETTER_T,
|
||||
LETTER_U, LETTER_V, LETTER_W, LETTER_X, LETTER_Y, LETTER_Z,
|
||||
POWEROFF, debug_DEG, debug_RAD, debug_GRA, SHIFT, ALPHA, NONE, HISTORY_BACK, HISTORY_FORWARD, SURD_MODE, DRG_CYCLE, STEP, SIMPLIFY, BRIGHTNESS_CYCLE, BRIGHTNESS_CYCLE_REVERSE, DOT, NUM0, NUM1, NUM2, NUM3, NUM4, NUM5, NUM6, NUM7, NUM8, NUM9, PARENTHESIS_OPEN, PARENTHESIS_CLOSE, PLUS, MINUS, PLUS_MINUS, MULTIPLY, DIVIDE, EQUAL, DELETE, RESET, LEFT, RIGHT, UP, DOWN, OK, debug1, debug2, debug3, debug4, debug5, SQRT, ROOT, POWER_OF_2, POWER_OF_x, SINE, COSINE, TANGENT, ARCSINE, ARCCOSINE, ARCTANGENT, PI, SETTINGS, F1, F2, F3, F4, BACK, ZOOM_MODE, LOGARITHM, EULER_NUMBER, LETTER_A, LETTER_B, LETTER_C, LETTER_D, LETTER_E, LETTER_F, LETTER_G, LETTER_H, LETTER_I, LETTER_J, LETTER_K, LETTER_L, LETTER_M, LETTER_N, LETTER_O, LETTER_P, LETTER_Q, LETTER_R, LETTER_S, LETTER_T, LETTER_U, LETTER_V, LETTER_W, LETTER_X, LETTER_Y, LETTER_Z,
|
||||
}
|
@ -39,7 +39,9 @@ public class MarioGame {
|
||||
final double curY = player.getY();
|
||||
final double futureX = curX + deltaX;
|
||||
final double futureY = curY + deltaY;
|
||||
@SuppressWarnings("unused")
|
||||
final boolean forward = futureX >= curX;
|
||||
@SuppressWarnings("unused")
|
||||
final boolean up = futureY >= curY;
|
||||
player.move(dt, futureX - curX, futureY - curY);
|
||||
}
|
||||
@ -69,6 +71,7 @@ public class MarioGame {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private int nearest(double val, int a, int b) {
|
||||
final double aa = Math.abs(val - a);
|
||||
final double ab = Math.abs(val - b);
|
||||
|
@ -6,6 +6,7 @@ public class MarioWorld {
|
||||
private final int width;
|
||||
private final int height;
|
||||
private final byte[][] data;
|
||||
@SuppressWarnings("unused")
|
||||
private final MarioEvent[] events;
|
||||
private final MarioEntity[] entities;
|
||||
|
||||
|
@ -2,6 +2,7 @@ package org.warp.picalculator.extra.mario;
|
||||
|
||||
public class PlayerEntity extends MarioEntity {
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private final int life;
|
||||
public float walkAnimation = 0;
|
||||
public float jumptime = 0;
|
||||
|
@ -1,8 +1,5 @@
|
||||
package org.warp.picalculator.flow;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
public class BehaviorSubject<T> extends Subject<T> {
|
||||
|
||||
private T lastValue;
|
||||
|
@ -7,7 +7,8 @@ public interface Consumer<T> {
|
||||
/**
|
||||
* Performs this operation on the given argument.
|
||||
*
|
||||
* @param t the input argument
|
||||
* @param t
|
||||
* the input argument
|
||||
*/
|
||||
void accept(T t);
|
||||
|
||||
@ -18,13 +19,18 @@ public interface Consumer<T> {
|
||||
* composed operation. If performing this operation throws an exception,
|
||||
* the {@code after} operation will not be performed.
|
||||
*
|
||||
* @param after the operation to perform after this operation
|
||||
* @param after
|
||||
* the operation to perform after this operation
|
||||
* @return a composed {@code Consumer} that performs in sequence this
|
||||
* operation followed by the {@code after} operation
|
||||
* @throws NullPointerException if {@code after} is null
|
||||
* @throws NullPointerException
|
||||
* if {@code after} is null
|
||||
*/
|
||||
default Consumer<T> andThen(Consumer<? super T> after) {
|
||||
Objects.requireNonNull(after);
|
||||
return (T t) -> { accept(t); after.accept(t); };
|
||||
return (T t) -> {
|
||||
accept(t);
|
||||
after.accept(t);
|
||||
};
|
||||
}
|
||||
}
|
@ -2,7 +2,6 @@ package org.warp.picalculator.flow;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.function.Function;
|
||||
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
@ -14,21 +13,27 @@ public abstract class Observable<T> implements ObservableSource<T> {
|
||||
public Disposable subscribe() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Disposable subscribe(Action1<? super T> onNext) {
|
||||
return subscribe(createSubscriber(onNext));
|
||||
}
|
||||
|
||||
protected Observable<T>.DisposableOfSubscriber createDisposable(Subscriber<? super T> sub) {
|
||||
return new DisposableOfSubscriber(sub);
|
||||
}
|
||||
|
||||
public Disposable subscribe(Action1<? super T> onNext, Action1<Throwable> onError) {
|
||||
return subscribe(createSubscriber(onNext, onError));
|
||||
}
|
||||
|
||||
public Disposable subscribe(Action1<? super T> onNext, Action1<Throwable> onError, Action0 onCompleted) {
|
||||
return subscribe(createSubscriber(onNext, onError, onCompleted));
|
||||
}
|
||||
|
||||
public void subscribe(Observer<? super T> obs) {
|
||||
subscribe(createSubscriber(obs));
|
||||
}
|
||||
|
||||
public Disposable subscribe(Subscriber<? super T> sub) {
|
||||
subscribers.add(sub);
|
||||
return createDisposable(sub);
|
||||
@ -36,7 +41,9 @@ public abstract class Observable<T> implements ObservableSource<T> {
|
||||
|
||||
protected Subscriber<T> createSubscriber(Action1<? super T> onNext) {
|
||||
return new Subscriber<T>() {
|
||||
@Override public void onSubscribe(Subscription s) {}
|
||||
@Override
|
||||
public void onSubscribe(Subscription s) {}
|
||||
|
||||
public void onNext(T t) {
|
||||
onNext.call(t);
|
||||
}
|
||||
@ -45,10 +52,13 @@ public abstract class Observable<T> implements ObservableSource<T> {
|
||||
|
||||
protected Subscriber<T> createSubscriber(Action1<? super T> onNext, Action1<Throwable> onError) {
|
||||
return new Subscriber<T>() {
|
||||
@Override public void onSubscribe(Subscription s) {}
|
||||
@Override
|
||||
public void onSubscribe(Subscription s) {}
|
||||
|
||||
public void onNext(T t) {
|
||||
onNext.call(t);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable t) {
|
||||
onError.call(t);
|
||||
@ -58,14 +68,18 @@ public abstract class Observable<T> implements ObservableSource<T> {
|
||||
|
||||
protected Subscriber<T> createSubscriber(Action1<? super T> onNext, Action1<Throwable> onError, Action0 onCompl) {
|
||||
return new Subscriber<T>() {
|
||||
@Override public void onSubscribe(Subscription s) {}
|
||||
@Override
|
||||
public void onSubscribe(Subscription s) {}
|
||||
|
||||
public void onNext(T t) {
|
||||
onNext.call(t);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable t) {
|
||||
onError.call(t);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
onCompl.call();
|
||||
@ -75,14 +89,18 @@ public abstract class Observable<T> implements ObservableSource<T> {
|
||||
|
||||
protected Subscriber<T> createSubscriber(Observer<? super T> obs) {
|
||||
return new Subscriber<T>() {
|
||||
@Override public void onSubscribe(Subscription s) {}
|
||||
@Override
|
||||
public void onSubscribe(Subscription s) {}
|
||||
|
||||
public void onNext(T t) {
|
||||
obs.onNext(t);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable t) {
|
||||
obs.onError(t);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
obs.onComplete();
|
||||
|
@ -1,7 +1,5 @@
|
||||
package org.warp.picalculator.flow;
|
||||
|
||||
import java.util.function.Function;
|
||||
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
public class ObservableCombinedChanged<T, U> extends Observable<Pair<T, U>> {
|
||||
@ -10,14 +8,11 @@ public class ObservableCombinedChanged<T, U> extends Observable<Pair<T, U>> {
|
||||
private Observable<U> b;
|
||||
private Disposable disposableA;
|
||||
private Disposable disposableB;
|
||||
private Subject<Pair<T, U>> pairSubject;
|
||||
private Subject<T> mapSubject;
|
||||
|
||||
public ObservableCombinedChanged(Observable<T> a, Observable<U> b) {
|
||||
super();
|
||||
this.a = a;
|
||||
this.b = b;
|
||||
this.pairSubject = SimpleSubject.create();
|
||||
}
|
||||
|
||||
private void initialize() {
|
||||
|
@ -1,7 +1,5 @@
|
||||
package org.warp.picalculator.flow;
|
||||
|
||||
import java.util.function.Function;
|
||||
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
public class ObservableCombinedLatest<T, U> extends Observable<Pair<T, U>> {
|
||||
@ -14,14 +12,11 @@ public class ObservableCombinedLatest<T, U> extends Observable<Pair<T, U>> {
|
||||
private volatile U lastB;
|
||||
private volatile boolean didAOneTime;
|
||||
private volatile boolean didBOneTime;
|
||||
private Subject<Pair<T, U>> pairSubject;
|
||||
private Subject<T> mapSubject;
|
||||
|
||||
public ObservableCombinedLatest(Observable<T> a, Observable<U> b) {
|
||||
super();
|
||||
this.a = a;
|
||||
this.b = b;
|
||||
this.pairSubject = SimpleSubject.create();
|
||||
}
|
||||
|
||||
private void initialize() {
|
||||
|
@ -1,8 +1,5 @@
|
||||
package org.warp.picalculator.flow;
|
||||
|
||||
import java.util.function.Function;
|
||||
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
import org.warp.picalculator.PlatformUtils;
|
||||
|
||||
public class ObservableInterval extends Observable<Long> {
|
||||
|
@ -2,20 +2,16 @@ package org.warp.picalculator.flow;
|
||||
|
||||
import java.util.function.Function;
|
||||
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
public class ObservableMap<T, U> extends Observable<U> {
|
||||
private Observable<T> originalObservable;
|
||||
private Function<T, U> mapAction;
|
||||
private volatile boolean initialized = false;
|
||||
private Disposable mapDisposable;
|
||||
private Subject<T> mapSubject;
|
||||
|
||||
public ObservableMap(Observable<T> originalObservable, Function<T, U> mapAction) {
|
||||
super();
|
||||
this.originalObservable = originalObservable;
|
||||
this.mapAction = mapAction;
|
||||
this.mapSubject = SimpleSubject.create();
|
||||
}
|
||||
|
||||
private void initialize() {
|
||||
@ -47,6 +43,7 @@ public class ObservableMap<T, U> extends Observable<U> {
|
||||
chechInitialized();
|
||||
return disp;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisposed(Subscriber<? super U> sub) {
|
||||
super.onDisposed(sub);
|
||||
|
@ -1,22 +1,16 @@
|
||||
package org.warp.picalculator.flow;
|
||||
|
||||
import java.util.function.Function;
|
||||
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
public class ObservableMerged<T> extends Observable<T> {
|
||||
private Observable<T> originalObservableA;
|
||||
private Observable<T> originalObservableB;
|
||||
private volatile boolean initialized = false;
|
||||
private Disposable mapDisposableA;
|
||||
private Disposable mapDisposableB;
|
||||
private Subject<T> mapSubject;
|
||||
|
||||
public ObservableMerged(Observable<T> originalObservableA, Observable<T> originalObservableB) {
|
||||
super();
|
||||
this.originalObservableA = originalObservableA;
|
||||
this.originalObservableB = originalObservableB;
|
||||
this.mapSubject = SimpleSubject.create();
|
||||
}
|
||||
|
||||
private void initialize() {
|
||||
|
@ -1,7 +1,5 @@
|
||||
package org.warp.picalculator.flow;
|
||||
|
||||
import java.util.function.Function;
|
||||
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
public class ObservableZipped<T, U> extends Observable<Pair<T, U>> {
|
||||
@ -14,14 +12,11 @@ public class ObservableZipped<T, U> extends Observable<Pair<T, U>> {
|
||||
private volatile U lastB;
|
||||
private volatile boolean didA;
|
||||
private volatile boolean didB;
|
||||
private Subject<Pair<T, U>> pairSubject;
|
||||
private Subject<T> mapSubject;
|
||||
|
||||
public ObservableZipped(Observable<T> a, Observable<U> b) {
|
||||
super();
|
||||
this.a = a;
|
||||
this.b = b;
|
||||
this.pairSubject = SimpleSubject.create();
|
||||
}
|
||||
|
||||
private void initialize() {
|
||||
|
@ -2,7 +2,10 @@ package org.warp.picalculator.flow;
|
||||
|
||||
public interface Observer<T> {
|
||||
public void onComplete();
|
||||
|
||||
public void onError(Throwable e);
|
||||
|
||||
public void onNext(T t);
|
||||
|
||||
public void onSubscribe(Disposable d);
|
||||
}
|
||||
|
@ -1,14 +1,8 @@
|
||||
package org.warp.picalculator.flow;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
public class SimpleSubject<T> extends Subject<T> {
|
||||
|
||||
protected SimpleSubject() {
|
||||
}
|
||||
protected SimpleSubject() {}
|
||||
|
||||
public final static <T> SimpleSubject<T> create() {
|
||||
return new SimpleSubject<>();
|
||||
@ -66,7 +60,6 @@ public class SimpleSubject<T> extends Subject<T> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
}
|
||||
public void onSubscribe(Disposable d) {}
|
||||
|
||||
}
|
||||
|
@ -2,9 +2,13 @@ package org.warp.picalculator.flow;
|
||||
|
||||
public abstract class Subject<T> extends Observable<T> implements Observer<T> {
|
||||
abstract Throwable getThrowable();
|
||||
|
||||
abstract boolean hasComplete();
|
||||
|
||||
abstract boolean hasObservers();
|
||||
|
||||
abstract boolean hasThrowable();
|
||||
|
||||
abstract Subject<T> toSerialized();
|
||||
|
||||
@Override
|
||||
|
@ -2,7 +2,10 @@ package org.warp.picalculator.flow;
|
||||
|
||||
public interface Subscriber<T> {
|
||||
default void onComplete() {}
|
||||
|
||||
default void onError(Throwable t) {}
|
||||
|
||||
void onNext(T t);
|
||||
|
||||
void onSubscribe(Subscription s);
|
||||
}
|
||||
|
@ -2,5 +2,6 @@ package org.warp.picalculator.flow;
|
||||
|
||||
public interface Subscription {
|
||||
void cancel();
|
||||
|
||||
void request(long n);
|
||||
}
|
||||
|
@ -22,7 +22,6 @@ public class TestFlow {
|
||||
subject0.onNext(60f);
|
||||
subject0.onNext(7f);
|
||||
|
||||
|
||||
subject0.onComplete();
|
||||
System.out.println("items sent.");
|
||||
|
||||
@ -128,8 +127,6 @@ public class TestFlow {
|
||||
subjectF.onComplete();
|
||||
System.out.println("items sent.");
|
||||
|
||||
|
||||
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
|
@ -33,7 +33,6 @@ public class CalculatorHUD extends HUD {
|
||||
public void renderTopmostBackground() {
|
||||
final Renderer renderer = d.renderer;
|
||||
final GraphicEngine engine = d.engine;
|
||||
final Skin guiSkin = d.guiSkin;
|
||||
|
||||
renderer.glColor(0xFFc5c2af);
|
||||
renderer.glFillColor(0, 0, engine.getWidth(), 20);
|
||||
|
@ -3,26 +3,15 @@ package org.warp.picalculator.gui;
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.Semaphore;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
import org.warp.picalculator.ConsoleUtils;
|
||||
import org.warp.picalculator.PlatformUtils;
|
||||
import org.warp.picalculator.StaticVars;
|
||||
import org.warp.picalculator.Utils;
|
||||
import org.warp.picalculator.deps.DEngine;
|
||||
import org.warp.picalculator.deps.DSemaphore;
|
||||
import org.warp.picalculator.deps.DSystem;
|
||||
import org.warp.picalculator.device.HardwareDevice;
|
||||
import org.warp.picalculator.device.Keyboard;
|
||||
import org.warp.picalculator.event.KeyReleasedEvent;
|
||||
import org.warp.picalculator.event.TouchCancelEvent;
|
||||
import org.warp.picalculator.event.TouchEndEvent;
|
||||
import org.warp.picalculator.event.TouchEvent;
|
||||
import org.warp.picalculator.event.TouchEventListener;
|
||||
import org.warp.picalculator.event.TouchMoveEvent;
|
||||
import org.warp.picalculator.event.TouchStartEvent;
|
||||
import org.warp.picalculator.flow.Observable;
|
||||
import org.warp.picalculator.gui.graphicengine.BinaryFont;
|
||||
import org.warp.picalculator.gui.graphicengine.GraphicEngine;
|
||||
@ -32,13 +21,11 @@ import org.warp.picalculator.gui.graphicengine.Skin;
|
||||
import org.warp.picalculator.gui.graphicengine.nogui.NoGuiEngine;
|
||||
import org.warp.picalculator.gui.screens.Screen;
|
||||
|
||||
import it.unimi.dsi.fastutil.longs.Long2ObjectMap.Entry;
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
|
||||
public final class DisplayManager implements RenderingLoop {
|
||||
private static final int tickDuration = 50;
|
||||
|
||||
private HardwareDevice device;
|
||||
private float brightness;
|
||||
|
||||
public final GraphicEngine engine;
|
||||
|
@ -3,7 +3,6 @@ package org.warp.picalculator.gui.expression.blocks;
|
||||
import org.warp.picalculator.Error;
|
||||
import org.warp.picalculator.Errors;
|
||||
import org.warp.picalculator.PlatformUtils;
|
||||
import org.warp.picalculator.StaticVars;
|
||||
import org.warp.picalculator.gui.GraphicalElement;
|
||||
import org.warp.picalculator.gui.expression.Caret;
|
||||
import org.warp.picalculator.gui.expression.CaretState;
|
||||
|
@ -23,6 +23,7 @@ public class BlockLogarithm extends Block {
|
||||
private int bl;
|
||||
private int chw;
|
||||
private int chh;
|
||||
@SuppressWarnings("unused")
|
||||
private int schh;
|
||||
private int nmbh;
|
||||
private int toph;
|
||||
|
@ -2,10 +2,8 @@ package org.warp.picalculator.gui.expression.blocks;
|
||||
|
||||
import org.warp.picalculator.Error;
|
||||
import org.warp.picalculator.device.HardwareDevice;
|
||||
import org.warp.picalculator.event.Key;
|
||||
import org.warp.picalculator.event.KeyPressedEvent;
|
||||
import org.warp.picalculator.event.KeyReleasedEvent;
|
||||
import org.warp.picalculator.gui.DisplayManager;
|
||||
import org.warp.picalculator.gui.expression.Caret;
|
||||
import org.warp.picalculator.gui.expression.ExtraMenu;
|
||||
import org.warp.picalculator.gui.expression.InputContext;
|
||||
|
@ -5,12 +5,12 @@ import org.warp.picalculator.gui.expression.blocks.Block;
|
||||
import org.warp.picalculator.gui.expression.blocks.BlockChar;
|
||||
import org.warp.picalculator.gui.expression.blocks.BlockContainer;
|
||||
import org.warp.picalculator.gui.expression.blocks.BlockDivision;
|
||||
import org.warp.picalculator.gui.expression.blocks.BlockLogarithm;
|
||||
import org.warp.picalculator.gui.expression.blocks.BlockNumericChar;
|
||||
import org.warp.picalculator.gui.expression.blocks.BlockParenthesis;
|
||||
import org.warp.picalculator.gui.expression.blocks.BlockPower;
|
||||
import org.warp.picalculator.gui.expression.blocks.BlockReference;
|
||||
import org.warp.picalculator.gui.expression.blocks.BlockSine;
|
||||
import org.warp.picalculator.gui.expression.blocks.BlockLogarithm;
|
||||
import org.warp.picalculator.gui.expression.blocks.BlockSquareRoot;
|
||||
import org.warp.picalculator.gui.expression.blocks.BlockVariable;
|
||||
import org.warp.picalculator.math.MathematicalSymbols;
|
||||
@ -97,7 +97,7 @@ public class NormalInputContainer extends InputContainer {
|
||||
case MathematicalSymbols.DIVISION:
|
||||
@SuppressWarnings("unchecked")
|
||||
final BlockReference<BlockDivision> ref = (BlockReference<BlockDivision>) getSelectedBlock();
|
||||
final BlockContainer parentContainer = ref.getContainer();
|
||||
@SuppressWarnings("unused") final BlockContainer parentContainer = ref.getContainer();
|
||||
BlockReference<?> currentBlock = ref;
|
||||
boolean groupedBefore = false;
|
||||
int before = 0;
|
||||
|
@ -9,7 +9,6 @@ import org.warp.picalculator.StaticVars;
|
||||
import org.warp.picalculator.Utils;
|
||||
import org.warp.picalculator.device.HardwareDevice;
|
||||
import org.warp.picalculator.flow.Observable;
|
||||
import org.warp.picalculator.gui.DisplayManager;
|
||||
import org.warp.picalculator.gui.graphicengine.BinaryFont;
|
||||
import org.warp.picalculator.gui.graphicengine.GraphicEngine;
|
||||
import org.warp.picalculator.gui.graphicengine.RenderingLoop;
|
||||
|
@ -6,7 +6,6 @@ import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.URISyntaxException;
|
||||
import java.net.URL;
|
||||
import java.util.LinkedList;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
@ -34,6 +33,7 @@ public class CPUFont implements BinaryFont {
|
||||
public int[] intervals;
|
||||
public int intervalsTotalSize = 0;
|
||||
public static final int intBits = 31;
|
||||
@SuppressWarnings("unused")
|
||||
private final boolean isResource;
|
||||
|
||||
public CPUFont(String fontName) throws IOException {
|
||||
@ -186,6 +186,7 @@ public class CPUFont implements BinaryFont {
|
||||
int beginIndex = -1;
|
||||
int endIndex = 0;
|
||||
int intervalSize = 0;
|
||||
@SuppressWarnings("unused")
|
||||
final int holeSize = 0;
|
||||
for (int i = 0; i < rawchars.length; i++) {
|
||||
if (rawchars[i] != null) {
|
||||
@ -273,6 +274,7 @@ public class CPUFont implements BinaryFont {
|
||||
return compressedIndex;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private int decompressIndex(int compressedIndex) {
|
||||
final int originalIndex = 0;
|
||||
int i = 0;
|
||||
|
@ -3,17 +3,11 @@ package org.warp.picalculator.gui.graphicengine.cpu;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.URISyntaxException;
|
||||
import java.nio.file.Files;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
|
||||
import org.warp.picalculator.deps.DSystem;
|
||||
import org.warp.picalculator.deps.StorageUtils;
|
||||
import org.warp.picalculator.deps.nio.DFiles;
|
||||
import org.warp.picalculator.deps.nio.DPath;
|
||||
import org.warp.picalculator.deps.nio.DPaths;
|
||||
import org.warp.picalculator.gui.graphicengine.GraphicEngine;
|
||||
import org.warp.picalculator.gui.graphicengine.Skin;
|
||||
|
||||
@ -24,6 +18,7 @@ public class CPUSkin implements Skin {
|
||||
|
||||
public int[] skinData;
|
||||
public int[] skinSize;
|
||||
@SuppressWarnings("unused")
|
||||
private final boolean isResource;
|
||||
|
||||
public CPUSkin(String file) throws IOException {
|
||||
|
@ -20,7 +20,6 @@ import javax.swing.JFrame;
|
||||
import javax.swing.JPanel;
|
||||
|
||||
import org.warp.picalculator.ConsoleUtils;
|
||||
import org.warp.picalculator.PlatformUtils;
|
||||
import org.warp.picalculator.StaticVars;
|
||||
import org.warp.picalculator.Utils;
|
||||
import org.warp.picalculator.device.HardwareDevice;
|
||||
@ -31,7 +30,6 @@ import org.warp.picalculator.event.TouchPoint;
|
||||
import org.warp.picalculator.event.TouchStartEvent;
|
||||
import org.warp.picalculator.flow.BehaviorSubject;
|
||||
import org.warp.picalculator.flow.Observable;
|
||||
import org.warp.picalculator.gui.DisplayManager;
|
||||
import org.warp.picalculator.gui.graphicengine.RenderingLoop;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
@ -184,7 +182,6 @@ public class SwingWindow extends JFrame {
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public Observable<Integer[]> onResize() {
|
||||
return onResize$;
|
||||
}
|
||||
|
@ -9,7 +9,6 @@ import java.util.concurrent.Semaphore;
|
||||
import org.warp.picalculator.MmapByteBuffer;
|
||||
import org.warp.picalculator.StaticVars;
|
||||
import org.warp.picalculator.TestJNI;
|
||||
import org.warp.picalculator.Utils;
|
||||
import org.warp.picalculator.flow.BehaviorSubject;
|
||||
import org.warp.picalculator.flow.Observable;
|
||||
import org.warp.picalculator.gui.graphicengine.BinaryFont;
|
||||
@ -22,8 +21,11 @@ import org.warp.picalculator.gui.graphicengine.cpu.CPUSkin;
|
||||
|
||||
public class FBEngine implements GraphicEngine {
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private static final int FB_DISPLAY_WIDTH = 320;
|
||||
@SuppressWarnings("unused")
|
||||
private static final int FB_DISPLAY_HEIGHT = 480;
|
||||
@SuppressWarnings("unused")
|
||||
private static final int FB_DISPLAY_BPP = 32;
|
||||
private static final int WIDTH = 480;
|
||||
private static final int HEIGHT = 320;
|
||||
|
@ -6,7 +6,6 @@ import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
|
||||
import org.warp.picalculator.PlatformUtils;
|
||||
import org.warp.picalculator.Utils;
|
||||
import org.warp.picalculator.gui.graphicengine.BinaryFont;
|
||||
import org.warp.picalculator.gui.graphicengine.GraphicEngine;
|
||||
import org.warp.picalculator.gui.graphicengine.cpu.CPUFont;
|
||||
@ -102,6 +101,7 @@ public class GPUFont implements BinaryFont {
|
||||
return compressedIndex;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private int decompressIndex(int compressedIndex) {
|
||||
final int originalIndex = 0;
|
||||
int i = 0;
|
||||
|
@ -7,11 +7,11 @@ import java.io.IOException;
|
||||
import java.nio.Buffer;
|
||||
import java.nio.FloatBuffer;
|
||||
import java.nio.file.Files;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
|
||||
import org.warp.picalculator.PlatformUtils;
|
||||
import org.warp.picalculator.StaticVars;
|
||||
import org.warp.picalculator.Utils;
|
||||
import org.warp.picalculator.gui.graphicengine.BinaryFont;
|
||||
import org.warp.picalculator.gui.graphicengine.Renderer;
|
||||
|
||||
|
@ -8,7 +8,6 @@ import org.warp.picalculator.gui.graphicengine.GraphicEngine;
|
||||
import org.warp.picalculator.gui.graphicengine.Skin;
|
||||
import org.warp.picalculator.gui.graphicengine.gpu.GPURenderer.OpenedTextureData;
|
||||
|
||||
import com.jogamp.opengl.GL2ES1;
|
||||
import com.jogamp.opengl.GLException;
|
||||
import com.jogamp.opengl.util.texture.Texture;
|
||||
|
||||
@ -40,7 +39,6 @@ public class GPUSkin implements Skin {
|
||||
public void initialize(GraphicEngine d) {
|
||||
try {
|
||||
final OpenedTextureData i = GPURenderer.openTexture(texturePath, isResource);
|
||||
final GL2ES1 gl = GPURenderer.gl;
|
||||
t = GPURenderer.importTexture(i.f, i.deleteOnExit);
|
||||
w = i.w;
|
||||
h = i.h;
|
||||
|
@ -108,7 +108,9 @@ class NEWTWindow implements GLEventListener {
|
||||
onResizeEvent.onNext(new Integer[] { disp.size[0], disp.size[1] });
|
||||
refreshViewport = true;
|
||||
});
|
||||
StaticVars.windowZoom$.subscribe((zoom) -> {onZoom.onNext(zoom);});
|
||||
StaticVars.windowZoom$.subscribe((zoom) -> {
|
||||
onZoom.onNext(zoom);
|
||||
});
|
||||
onZoom.subscribe((z) -> {
|
||||
if (windowZoom != 0) {
|
||||
windowZoom = z;
|
||||
@ -372,6 +374,7 @@ class NEWTWindow implements GLEventListener {
|
||||
public void mousePressed(MouseEvent e) {
|
||||
List<TouchPoint> newPoints = new ObjectArrayList<>();
|
||||
List<TouchPoint> changedPoints = new ObjectArrayList<>();
|
||||
@SuppressWarnings("unused")
|
||||
List<TouchPoint> oldPoints = touches;
|
||||
int[] xs = e.getAllX();
|
||||
int[] ys = e.getAllY();
|
||||
@ -389,6 +392,7 @@ class NEWTWindow implements GLEventListener {
|
||||
public void mouseReleased(MouseEvent e) {
|
||||
List<TouchPoint> newPoints = new ObjectArrayList<>();
|
||||
List<TouchPoint> changedPoints = new ObjectArrayList<>();
|
||||
@SuppressWarnings("unused")
|
||||
List<TouchPoint> oldPoints = touches;
|
||||
int[] xs = e.getAllX();
|
||||
int[] ys = e.getAllY();
|
||||
|
@ -54,6 +54,7 @@ public class Headless24bitEngine implements org.warp.picalculator.gui.graphiceng
|
||||
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private long outHandle;
|
||||
|
||||
@Override
|
||||
|
@ -1,7 +1,6 @@
|
||||
package org.warp.picalculator.gui.graphicengine.headless8;
|
||||
|
||||
import org.warp.picalculator.StaticVars;
|
||||
import org.warp.picalculator.Utils;
|
||||
import org.warp.picalculator.gui.graphicengine.Renderer;
|
||||
|
||||
public class Headless8Renderer implements Renderer {
|
||||
|
@ -1,9 +1,7 @@
|
||||
package org.warp.picalculator.gui.graphicengine.nogui;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.concurrent.Semaphore;
|
||||
|
||||
import org.warp.picalculator.Utils;
|
||||
import org.warp.picalculator.deps.DSemaphore;
|
||||
import org.warp.picalculator.flow.Observable;
|
||||
import org.warp.picalculator.gui.graphicengine.BinaryFont;
|
||||
|
@ -3,9 +3,7 @@ package org.warp.picalculator.gui.screens;
|
||||
import org.warp.picalculator.StaticVars;
|
||||
import org.warp.picalculator.Utils;
|
||||
import org.warp.picalculator.device.HardwareDevice;
|
||||
import org.warp.picalculator.event.Key;
|
||||
import org.warp.picalculator.event.KeyPressedEvent;
|
||||
import org.warp.picalculator.gui.DisplayManager;
|
||||
import org.warp.picalculator.math.Function;
|
||||
import org.warp.picalculator.math.functions.Variable.VariableValue;
|
||||
|
||||
|
@ -1,7 +1,5 @@
|
||||
package org.warp.picalculator.gui.screens;
|
||||
|
||||
import org.warp.picalculator.event.Key;
|
||||
|
||||
public class EmptyScreen extends Screen {
|
||||
|
||||
public float endLoading;
|
||||
|
@ -2,10 +2,8 @@ package org.warp.picalculator.gui.screens;
|
||||
|
||||
import org.warp.picalculator.StaticVars;
|
||||
import org.warp.picalculator.device.HardwareDevice;
|
||||
import org.warp.picalculator.event.Key;
|
||||
import org.warp.picalculator.event.KeyPressedEvent;
|
||||
import org.warp.picalculator.event.KeyReleasedEvent;
|
||||
import org.warp.picalculator.gui.DisplayManager;
|
||||
import org.warp.picalculator.gui.graphicengine.Renderer;
|
||||
|
||||
public class KeyboardDebugScreen extends Screen {
|
||||
|
@ -2,8 +2,6 @@ package org.warp.picalculator.gui.screens;
|
||||
|
||||
import org.warp.picalculator.StaticVars;
|
||||
import org.warp.picalculator.device.HardwareDevice;
|
||||
import org.warp.picalculator.event.Key;
|
||||
import org.warp.picalculator.gui.DisplayManager;
|
||||
import org.warp.picalculator.gui.GraphicUtils;
|
||||
|
||||
public class LoadingScreen extends Screen {
|
||||
|
@ -5,10 +5,8 @@ import java.io.IOException;
|
||||
import org.warp.picalculator.StaticVars;
|
||||
import org.warp.picalculator.device.HardwareDevice;
|
||||
import org.warp.picalculator.device.Keyboard;
|
||||
import org.warp.picalculator.event.Key;
|
||||
import org.warp.picalculator.extra.mario.MarioGame;
|
||||
import org.warp.picalculator.extra.mario.MarioWorld;
|
||||
import org.warp.picalculator.gui.DisplayManager;
|
||||
import org.warp.picalculator.gui.graphicengine.BinaryFont;
|
||||
import org.warp.picalculator.gui.graphicengine.Skin;
|
||||
|
||||
|
@ -1,8 +1,6 @@
|
||||
package org.warp.picalculator.gui.screens;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringWriter;
|
||||
|
||||
import org.warp.picalculator.ConsoleUtils;
|
||||
import org.warp.picalculator.Error;
|
||||
@ -16,7 +14,6 @@ import org.warp.picalculator.device.Keyboard;
|
||||
import org.warp.picalculator.event.Key;
|
||||
import org.warp.picalculator.event.KeyPressedEvent;
|
||||
import org.warp.picalculator.event.KeyReleasedEvent;
|
||||
import org.warp.picalculator.gui.DisplayManager;
|
||||
import org.warp.picalculator.gui.expression.InputContext;
|
||||
import org.warp.picalculator.gui.expression.blocks.Block;
|
||||
import org.warp.picalculator.gui.expression.blocks.BlockContainer;
|
||||
@ -58,6 +55,7 @@ public class MathInputScreen extends Screen {
|
||||
private double computingElapsedTime = 0;
|
||||
private boolean computingBreakTipVisible = false;
|
||||
boolean mustRefresh = true;
|
||||
@SuppressWarnings("unused")
|
||||
private int currentStep = 0;
|
||||
|
||||
public MathInputScreen() {
|
||||
|
@ -1,7 +1,5 @@
|
||||
package org.warp.picalculator.gui.screens;
|
||||
|
||||
import org.warp.picalculator.event.KeyPressedEvent;
|
||||
import org.warp.picalculator.event.KeyReleasedEvent;
|
||||
import org.warp.picalculator.event.KeyboardEventListener;
|
||||
import org.warp.picalculator.event.TouchEventListener;
|
||||
import org.warp.picalculator.gui.DisplayManager;
|
||||
|
@ -2,9 +2,7 @@ package org.warp.picalculator.gui.screens;
|
||||
|
||||
import org.warp.picalculator.StaticVars;
|
||||
import org.warp.picalculator.device.HardwareDevice;
|
||||
import org.warp.picalculator.event.Key;
|
||||
import org.warp.picalculator.event.KeyPressedEvent;
|
||||
import org.warp.picalculator.gui.DisplayManager;
|
||||
|
||||
public class SolveForXScreen extends Screen {
|
||||
|
||||
|
@ -7,6 +7,7 @@ import org.warp.picalculator.gui.expression.blocks.BlockDivision;
|
||||
import org.warp.picalculator.math.Function;
|
||||
import org.warp.picalculator.math.FunctionOperator;
|
||||
import org.warp.picalculator.math.MathContext;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
|
||||
public class Division extends FunctionOperator {
|
||||
|
@ -8,6 +8,7 @@ import org.warp.picalculator.math.Function;
|
||||
import org.warp.picalculator.math.FunctionOperator;
|
||||
import org.warp.picalculator.math.MathContext;
|
||||
import org.warp.picalculator.math.MathematicalSymbols;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
|
||||
public class Multiplication extends FunctionOperator {
|
||||
|
@ -3,6 +3,7 @@ package org.warp.picalculator.math.functions;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.BigInteger;
|
||||
import java.util.LinkedList;
|
||||
|
||||
import org.nevec.rjm.BigDecimalMath;
|
||||
import org.warp.picalculator.Error;
|
||||
import org.warp.picalculator.Utils;
|
||||
|
@ -7,6 +7,7 @@ import org.warp.picalculator.math.Function;
|
||||
import org.warp.picalculator.math.FunctionOperator;
|
||||
import org.warp.picalculator.math.MathContext;
|
||||
import org.warp.picalculator.math.MathematicalSymbols;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
|
||||
public class Sum extends FunctionOperator {
|
||||
|
@ -5,6 +5,7 @@ import org.warp.picalculator.gui.expression.blocks.Block;
|
||||
import org.warp.picalculator.math.Function;
|
||||
import org.warp.picalculator.math.FunctionDynamic;
|
||||
import org.warp.picalculator.math.MathContext;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
|
||||
public class EquationsSystem extends FunctionDynamic {
|
||||
|
@ -7,6 +7,7 @@ import org.warp.picalculator.gui.expression.blocks.BlockSine;
|
||||
import org.warp.picalculator.math.Function;
|
||||
import org.warp.picalculator.math.FunctionSingle;
|
||||
import org.warp.picalculator.math.MathContext;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
|
||||
public class Sine extends FunctionSingle {
|
||||
|
@ -10,6 +10,7 @@ import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
|
||||
public class RemoveParentheses implements MathParserStep {
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private final MathContext context;
|
||||
|
||||
public RemoveParentheses(MathContext context) {
|
||||
|
@ -4,7 +4,6 @@ import org.warp.picalculator.Error;
|
||||
import org.warp.picalculator.math.Function;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
import jdk.nashorn.internal.objects.annotations.SpecializedFunction;
|
||||
|
||||
/**
|
||||
* Rule interface
|
||||
@ -27,7 +26,6 @@ public interface Rule {
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@SpecializedFunction
|
||||
public RuleType getRuleType();
|
||||
|
||||
/**
|
||||
|
@ -8,26 +8,19 @@ import java.io.InputStream;
|
||||
import java.io.PrintWriter;
|
||||
import java.net.URISyntaxException;
|
||||
import java.net.URL;
|
||||
import java.net.URLClassLoader;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.StandardOpenOption;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.warp.picalculator.ConsoleUtils;
|
||||
import org.warp.picalculator.Error;
|
||||
import org.warp.picalculator.PlatformUtils;
|
||||
import org.warp.picalculator.StaticVars;
|
||||
import org.warp.picalculator.Utils;
|
||||
import org.warp.picalculator.ZipUtils;
|
||||
import org.warp.picalculator.deps.StorageUtils;
|
||||
import org.warp.picalculator.deps.DJDTCompiler;
|
||||
import org.warp.picalculator.deps.DStandardOpenOption;
|
||||
import org.warp.picalculator.deps.DSystem;
|
||||
import org.warp.picalculator.deps.DURLClassLoader;
|
||||
import org.warp.picalculator.deps.StorageUtils;
|
||||
import org.warp.picalculator.math.Function;
|
||||
import org.warp.picalculator.math.MathContext;
|
||||
import org.warp.picalculator.math.functions.Expression;
|
||||
@ -43,7 +36,7 @@ public class RulesManager {
|
||||
|
||||
private RulesManager() {}
|
||||
|
||||
@SuppressWarnings({ "unchecked", "unused" })
|
||||
@SuppressWarnings({ "unchecked" })
|
||||
public static void initialize() {
|
||||
ConsoleUtils.out.println(ConsoleUtils.OUTPUTLEVEL_NODEBUG, "RulesManager", "Loading the rules");
|
||||
rules = new ObjectArrayList[RuleType.values().length];
|
||||
|
@ -4,6 +4,7 @@ import org.warp.picalculator.Error;
|
||||
import org.warp.picalculator.math.Function;
|
||||
import org.warp.picalculator.math.MathContext;
|
||||
import org.warp.picalculator.math.functions.Multiplication;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
|
||||
/**
|
||||
|
@ -1,7 +1,6 @@
|
||||
package org.warp.picalculator.math.solver;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import org.warp.picalculator.ConsoleUtils;
|
||||
import org.warp.picalculator.Error;
|
||||
@ -12,7 +11,6 @@ import org.warp.picalculator.math.rules.Rule;
|
||||
import org.warp.picalculator.math.rules.RuleType;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
import sun.reflect.generics.reflectiveObjects.NotImplementedException;
|
||||
|
||||
public class MathSolver {
|
||||
|
||||
@ -114,6 +112,7 @@ public class MathSolver {
|
||||
return false;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private ObjectArrayList<Function> solveStep(ObjectArrayList<Function> fncs) throws InterruptedException, Error {
|
||||
return solveStep(fncs, stepState);
|
||||
}
|
||||
@ -143,8 +142,7 @@ public class MathSolver {
|
||||
break;
|
||||
}
|
||||
default:
|
||||
System.err.println("Unknown Step State");
|
||||
throw new NotImplementedException();
|
||||
throw new RuntimeException("Unknown Step State");
|
||||
}
|
||||
final ObjectArrayList<Function> results = applyRules(fncs, currentAcceptedRules);
|
||||
switch (stepStates[stepState.get()]) {
|
||||
@ -203,8 +201,7 @@ public class MathSolver {
|
||||
break;
|
||||
}
|
||||
default:
|
||||
System.err.println("Unknown Step State");
|
||||
throw new NotImplementedException();
|
||||
throw new RuntimeException("Unknown Step State");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@ -214,7 +211,6 @@ public class MathSolver {
|
||||
final ObjectArrayList<Rule> rules = initialFunction.getMathContext().getAcceptableRules(currentAcceptedRules);
|
||||
ObjectArrayList<Function> results = null;
|
||||
ObjectArrayList<Rule> appliedRules = new ObjectArrayList<>();
|
||||
out: {
|
||||
for (final Function fnc : fncs) {
|
||||
boolean didSomething = false;
|
||||
for (final Rule rule : rules) {
|
||||
@ -236,7 +232,6 @@ public class MathSolver {
|
||||
results.add(fnc);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (appliedRules.isEmpty())
|
||||
results = null;
|
||||
if (StaticVars.debugOn & results != null && !appliedRules.isEmpty()) {
|
||||
|
Loading…
Reference in New Issue
Block a user