Source code formatted

This commit is contained in:
Andrea Cavalli 2018-09-02 12:45:51 +02:00
parent 28eaab65bd
commit 9c2d5cfb24
83 changed files with 295 additions and 392 deletions

View File

@ -31,9 +31,5 @@
<natures> <natures>
<nature>org.eclipse.m2e.core.maven2Nature</nature> <nature>org.eclipse.m2e.core.maven2Nature</nature>
<nature>org.eclipse.jdt.core.javanature</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> </natures>
</projectDescription> </projectDescription>

10
pom.xml
View File

@ -73,7 +73,7 @@
<dependency> <dependency>
<groupId>org.jogamp.jogl</groupId> <groupId>org.jogamp.jogl</groupId>
<artifactId>jogl-all-main</artifactId> <artifactId>jogl-all-main</artifactId>
<version>2.3.2</version> <version>2.4</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.jogamp.gluegen</groupId> <groupId>org.jogamp.gluegen</groupId>
@ -88,7 +88,7 @@
<dependency> <dependency>
<groupId>org.fusesource.jansi</groupId> <groupId>org.fusesource.jansi</groupId>
<artifactId>jansi</artifactId> <artifactId>jansi</artifactId>
<version>1.15</version> <version>1.17.1</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>net.lingala.zip4j</groupId> <groupId>net.lingala.zip4j</groupId>
@ -214,17 +214,17 @@
<dependency> <dependency>
<groupId>org.infinispan</groupId> <groupId>org.infinispan</groupId>
<artifactId>infinispan-jcache</artifactId> <artifactId>infinispan-jcache</artifactId>
<version>8.2.4.Final</version> <version>9.4.0.Beta1</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>it.unimi.dsi</groupId> <groupId>it.unimi.dsi</groupId>
<artifactId>fastutil</artifactId> <artifactId>fastutil</artifactId>
<version>7.2.0</version> <version>8.2.1</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.google.code.gson</groupId> <groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId> <artifactId>gson</artifactId>
<version>2.8.2</version> <version>2.8.5</version>
</dependency> </dependency>
<!-- https://mvnrepository.com/artifact/commons-io/commons-io --> <!-- https://mvnrepository.com/artifact/commons-io/commons-io -->
<dependency> <dependency>

View File

@ -184,7 +184,7 @@ public class PngReaderApng extends PngReaderByte {
@Override @Override
protected boolean countChunkTypeAsAncillary(String id) { protected boolean countChunkTypeAsAncillary(String id) {
// we don't count fdat as ancillary data // 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));
} }
}; };

View File

@ -34,7 +34,6 @@ public class ConsoleUtils {
public void println(int level) { public void println(int level) {
if (StaticVars.outputLevel >= level) { if (StaticVars.outputLevel >= level) {
final String time = getTimeString();
if (StaticVars.outputLevel == 0) { if (StaticVars.outputLevel == 0) {
println(System.out); println(System.out);
} else { } else {

View File

@ -1,7 +1,6 @@
package org.warp.picalculator.deps; package org.warp.picalculator.deps;
import org.warp.picalculator.ClassUtils; import org.warp.picalculator.ClassUtils;
import org.warp.picalculator.StaticVars;
import org.warp.picalculator.gui.graphicengine.GraphicEngine; import org.warp.picalculator.gui.graphicengine.GraphicEngine;
import org.warp.picalculator.gui.graphicengine.cpu.CPUEngine; import org.warp.picalculator.gui.graphicengine.cpu.CPUEngine;
import org.warp.picalculator.gui.graphicengine.framebuffer.FBEngine; import org.warp.picalculator.gui.graphicengine.framebuffer.FBEngine;

View File

@ -1,7 +1,6 @@
package org.warp.picalculator.deps; package org.warp.picalculator.deps;
import org.warp.picalculator.ClassUtils; import org.warp.picalculator.ClassUtils;
import org.warp.picalculator.ClassUtils.Var;
public class DGpio { public class DGpio {

View File

@ -2,9 +2,6 @@ package org.warp.picalculator.deps;
import java.io.PrintWriter; import java.io.PrintWriter;
import org.warp.picalculator.ClassUtils;
import org.warp.picalculator.ClassUtils.Var;
public class DJDTCompiler { public class DJDTCompiler {
public static boolean compile(String[] strings, PrintWriter printWriter, PrintWriter printWriter2) { public static boolean compile(String[] strings, PrintWriter printWriter, PrintWriter printWriter2) {

View File

@ -1,7 +1,5 @@
package org.warp.picalculator.deps; package org.warp.picalculator.deps;
import java.util.ArrayList;
import java.util.Queue;
import java.util.concurrent.Semaphore; import java.util.concurrent.Semaphore;
public class DSemaphore extends Semaphore { public class DSemaphore extends Semaphore {

View File

@ -3,7 +3,6 @@ package org.warp.picalculator.deps;
import java.net.URL; import java.net.URL;
import java.net.URLClassLoader; import java.net.URLClassLoader;
import java.net.URLStreamHandlerFactory; import java.net.URLStreamHandlerFactory;
import java.security.AccessControlContext;
public class DURLClassLoader extends URLClassLoader { public class DURLClassLoader extends URLClassLoader {

View File

@ -2,7 +2,6 @@ package org.warp.picalculator.deps;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.File; import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
@ -17,7 +16,6 @@ import java.nio.file.Path;
import java.nio.file.Paths; import java.nio.file.Paths;
import java.nio.file.StandardOpenOption; import java.nio.file.StandardOpenOption;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections; import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
@ -27,7 +25,6 @@ import java.util.stream.Stream;
import org.apache.commons.io.IOUtils; import org.apache.commons.io.IOUtils;
import org.warp.picalculator.ClassUtils; import org.warp.picalculator.ClassUtils;
import org.warp.picalculator.boot.Main;
public class StorageUtils { public class StorageUtils {
public static final boolean exists(Path f) { public static final boolean exists(Path f) {

View File

@ -1,8 +1,5 @@
package org.warp.picalculator.deps.jogamp; package org.warp.picalculator.deps.jogamp;
import org.warp.picalculator.ClassUtils;
import org.warp.picalculator.ClassUtils.Var;
public class DJogamp { public class DJogamp {
// //

View File

@ -2,11 +2,8 @@ package org.warp.picalculator.deps.nio;
import java.io.IOException; import java.io.IOException;
import java.nio.file.Files; import java.nio.file.Files;
import java.util.Collection;
import java.util.List; import java.util.List;
import org.warp.picalculator.math.Function;
public class DFiles { public class DFiles {
public static boolean deleteIfExists(DPath path) throws IOException { public static boolean deleteIfExists(DPath path) throws IOException {

View File

@ -23,7 +23,10 @@
*/ */
package cz.adamh.utils; 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.FileSystemNotFoundException;
import java.nio.file.FileSystems; import java.nio.file.FileSystems;
import java.nio.file.Files; import java.nio.file.Files;

View File

@ -576,6 +576,7 @@ public class BigIntegerPoly implements Cloneable {
*/ */
final int l = ldegree(); final int l = ldegree();
if (a.elementAt(l).compareTo(BigInteger.ZERO) != 0) { if (a.elementAt(l).compareTo(BigInteger.ZERO) != 0) {
@SuppressWarnings("deprecation")
final Vector<BigInteger> cand = BigIntegerMath.divisors(a.elementAt(l).abs()); final Vector<BigInteger> cand = BigIntegerMath.divisors(a.elementAt(l).abs());
/* check the divisors (both signs) */ /* check the divisors (both signs) */
@ -615,8 +616,10 @@ public class BigIntegerPoly implements Cloneable {
} }
final BigInteger bsco = a.firstElement().abs(); final BigInteger bsco = a.firstElement().abs();
@SuppressWarnings("deprecation")
final Vector<BigInteger> b = BigIntegerMath.divisors(bsco); final Vector<BigInteger> b = BigIntegerMath.divisors(bsco);
final BigInteger csco = a.lastElement().abs(); final BigInteger csco = a.lastElement().abs();
@SuppressWarnings("deprecation")
final Vector<BigInteger> c = BigIntegerMath.divisors(csco); final Vector<BigInteger> c = BigIntegerMath.divisors(csco);
/* /*

View File

@ -3,8 +3,6 @@ package org.warp.picalculator;
import java.util.Collections; import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.concurrent.Callable;
import java.util.function.Function;
import java.util.function.Supplier; import java.util.function.Supplier;
public class CacheUtils { public class CacheUtils {

View File

@ -2,9 +2,7 @@ package org.warp.picalculator;
import java.lang.reflect.Array; import java.lang.reflect.Array;
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List;
public class ClassUtils { public class ClassUtils {

View File

@ -3,8 +3,8 @@ package org.warp.picalculator;
import java.util.function.Function; import java.util.function.Function;
import org.warp.picalculator.boot.StartupArguments; import org.warp.picalculator.boot.StartupArguments;
import org.warp.picalculator.flow.Observable;
import org.warp.picalculator.flow.BehaviorSubject; import org.warp.picalculator.flow.BehaviorSubject;
import org.warp.picalculator.flow.Observable;
public class StaticVars { public class StaticVars {
public static final boolean enableVBO = true; public static final boolean enableVBO = true;

View File

@ -5,7 +5,6 @@ import java.io.IOException;
import org.warp.picalculator.deps.DEngine; import org.warp.picalculator.deps.DEngine;
import org.warp.picalculator.deps.DSystem; import org.warp.picalculator.deps.DSystem;
import org.warp.picalculator.device.Keyboard; import org.warp.picalculator.device.Keyboard;
import org.warp.picalculator.event.Key;
import org.warp.picalculator.event.KeyPressedEvent; import org.warp.picalculator.event.KeyPressedEvent;
import org.warp.picalculator.event.KeyReleasedEvent; import org.warp.picalculator.event.KeyReleasedEvent;
import org.warp.picalculator.event.KeyboardEventListener; import org.warp.picalculator.event.KeyboardEventListener;

View File

@ -1,7 +1,5 @@
package org.warp.picalculator; package org.warp.picalculator;
import org.warp.picalculator.MmapByteBuffer;
public class TestJNI { public class TestJNI {
public TestJNI() { public TestJNI() {

View File

@ -1,12 +1,8 @@
package org.warp.picalculator; package org.warp.picalculator;
import java.io.BufferedReader;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.io.InputStreamReader;
import java.lang.management.ManagementFactory; import java.lang.management.ManagementFactory;
import java.lang.management.OperatingSystemMXBean; import java.lang.management.OperatingSystemMXBean;
import java.lang.reflect.Method; import java.lang.reflect.Method;
@ -15,12 +11,8 @@ import java.math.BigDecimal;
import java.math.BigInteger; import java.math.BigInteger;
import java.math.RoundingMode; import java.math.RoundingMode;
import java.net.URISyntaxException; import java.net.URISyntaxException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Properties;
import java.util.concurrent.TimeUnit;
import org.nevec.rjm.BigDecimalMath; import org.nevec.rjm.BigDecimalMath;
import org.nevec.rjm.Rational; 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.DPath;
import org.warp.picalculator.deps.nio.DPaths; import org.warp.picalculator.deps.nio.DPaths;
import org.warp.picalculator.device.HardwareDevice; import org.warp.picalculator.device.HardwareDevice;
import org.warp.picalculator.gui.DisplayManager;
import org.warp.picalculator.gui.graphicengine.BinaryFont; import org.warp.picalculator.gui.graphicengine.BinaryFont;
import org.warp.picalculator.math.Function; import org.warp.picalculator.math.Function;
import org.warp.picalculator.math.FunctionOperator; import org.warp.picalculator.math.FunctionOperator;

View File

@ -1,9 +1,9 @@
package org.warp.picalculator.boot; package org.warp.picalculator.boot;
import java.util.Arrays; import java.util.Arrays;
import org.warp.picalculator.ConsoleUtils; import org.warp.picalculator.ConsoleUtils;
import org.warp.picalculator.PICalculator; import org.warp.picalculator.PICalculator;
import org.warp.picalculator.flow.TestFlow;
public class Main { public class Main {
public static void main(String[] args) throws Exception { public static void main(String[] args) throws Exception {

View File

@ -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}"; 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}";
} }
} }

View File

@ -5,21 +5,19 @@ import java.awt.event.KeyEvent;
import org.warp.picalculator.ConsoleUtils; import org.warp.picalculator.ConsoleUtils;
import org.warp.picalculator.PlatformUtils; import org.warp.picalculator.PlatformUtils;
import org.warp.picalculator.StaticVars; 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.ParallelToSerial;
import org.warp.picalculator.device.chip.SerialToParallel; import org.warp.picalculator.device.chip.SerialToParallel;
import org.warp.picalculator.event.Key; import org.warp.picalculator.event.Key;
import org.warp.picalculator.event.KeyPressedEvent; import org.warp.picalculator.event.KeyPressedEvent;
import org.warp.picalculator.event.KeyReleasedEvent; import org.warp.picalculator.event.KeyReleasedEvent;
import org.warp.picalculator.event.KeyboardEventListener; import org.warp.picalculator.event.KeyboardEventListener;
import org.warp.picalculator.gui.DisplayManager;
import org.warp.picalculator.gui.GUIErrorMessage; import org.warp.picalculator.gui.GUIErrorMessage;
import org.warp.picalculator.gui.screens.KeyboardDebugScreen; import org.warp.picalculator.gui.screens.KeyboardDebugScreen;
import org.warp.picalculator.gui.screens.MarioScreen; import org.warp.picalculator.gui.screens.MarioScreen;
import org.warp.picalculator.gui.screens.Screen; import org.warp.picalculator.gui.screens.Screen;
import org.warp.picalculator.deps.DGpio;
import org.warp.picalculator.deps.jogamp.DJogamp;
public class Keyboard { public class Keyboard {
public static volatile boolean alpha = false; public static volatile boolean alpha = false;
public static volatile boolean shift = 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]; final Key k = keyMap[row][col][shift ? 1 : alpha ? 2 : 0];
if (k != null) { if (k != null) {
keyPressed(k); keyPressed(k);
} else {
if (false) {
} else { } else {
keyPressed(Key.NONE); keyPressed(Key.NONE);
} }
} }
}
public static void stopKeyboard() { public static void stopKeyboard() {
if (StaticVars.debugOn == false) { if (StaticVars.debugOn == false) {
@ -832,29 +826,26 @@ public class Keyboard {
} }
switch (k) { switch (k) {
case SHIFT: case SHIFT:
Keyboard.shift = !Keyboard.shift; if (Keyboard.alpha)
PlatformUtils.shiftChanged(Keyboard.shift); PlatformUtils.alphaChanged(Keyboard.alpha = false);
PlatformUtils.shiftChanged(Keyboard.shift = !Keyboard.shift);
refresh = true; refresh = true;
break; break;
case ALPHA: case ALPHA:
Keyboard.alpha = !Keyboard.alpha; if (Keyboard.shift)
PlatformUtils.alphaChanged(Keyboard.alpha); PlatformUtils.shiftChanged(Keyboard.shift = false);
PlatformUtils.alphaChanged(Keyboard.alpha = !Keyboard.alpha);
refresh = true; refresh = true;
break; break;
default: default:
if (k != Key.NONE) {
if (Keyboard.shift)
PlatformUtils.shiftChanged(Keyboard.shift = false);
if (Keyboard.alpha)
PlatformUtils.alphaChanged(Keyboard.alpha = false);
}
break; 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) { if (refresh) {
refreshRequest = true; refreshRequest = true;
} }

View File

@ -12,7 +12,6 @@ import java.util.logging.Logger;
import javax.imageio.ImageIO; import javax.imageio.ImageIO;
import org.warp.picalculator.ClassUtils; import org.warp.picalculator.ClassUtils;
import org.warp.picalculator.PICalculator;
import org.warp.picalculator.Utils; import org.warp.picalculator.Utils;
import org.warp.picalculator.deps.DSystem; import org.warp.picalculator.deps.DSystem;

View File

@ -1,16 +1,5 @@
package org.warp.picalculator.event; package org.warp.picalculator.event;
public enum Key { public enum Key {
POWEROFF, debug_DEG, debug_RAD, debug_GRA, SHIFT, ALPHA, NONE, HISTORY_BACK, 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,
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,
} }

View File

@ -39,7 +39,9 @@ public class MarioGame {
final double curY = player.getY(); final double curY = player.getY();
final double futureX = curX + deltaX; final double futureX = curX + deltaX;
final double futureY = curY + deltaY; final double futureY = curY + deltaY;
@SuppressWarnings("unused")
final boolean forward = futureX >= curX; final boolean forward = futureX >= curX;
@SuppressWarnings("unused")
final boolean up = futureY >= curY; final boolean up = futureY >= curY;
player.move(dt, futureX - curX, 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) { private int nearest(double val, int a, int b) {
final double aa = Math.abs(val - a); final double aa = Math.abs(val - a);
final double ab = Math.abs(val - b); final double ab = Math.abs(val - b);

View File

@ -6,6 +6,7 @@ public class MarioWorld {
private final int width; private final int width;
private final int height; private final int height;
private final byte[][] data; private final byte[][] data;
@SuppressWarnings("unused")
private final MarioEvent[] events; private final MarioEvent[] events;
private final MarioEntity[] entities; private final MarioEntity[] entities;

View File

@ -2,6 +2,7 @@ package org.warp.picalculator.extra.mario;
public class PlayerEntity extends MarioEntity { public class PlayerEntity extends MarioEntity {
@SuppressWarnings("unused")
private final int life; private final int life;
public float walkAnimation = 0; public float walkAnimation = 0;
public float jumptime = 0; public float jumptime = 0;

View File

@ -1,8 +1,5 @@
package org.warp.picalculator.flow; package org.warp.picalculator.flow;
import java.util.LinkedList;
import java.util.List;
public class BehaviorSubject<T> extends Subject<T> { public class BehaviorSubject<T> extends Subject<T> {
private T lastValue; private T lastValue;

View File

@ -7,7 +7,8 @@ public interface Consumer<T> {
/** /**
* Performs this operation on the given argument. * Performs this operation on the given argument.
* *
* @param t the input argument * @param t
* the input argument
*/ */
void accept(T t); void accept(T t);
@ -18,13 +19,18 @@ public interface Consumer<T> {
* composed operation. If performing this operation throws an exception, * composed operation. If performing this operation throws an exception,
* the {@code after} operation will not be performed. * 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 * @return a composed {@code Consumer} that performs in sequence this
* operation followed by the {@code after} operation * 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) { default Consumer<T> andThen(Consumer<? super T> after) {
Objects.requireNonNull(after); Objects.requireNonNull(after);
return (T t) -> { accept(t); after.accept(t); }; return (T t) -> {
accept(t);
after.accept(t);
};
} }
} }

View File

@ -2,7 +2,6 @@ package org.warp.picalculator.flow;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
import java.util.concurrent.TimeUnit;
import java.util.function.Function; import java.util.function.Function;
import org.apache.commons.lang3.tuple.Pair; import org.apache.commons.lang3.tuple.Pair;
@ -14,21 +13,27 @@ public abstract class Observable<T> implements ObservableSource<T> {
public Disposable subscribe() { public Disposable subscribe() {
return null; return null;
} }
public Disposable subscribe(Action1<? super T> onNext) { public Disposable subscribe(Action1<? super T> onNext) {
return subscribe(createSubscriber(onNext)); return subscribe(createSubscriber(onNext));
} }
protected Observable<T>.DisposableOfSubscriber createDisposable(Subscriber<? super T> sub) { protected Observable<T>.DisposableOfSubscriber createDisposable(Subscriber<? super T> sub) {
return new DisposableOfSubscriber(sub); return new DisposableOfSubscriber(sub);
} }
public Disposable subscribe(Action1<? super T> onNext, Action1<Throwable> onError) { public Disposable subscribe(Action1<? super T> onNext, Action1<Throwable> onError) {
return subscribe(createSubscriber(onNext, onError)); return subscribe(createSubscriber(onNext, onError));
} }
public Disposable subscribe(Action1<? super T> onNext, Action1<Throwable> onError, Action0 onCompleted) { public Disposable subscribe(Action1<? super T> onNext, Action1<Throwable> onError, Action0 onCompleted) {
return subscribe(createSubscriber(onNext, onError, onCompleted)); return subscribe(createSubscriber(onNext, onError, onCompleted));
} }
public void subscribe(Observer<? super T> obs) { public void subscribe(Observer<? super T> obs) {
subscribe(createSubscriber(obs)); subscribe(createSubscriber(obs));
} }
public Disposable subscribe(Subscriber<? super T> sub) { public Disposable subscribe(Subscriber<? super T> sub) {
subscribers.add(sub); subscribers.add(sub);
return createDisposable(sub); return createDisposable(sub);
@ -36,7 +41,9 @@ public abstract class Observable<T> implements ObservableSource<T> {
protected Subscriber<T> createSubscriber(Action1<? super T> onNext) { protected Subscriber<T> createSubscriber(Action1<? super T> onNext) {
return new Subscriber<T>() { return new Subscriber<T>() {
@Override public void onSubscribe(Subscription s) {} @Override
public void onSubscribe(Subscription s) {}
public void onNext(T t) { public void onNext(T t) {
onNext.call(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) { protected Subscriber<T> createSubscriber(Action1<? super T> onNext, Action1<Throwable> onError) {
return new Subscriber<T>() { return new Subscriber<T>() {
@Override public void onSubscribe(Subscription s) {} @Override
public void onSubscribe(Subscription s) {}
public void onNext(T t) { public void onNext(T t) {
onNext.call(t); onNext.call(t);
} }
@Override @Override
public void onError(Throwable t) { public void onError(Throwable t) {
onError.call(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) { protected Subscriber<T> createSubscriber(Action1<? super T> onNext, Action1<Throwable> onError, Action0 onCompl) {
return new Subscriber<T>() { return new Subscriber<T>() {
@Override public void onSubscribe(Subscription s) {} @Override
public void onSubscribe(Subscription s) {}
public void onNext(T t) { public void onNext(T t) {
onNext.call(t); onNext.call(t);
} }
@Override @Override
public void onError(Throwable t) { public void onError(Throwable t) {
onError.call(t); onError.call(t);
} }
@Override @Override
public void onComplete() { public void onComplete() {
onCompl.call(); onCompl.call();
@ -75,14 +89,18 @@ public abstract class Observable<T> implements ObservableSource<T> {
protected Subscriber<T> createSubscriber(Observer<? super T> obs) { protected Subscriber<T> createSubscriber(Observer<? super T> obs) {
return new Subscriber<T>() { return new Subscriber<T>() {
@Override public void onSubscribe(Subscription s) {} @Override
public void onSubscribe(Subscription s) {}
public void onNext(T t) { public void onNext(T t) {
obs.onNext(t); obs.onNext(t);
} }
@Override @Override
public void onError(Throwable t) { public void onError(Throwable t) {
obs.onError(t); obs.onError(t);
} }
@Override @Override
public void onComplete() { public void onComplete() {
obs.onComplete(); obs.onComplete();

View File

@ -1,7 +1,5 @@
package org.warp.picalculator.flow; package org.warp.picalculator.flow;
import java.util.function.Function;
import org.apache.commons.lang3.tuple.Pair; import org.apache.commons.lang3.tuple.Pair;
public class ObservableCombinedChanged<T, U> extends Observable<Pair<T, U>> { 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 Observable<U> b;
private Disposable disposableA; private Disposable disposableA;
private Disposable disposableB; private Disposable disposableB;
private Subject<Pair<T, U>> pairSubject;
private Subject<T> mapSubject;
public ObservableCombinedChanged(Observable<T> a, Observable<U> b) { public ObservableCombinedChanged(Observable<T> a, Observable<U> b) {
super(); super();
this.a = a; this.a = a;
this.b = b; this.b = b;
this.pairSubject = SimpleSubject.create();
} }
private void initialize() { private void initialize() {

View File

@ -1,7 +1,5 @@
package org.warp.picalculator.flow; package org.warp.picalculator.flow;
import java.util.function.Function;
import org.apache.commons.lang3.tuple.Pair; import org.apache.commons.lang3.tuple.Pair;
public class ObservableCombinedLatest<T, U> extends Observable<Pair<T, U>> { 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 U lastB;
private volatile boolean didAOneTime; private volatile boolean didAOneTime;
private volatile boolean didBOneTime; private volatile boolean didBOneTime;
private Subject<Pair<T, U>> pairSubject;
private Subject<T> mapSubject;
public ObservableCombinedLatest(Observable<T> a, Observable<U> b) { public ObservableCombinedLatest(Observable<T> a, Observable<U> b) {
super(); super();
this.a = a; this.a = a;
this.b = b; this.b = b;
this.pairSubject = SimpleSubject.create();
} }
private void initialize() { private void initialize() {

View File

@ -1,8 +1,5 @@
package org.warp.picalculator.flow; package org.warp.picalculator.flow;
import java.util.function.Function;
import org.apache.commons.lang3.tuple.Pair;
import org.warp.picalculator.PlatformUtils; import org.warp.picalculator.PlatformUtils;
public class ObservableInterval extends Observable<Long> { public class ObservableInterval extends Observable<Long> {

View File

@ -2,20 +2,16 @@ package org.warp.picalculator.flow;
import java.util.function.Function; import java.util.function.Function;
import org.apache.commons.lang3.tuple.Pair;
public class ObservableMap<T, U> extends Observable<U> { public class ObservableMap<T, U> extends Observable<U> {
private Observable<T> originalObservable; private Observable<T> originalObservable;
private Function<T, U> mapAction; private Function<T, U> mapAction;
private volatile boolean initialized = false; private volatile boolean initialized = false;
private Disposable mapDisposable; private Disposable mapDisposable;
private Subject<T> mapSubject;
public ObservableMap(Observable<T> originalObservable, Function<T, U> mapAction) { public ObservableMap(Observable<T> originalObservable, Function<T, U> mapAction) {
super(); super();
this.originalObservable = originalObservable; this.originalObservable = originalObservable;
this.mapAction = mapAction; this.mapAction = mapAction;
this.mapSubject = SimpleSubject.create();
} }
private void initialize() { private void initialize() {
@ -47,6 +43,7 @@ public class ObservableMap<T, U> extends Observable<U> {
chechInitialized(); chechInitialized();
return disp; return disp;
} }
@Override @Override
public void onDisposed(Subscriber<? super U> sub) { public void onDisposed(Subscriber<? super U> sub) {
super.onDisposed(sub); super.onDisposed(sub);

View File

@ -1,22 +1,16 @@
package org.warp.picalculator.flow; package org.warp.picalculator.flow;
import java.util.function.Function;
import org.apache.commons.lang3.tuple.Pair;
public class ObservableMerged<T> extends Observable<T> { public class ObservableMerged<T> extends Observable<T> {
private Observable<T> originalObservableA; private Observable<T> originalObservableA;
private Observable<T> originalObservableB; private Observable<T> originalObservableB;
private volatile boolean initialized = false; private volatile boolean initialized = false;
private Disposable mapDisposableA; private Disposable mapDisposableA;
private Disposable mapDisposableB; private Disposable mapDisposableB;
private Subject<T> mapSubject;
public ObservableMerged(Observable<T> originalObservableA, Observable<T> originalObservableB) { public ObservableMerged(Observable<T> originalObservableA, Observable<T> originalObservableB) {
super(); super();
this.originalObservableA = originalObservableA; this.originalObservableA = originalObservableA;
this.originalObservableB = originalObservableB; this.originalObservableB = originalObservableB;
this.mapSubject = SimpleSubject.create();
} }
private void initialize() { private void initialize() {

View File

@ -1,7 +1,5 @@
package org.warp.picalculator.flow; package org.warp.picalculator.flow;
import java.util.function.Function;
import org.apache.commons.lang3.tuple.Pair; import org.apache.commons.lang3.tuple.Pair;
public class ObservableZipped<T, U> extends Observable<Pair<T, U>> { 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 U lastB;
private volatile boolean didA; private volatile boolean didA;
private volatile boolean didB; private volatile boolean didB;
private Subject<Pair<T, U>> pairSubject;
private Subject<T> mapSubject;
public ObservableZipped(Observable<T> a, Observable<U> b) { public ObservableZipped(Observable<T> a, Observable<U> b) {
super(); super();
this.a = a; this.a = a;
this.b = b; this.b = b;
this.pairSubject = SimpleSubject.create();
} }
private void initialize() { private void initialize() {

View File

@ -2,7 +2,10 @@ package org.warp.picalculator.flow;
public interface Observer<T> { public interface Observer<T> {
public void onComplete(); public void onComplete();
public void onError(Throwable e); public void onError(Throwable e);
public void onNext(T t); public void onNext(T t);
public void onSubscribe(Disposable d); public void onSubscribe(Disposable d);
} }

View File

@ -1,14 +1,8 @@
package org.warp.picalculator.flow; 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> { public class SimpleSubject<T> extends Subject<T> {
protected SimpleSubject() { protected SimpleSubject() {}
}
public final static <T> SimpleSubject<T> create() { public final static <T> SimpleSubject<T> create() {
return new SimpleSubject<>(); return new SimpleSubject<>();
@ -66,7 +60,6 @@ public class SimpleSubject<T> extends Subject<T> {
} }
@Override @Override
public void onSubscribe(Disposable d) { public void onSubscribe(Disposable d) {}
}
} }

View File

@ -2,9 +2,13 @@ package org.warp.picalculator.flow;
public abstract class Subject<T> extends Observable<T> implements Observer<T> { public abstract class Subject<T> extends Observable<T> implements Observer<T> {
abstract Throwable getThrowable(); abstract Throwable getThrowable();
abstract boolean hasComplete(); abstract boolean hasComplete();
abstract boolean hasObservers(); abstract boolean hasObservers();
abstract boolean hasThrowable(); abstract boolean hasThrowable();
abstract Subject<T> toSerialized(); abstract Subject<T> toSerialized();
@Override @Override

View File

@ -2,7 +2,10 @@ package org.warp.picalculator.flow;
public interface Subscriber<T> { public interface Subscriber<T> {
default void onComplete() {} default void onComplete() {}
default void onError(Throwable t) {} default void onError(Throwable t) {}
void onNext(T t); void onNext(T t);
void onSubscribe(Subscription s); void onSubscribe(Subscription s);
} }

View File

@ -2,5 +2,6 @@ package org.warp.picalculator.flow;
public interface Subscription { public interface Subscription {
void cancel(); void cancel();
void request(long n); void request(long n);
} }

View File

@ -22,7 +22,6 @@ public class TestFlow {
subject0.onNext(60f); subject0.onNext(60f);
subject0.onNext(7f); subject0.onNext(7f);
subject0.onComplete(); subject0.onComplete();
System.out.println("items sent."); System.out.println("items sent.");
@ -128,8 +127,6 @@ public class TestFlow {
subjectF.onComplete(); subjectF.onComplete();
System.out.println("items sent."); System.out.println("items sent.");
} catch (Exception ex) { } catch (Exception ex) {
ex.printStackTrace(); ex.printStackTrace();
} }

View File

@ -33,7 +33,6 @@ public class CalculatorHUD extends HUD {
public void renderTopmostBackground() { public void renderTopmostBackground() {
final Renderer renderer = d.renderer; final Renderer renderer = d.renderer;
final GraphicEngine engine = d.engine; final GraphicEngine engine = d.engine;
final Skin guiSkin = d.guiSkin;
renderer.glColor(0xFFc5c2af); renderer.glColor(0xFFc5c2af);
renderer.glFillColor(0, 0, engine.getWidth(), 20); renderer.glFillColor(0, 0, engine.getWidth(), 20);

View File

@ -3,26 +3,15 @@ package org.warp.picalculator.gui;
import java.io.IOException; import java.io.IOException;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.concurrent.Semaphore;
import java.util.concurrent.TimeUnit;
import org.apache.commons.lang3.tuple.Pair; import org.apache.commons.lang3.tuple.Pair;
import org.warp.picalculator.ConsoleUtils; import org.warp.picalculator.ConsoleUtils;
import org.warp.picalculator.PlatformUtils;
import org.warp.picalculator.StaticVars; import org.warp.picalculator.StaticVars;
import org.warp.picalculator.Utils; import org.warp.picalculator.Utils;
import org.warp.picalculator.deps.DEngine; import org.warp.picalculator.deps.DEngine;
import org.warp.picalculator.deps.DSemaphore; import org.warp.picalculator.deps.DSemaphore;
import org.warp.picalculator.deps.DSystem; import org.warp.picalculator.deps.DSystem;
import org.warp.picalculator.device.HardwareDevice;
import org.warp.picalculator.device.Keyboard; 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.flow.Observable;
import org.warp.picalculator.gui.graphicengine.BinaryFont; import org.warp.picalculator.gui.graphicengine.BinaryFont;
import org.warp.picalculator.gui.graphicengine.GraphicEngine; 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.graphicengine.nogui.NoGuiEngine;
import org.warp.picalculator.gui.screens.Screen; import org.warp.picalculator.gui.screens.Screen;
import it.unimi.dsi.fastutil.longs.Long2ObjectMap.Entry;
import it.unimi.dsi.fastutil.objects.ObjectArrayList; import it.unimi.dsi.fastutil.objects.ObjectArrayList;
public final class DisplayManager implements RenderingLoop { public final class DisplayManager implements RenderingLoop {
private static final int tickDuration = 50; private static final int tickDuration = 50;
private HardwareDevice device;
private float brightness; private float brightness;
public final GraphicEngine engine; public final GraphicEngine engine;

View File

@ -3,7 +3,6 @@ package org.warp.picalculator.gui.expression.blocks;
import org.warp.picalculator.Error; import org.warp.picalculator.Error;
import org.warp.picalculator.Errors; import org.warp.picalculator.Errors;
import org.warp.picalculator.PlatformUtils; import org.warp.picalculator.PlatformUtils;
import org.warp.picalculator.StaticVars;
import org.warp.picalculator.gui.GraphicalElement; import org.warp.picalculator.gui.GraphicalElement;
import org.warp.picalculator.gui.expression.Caret; import org.warp.picalculator.gui.expression.Caret;
import org.warp.picalculator.gui.expression.CaretState; import org.warp.picalculator.gui.expression.CaretState;

View File

@ -23,6 +23,7 @@ public class BlockLogarithm extends Block {
private int bl; private int bl;
private int chw; private int chw;
private int chh; private int chh;
@SuppressWarnings("unused")
private int schh; private int schh;
private int nmbh; private int nmbh;
private int toph; private int toph;

View File

@ -2,10 +2,8 @@ package org.warp.picalculator.gui.expression.blocks;
import org.warp.picalculator.Error; import org.warp.picalculator.Error;
import org.warp.picalculator.device.HardwareDevice; import org.warp.picalculator.device.HardwareDevice;
import org.warp.picalculator.event.Key;
import org.warp.picalculator.event.KeyPressedEvent; import org.warp.picalculator.event.KeyPressedEvent;
import org.warp.picalculator.event.KeyReleasedEvent; 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.Caret;
import org.warp.picalculator.gui.expression.ExtraMenu; import org.warp.picalculator.gui.expression.ExtraMenu;
import org.warp.picalculator.gui.expression.InputContext; import org.warp.picalculator.gui.expression.InputContext;

View File

@ -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.BlockChar;
import org.warp.picalculator.gui.expression.blocks.BlockContainer; import org.warp.picalculator.gui.expression.blocks.BlockContainer;
import org.warp.picalculator.gui.expression.blocks.BlockDivision; 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.BlockNumericChar;
import org.warp.picalculator.gui.expression.blocks.BlockParenthesis; import org.warp.picalculator.gui.expression.blocks.BlockParenthesis;
import org.warp.picalculator.gui.expression.blocks.BlockPower; import org.warp.picalculator.gui.expression.blocks.BlockPower;
import org.warp.picalculator.gui.expression.blocks.BlockReference; import org.warp.picalculator.gui.expression.blocks.BlockReference;
import org.warp.picalculator.gui.expression.blocks.BlockSine; 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.BlockSquareRoot;
import org.warp.picalculator.gui.expression.blocks.BlockVariable; import org.warp.picalculator.gui.expression.blocks.BlockVariable;
import org.warp.picalculator.math.MathematicalSymbols; import org.warp.picalculator.math.MathematicalSymbols;
@ -97,7 +97,7 @@ public class NormalInputContainer extends InputContainer {
case MathematicalSymbols.DIVISION: case MathematicalSymbols.DIVISION:
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
final BlockReference<BlockDivision> ref = (BlockReference<BlockDivision>) getSelectedBlock(); final BlockReference<BlockDivision> ref = (BlockReference<BlockDivision>) getSelectedBlock();
final BlockContainer parentContainer = ref.getContainer(); @SuppressWarnings("unused") final BlockContainer parentContainer = ref.getContainer();
BlockReference<?> currentBlock = ref; BlockReference<?> currentBlock = ref;
boolean groupedBefore = false; boolean groupedBefore = false;
int before = 0; int before = 0;

View File

@ -9,7 +9,6 @@ import org.warp.picalculator.StaticVars;
import org.warp.picalculator.Utils; import org.warp.picalculator.Utils;
import org.warp.picalculator.device.HardwareDevice; import org.warp.picalculator.device.HardwareDevice;
import org.warp.picalculator.flow.Observable; 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.BinaryFont;
import org.warp.picalculator.gui.graphicengine.GraphicEngine; import org.warp.picalculator.gui.graphicengine.GraphicEngine;
import org.warp.picalculator.gui.graphicengine.RenderingLoop; import org.warp.picalculator.gui.graphicengine.RenderingLoop;

View File

@ -6,7 +6,6 @@ import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.net.URISyntaxException; import java.net.URISyntaxException;
import java.net.URL;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
@ -34,6 +33,7 @@ public class CPUFont implements BinaryFont {
public int[] intervals; public int[] intervals;
public int intervalsTotalSize = 0; public int intervalsTotalSize = 0;
public static final int intBits = 31; public static final int intBits = 31;
@SuppressWarnings("unused")
private final boolean isResource; private final boolean isResource;
public CPUFont(String fontName) throws IOException { public CPUFont(String fontName) throws IOException {
@ -186,6 +186,7 @@ public class CPUFont implements BinaryFont {
int beginIndex = -1; int beginIndex = -1;
int endIndex = 0; int endIndex = 0;
int intervalSize = 0; int intervalSize = 0;
@SuppressWarnings("unused")
final int holeSize = 0; final int holeSize = 0;
for (int i = 0; i < rawchars.length; i++) { for (int i = 0; i < rawchars.length; i++) {
if (rawchars[i] != null) { if (rawchars[i] != null) {
@ -273,6 +274,7 @@ public class CPUFont implements BinaryFont {
return compressedIndex; return compressedIndex;
} }
@SuppressWarnings("unused")
private int decompressIndex(int compressedIndex) { private int decompressIndex(int compressedIndex) {
final int originalIndex = 0; final int originalIndex = 0;
int i = 0; int i = 0;

View File

@ -3,17 +3,11 @@ package org.warp.picalculator.gui.graphicengine.cpu;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream;
import java.net.URISyntaxException; import java.net.URISyntaxException;
import java.nio.file.Files;
import javax.imageio.ImageIO; import javax.imageio.ImageIO;
import org.warp.picalculator.deps.DSystem;
import org.warp.picalculator.deps.StorageUtils; 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.GraphicEngine;
import org.warp.picalculator.gui.graphicengine.Skin; import org.warp.picalculator.gui.graphicengine.Skin;
@ -24,6 +18,7 @@ public class CPUSkin implements Skin {
public int[] skinData; public int[] skinData;
public int[] skinSize; public int[] skinSize;
@SuppressWarnings("unused")
private final boolean isResource; private final boolean isResource;
public CPUSkin(String file) throws IOException { public CPUSkin(String file) throws IOException {

View File

@ -20,7 +20,6 @@ import javax.swing.JFrame;
import javax.swing.JPanel; import javax.swing.JPanel;
import org.warp.picalculator.ConsoleUtils; import org.warp.picalculator.ConsoleUtils;
import org.warp.picalculator.PlatformUtils;
import org.warp.picalculator.StaticVars; import org.warp.picalculator.StaticVars;
import org.warp.picalculator.Utils; import org.warp.picalculator.Utils;
import org.warp.picalculator.device.HardwareDevice; 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.event.TouchStartEvent;
import org.warp.picalculator.flow.BehaviorSubject; import org.warp.picalculator.flow.BehaviorSubject;
import org.warp.picalculator.flow.Observable; import org.warp.picalculator.flow.Observable;
import org.warp.picalculator.gui.DisplayManager;
import org.warp.picalculator.gui.graphicengine.RenderingLoop; import org.warp.picalculator.gui.graphicengine.RenderingLoop;
import it.unimi.dsi.fastutil.objects.ObjectArrayList; import it.unimi.dsi.fastutil.objects.ObjectArrayList;
@ -184,7 +182,6 @@ public class SwingWindow extends JFrame {
}); });
} }
public Observable<Integer[]> onResize() { public Observable<Integer[]> onResize() {
return onResize$; return onResize$;
} }

View File

@ -9,7 +9,6 @@ import java.util.concurrent.Semaphore;
import org.warp.picalculator.MmapByteBuffer; import org.warp.picalculator.MmapByteBuffer;
import org.warp.picalculator.StaticVars; import org.warp.picalculator.StaticVars;
import org.warp.picalculator.TestJNI; import org.warp.picalculator.TestJNI;
import org.warp.picalculator.Utils;
import org.warp.picalculator.flow.BehaviorSubject; import org.warp.picalculator.flow.BehaviorSubject;
import org.warp.picalculator.flow.Observable; import org.warp.picalculator.flow.Observable;
import org.warp.picalculator.gui.graphicengine.BinaryFont; import org.warp.picalculator.gui.graphicengine.BinaryFont;
@ -22,8 +21,11 @@ import org.warp.picalculator.gui.graphicengine.cpu.CPUSkin;
public class FBEngine implements GraphicEngine { public class FBEngine implements GraphicEngine {
@SuppressWarnings("unused")
private static final int FB_DISPLAY_WIDTH = 320; private static final int FB_DISPLAY_WIDTH = 320;
@SuppressWarnings("unused")
private static final int FB_DISPLAY_HEIGHT = 480; private static final int FB_DISPLAY_HEIGHT = 480;
@SuppressWarnings("unused")
private static final int FB_DISPLAY_BPP = 32; private static final int FB_DISPLAY_BPP = 32;
private static final int WIDTH = 480; private static final int WIDTH = 480;
private static final int HEIGHT = 320; private static final int HEIGHT = 320;

View File

@ -6,7 +6,6 @@ import java.io.IOException;
import java.nio.file.Files; import java.nio.file.Files;
import org.warp.picalculator.PlatformUtils; import org.warp.picalculator.PlatformUtils;
import org.warp.picalculator.Utils;
import org.warp.picalculator.gui.graphicengine.BinaryFont; import org.warp.picalculator.gui.graphicengine.BinaryFont;
import org.warp.picalculator.gui.graphicengine.GraphicEngine; import org.warp.picalculator.gui.graphicengine.GraphicEngine;
import org.warp.picalculator.gui.graphicengine.cpu.CPUFont; import org.warp.picalculator.gui.graphicengine.cpu.CPUFont;
@ -102,6 +101,7 @@ public class GPUFont implements BinaryFont {
return compressedIndex; return compressedIndex;
} }
@SuppressWarnings("unused")
private int decompressIndex(int compressedIndex) { private int decompressIndex(int compressedIndex) {
final int originalIndex = 0; final int originalIndex = 0;
int i = 0; int i = 0;

View File

@ -7,11 +7,11 @@ import java.io.IOException;
import java.nio.Buffer; import java.nio.Buffer;
import java.nio.FloatBuffer; import java.nio.FloatBuffer;
import java.nio.file.Files; import java.nio.file.Files;
import javax.imageio.ImageIO; import javax.imageio.ImageIO;
import org.warp.picalculator.PlatformUtils; import org.warp.picalculator.PlatformUtils;
import org.warp.picalculator.StaticVars; import org.warp.picalculator.StaticVars;
import org.warp.picalculator.Utils;
import org.warp.picalculator.gui.graphicengine.BinaryFont; import org.warp.picalculator.gui.graphicengine.BinaryFont;
import org.warp.picalculator.gui.graphicengine.Renderer; import org.warp.picalculator.gui.graphicengine.Renderer;

View File

@ -8,7 +8,6 @@ import org.warp.picalculator.gui.graphicengine.GraphicEngine;
import org.warp.picalculator.gui.graphicengine.Skin; import org.warp.picalculator.gui.graphicengine.Skin;
import org.warp.picalculator.gui.graphicengine.gpu.GPURenderer.OpenedTextureData; import org.warp.picalculator.gui.graphicengine.gpu.GPURenderer.OpenedTextureData;
import com.jogamp.opengl.GL2ES1;
import com.jogamp.opengl.GLException; import com.jogamp.opengl.GLException;
import com.jogamp.opengl.util.texture.Texture; import com.jogamp.opengl.util.texture.Texture;
@ -40,7 +39,6 @@ public class GPUSkin implements Skin {
public void initialize(GraphicEngine d) { public void initialize(GraphicEngine d) {
try { try {
final OpenedTextureData i = GPURenderer.openTexture(texturePath, isResource); final OpenedTextureData i = GPURenderer.openTexture(texturePath, isResource);
final GL2ES1 gl = GPURenderer.gl;
t = GPURenderer.importTexture(i.f, i.deleteOnExit); t = GPURenderer.importTexture(i.f, i.deleteOnExit);
w = i.w; w = i.w;
h = i.h; h = i.h;

View File

@ -108,7 +108,9 @@ class NEWTWindow implements GLEventListener {
onResizeEvent.onNext(new Integer[] { disp.size[0], disp.size[1] }); onResizeEvent.onNext(new Integer[] { disp.size[0], disp.size[1] });
refreshViewport = true; refreshViewport = true;
}); });
StaticVars.windowZoom$.subscribe((zoom) -> {onZoom.onNext(zoom);}); StaticVars.windowZoom$.subscribe((zoom) -> {
onZoom.onNext(zoom);
});
onZoom.subscribe((z) -> { onZoom.subscribe((z) -> {
if (windowZoom != 0) { if (windowZoom != 0) {
windowZoom = z; windowZoom = z;
@ -372,6 +374,7 @@ class NEWTWindow implements GLEventListener {
public void mousePressed(MouseEvent e) { public void mousePressed(MouseEvent e) {
List<TouchPoint> newPoints = new ObjectArrayList<>(); List<TouchPoint> newPoints = new ObjectArrayList<>();
List<TouchPoint> changedPoints = new ObjectArrayList<>(); List<TouchPoint> changedPoints = new ObjectArrayList<>();
@SuppressWarnings("unused")
List<TouchPoint> oldPoints = touches; List<TouchPoint> oldPoints = touches;
int[] xs = e.getAllX(); int[] xs = e.getAllX();
int[] ys = e.getAllY(); int[] ys = e.getAllY();
@ -389,6 +392,7 @@ class NEWTWindow implements GLEventListener {
public void mouseReleased(MouseEvent e) { public void mouseReleased(MouseEvent e) {
List<TouchPoint> newPoints = new ObjectArrayList<>(); List<TouchPoint> newPoints = new ObjectArrayList<>();
List<TouchPoint> changedPoints = new ObjectArrayList<>(); List<TouchPoint> changedPoints = new ObjectArrayList<>();
@SuppressWarnings("unused")
List<TouchPoint> oldPoints = touches; List<TouchPoint> oldPoints = touches;
int[] xs = e.getAllX(); int[] xs = e.getAllX();
int[] ys = e.getAllY(); int[] ys = e.getAllY();

View File

@ -54,6 +54,7 @@ public class Headless24bitEngine implements org.warp.picalculator.gui.graphiceng
} }
@SuppressWarnings("unused")
private long outHandle; private long outHandle;
@Override @Override

View File

@ -1,7 +1,6 @@
package org.warp.picalculator.gui.graphicengine.headless8; package org.warp.picalculator.gui.graphicengine.headless8;
import org.warp.picalculator.StaticVars; import org.warp.picalculator.StaticVars;
import org.warp.picalculator.Utils;
import org.warp.picalculator.gui.graphicengine.Renderer; import org.warp.picalculator.gui.graphicengine.Renderer;
public class Headless8Renderer implements Renderer { public class Headless8Renderer implements Renderer {

View File

@ -1,9 +1,7 @@
package org.warp.picalculator.gui.graphicengine.nogui; package org.warp.picalculator.gui.graphicengine.nogui;
import java.io.IOException; import java.io.IOException;
import java.util.concurrent.Semaphore;
import org.warp.picalculator.Utils;
import org.warp.picalculator.deps.DSemaphore; import org.warp.picalculator.deps.DSemaphore;
import org.warp.picalculator.flow.Observable; import org.warp.picalculator.flow.Observable;
import org.warp.picalculator.gui.graphicengine.BinaryFont; import org.warp.picalculator.gui.graphicengine.BinaryFont;

View File

@ -3,9 +3,7 @@ package org.warp.picalculator.gui.screens;
import org.warp.picalculator.StaticVars; import org.warp.picalculator.StaticVars;
import org.warp.picalculator.Utils; import org.warp.picalculator.Utils;
import org.warp.picalculator.device.HardwareDevice; import org.warp.picalculator.device.HardwareDevice;
import org.warp.picalculator.event.Key;
import org.warp.picalculator.event.KeyPressedEvent; import org.warp.picalculator.event.KeyPressedEvent;
import org.warp.picalculator.gui.DisplayManager;
import org.warp.picalculator.math.Function; import org.warp.picalculator.math.Function;
import org.warp.picalculator.math.functions.Variable.VariableValue; import org.warp.picalculator.math.functions.Variable.VariableValue;

View File

@ -1,7 +1,5 @@
package org.warp.picalculator.gui.screens; package org.warp.picalculator.gui.screens;
import org.warp.picalculator.event.Key;
public class EmptyScreen extends Screen { public class EmptyScreen extends Screen {
public float endLoading; public float endLoading;

View File

@ -2,10 +2,8 @@ package org.warp.picalculator.gui.screens;
import org.warp.picalculator.StaticVars; import org.warp.picalculator.StaticVars;
import org.warp.picalculator.device.HardwareDevice; import org.warp.picalculator.device.HardwareDevice;
import org.warp.picalculator.event.Key;
import org.warp.picalculator.event.KeyPressedEvent; import org.warp.picalculator.event.KeyPressedEvent;
import org.warp.picalculator.event.KeyReleasedEvent; import org.warp.picalculator.event.KeyReleasedEvent;
import org.warp.picalculator.gui.DisplayManager;
import org.warp.picalculator.gui.graphicengine.Renderer; import org.warp.picalculator.gui.graphicengine.Renderer;
public class KeyboardDebugScreen extends Screen { public class KeyboardDebugScreen extends Screen {

View File

@ -2,8 +2,6 @@ package org.warp.picalculator.gui.screens;
import org.warp.picalculator.StaticVars; import org.warp.picalculator.StaticVars;
import org.warp.picalculator.device.HardwareDevice; import org.warp.picalculator.device.HardwareDevice;
import org.warp.picalculator.event.Key;
import org.warp.picalculator.gui.DisplayManager;
import org.warp.picalculator.gui.GraphicUtils; import org.warp.picalculator.gui.GraphicUtils;
public class LoadingScreen extends Screen { public class LoadingScreen extends Screen {

View File

@ -5,10 +5,8 @@ import java.io.IOException;
import org.warp.picalculator.StaticVars; import org.warp.picalculator.StaticVars;
import org.warp.picalculator.device.HardwareDevice; import org.warp.picalculator.device.HardwareDevice;
import org.warp.picalculator.device.Keyboard; 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.MarioGame;
import org.warp.picalculator.extra.mario.MarioWorld; 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.BinaryFont;
import org.warp.picalculator.gui.graphicengine.Skin; import org.warp.picalculator.gui.graphicengine.Skin;

View File

@ -1,8 +1,6 @@
package org.warp.picalculator.gui.screens; package org.warp.picalculator.gui.screens;
import java.io.IOException; import java.io.IOException;
import java.io.PrintWriter;
import java.io.StringWriter;
import org.warp.picalculator.ConsoleUtils; import org.warp.picalculator.ConsoleUtils;
import org.warp.picalculator.Error; 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.Key;
import org.warp.picalculator.event.KeyPressedEvent; import org.warp.picalculator.event.KeyPressedEvent;
import org.warp.picalculator.event.KeyReleasedEvent; 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.InputContext;
import org.warp.picalculator.gui.expression.blocks.Block; import org.warp.picalculator.gui.expression.blocks.Block;
import org.warp.picalculator.gui.expression.blocks.BlockContainer; import org.warp.picalculator.gui.expression.blocks.BlockContainer;
@ -58,6 +55,7 @@ public class MathInputScreen extends Screen {
private double computingElapsedTime = 0; private double computingElapsedTime = 0;
private boolean computingBreakTipVisible = false; private boolean computingBreakTipVisible = false;
boolean mustRefresh = true; boolean mustRefresh = true;
@SuppressWarnings("unused")
private int currentStep = 0; private int currentStep = 0;
public MathInputScreen() { public MathInputScreen() {

View File

@ -1,7 +1,5 @@
package org.warp.picalculator.gui.screens; 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.KeyboardEventListener;
import org.warp.picalculator.event.TouchEventListener; import org.warp.picalculator.event.TouchEventListener;
import org.warp.picalculator.gui.DisplayManager; import org.warp.picalculator.gui.DisplayManager;

View File

@ -2,9 +2,7 @@ package org.warp.picalculator.gui.screens;
import org.warp.picalculator.StaticVars; import org.warp.picalculator.StaticVars;
import org.warp.picalculator.device.HardwareDevice; import org.warp.picalculator.device.HardwareDevice;
import org.warp.picalculator.event.Key;
import org.warp.picalculator.event.KeyPressedEvent; import org.warp.picalculator.event.KeyPressedEvent;
import org.warp.picalculator.gui.DisplayManager;
public class SolveForXScreen extends Screen { public class SolveForXScreen extends Screen {

View File

@ -7,6 +7,7 @@ import org.warp.picalculator.gui.expression.blocks.BlockDivision;
import org.warp.picalculator.math.Function; import org.warp.picalculator.math.Function;
import org.warp.picalculator.math.FunctionOperator; import org.warp.picalculator.math.FunctionOperator;
import org.warp.picalculator.math.MathContext; import org.warp.picalculator.math.MathContext;
import it.unimi.dsi.fastutil.objects.ObjectArrayList; import it.unimi.dsi.fastutil.objects.ObjectArrayList;
public class Division extends FunctionOperator { public class Division extends FunctionOperator {

View File

@ -8,6 +8,7 @@ import org.warp.picalculator.math.Function;
import org.warp.picalculator.math.FunctionOperator; import org.warp.picalculator.math.FunctionOperator;
import org.warp.picalculator.math.MathContext; import org.warp.picalculator.math.MathContext;
import org.warp.picalculator.math.MathematicalSymbols; import org.warp.picalculator.math.MathematicalSymbols;
import it.unimi.dsi.fastutil.objects.ObjectArrayList; import it.unimi.dsi.fastutil.objects.ObjectArrayList;
public class Multiplication extends FunctionOperator { public class Multiplication extends FunctionOperator {

View File

@ -3,6 +3,7 @@ package org.warp.picalculator.math.functions;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.BigInteger; import java.math.BigInteger;
import java.util.LinkedList; import java.util.LinkedList;
import org.nevec.rjm.BigDecimalMath; import org.nevec.rjm.BigDecimalMath;
import org.warp.picalculator.Error; import org.warp.picalculator.Error;
import org.warp.picalculator.Utils; import org.warp.picalculator.Utils;

View File

@ -7,6 +7,7 @@ import org.warp.picalculator.math.Function;
import org.warp.picalculator.math.FunctionOperator; import org.warp.picalculator.math.FunctionOperator;
import org.warp.picalculator.math.MathContext; import org.warp.picalculator.math.MathContext;
import org.warp.picalculator.math.MathematicalSymbols; import org.warp.picalculator.math.MathematicalSymbols;
import it.unimi.dsi.fastutil.objects.ObjectArrayList; import it.unimi.dsi.fastutil.objects.ObjectArrayList;
public class Sum extends FunctionOperator { public class Sum extends FunctionOperator {

View File

@ -5,6 +5,7 @@ import org.warp.picalculator.gui.expression.blocks.Block;
import org.warp.picalculator.math.Function; import org.warp.picalculator.math.Function;
import org.warp.picalculator.math.FunctionDynamic; import org.warp.picalculator.math.FunctionDynamic;
import org.warp.picalculator.math.MathContext; import org.warp.picalculator.math.MathContext;
import it.unimi.dsi.fastutil.objects.ObjectArrayList; import it.unimi.dsi.fastutil.objects.ObjectArrayList;
public class EquationsSystem extends FunctionDynamic { public class EquationsSystem extends FunctionDynamic {

View File

@ -7,6 +7,7 @@ import org.warp.picalculator.gui.expression.blocks.BlockSine;
import org.warp.picalculator.math.Function; import org.warp.picalculator.math.Function;
import org.warp.picalculator.math.FunctionSingle; import org.warp.picalculator.math.FunctionSingle;
import org.warp.picalculator.math.MathContext; import org.warp.picalculator.math.MathContext;
import it.unimi.dsi.fastutil.objects.ObjectArrayList; import it.unimi.dsi.fastutil.objects.ObjectArrayList;
public class Sine extends FunctionSingle { public class Sine extends FunctionSingle {

View File

@ -10,6 +10,7 @@ import it.unimi.dsi.fastutil.objects.ObjectArrayList;
public class RemoveParentheses implements MathParserStep { public class RemoveParentheses implements MathParserStep {
@SuppressWarnings("unused")
private final MathContext context; private final MathContext context;
public RemoveParentheses(MathContext context) { public RemoveParentheses(MathContext context) {

View File

@ -4,7 +4,6 @@ import org.warp.picalculator.Error;
import org.warp.picalculator.math.Function; import org.warp.picalculator.math.Function;
import it.unimi.dsi.fastutil.objects.ObjectArrayList; import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import jdk.nashorn.internal.objects.annotations.SpecializedFunction;
/** /**
* Rule interface * Rule interface
@ -27,7 +26,6 @@ public interface Rule {
* *
* @return * @return
*/ */
@SpecializedFunction
public RuleType getRuleType(); public RuleType getRuleType();
/** /**

View File

@ -8,26 +8,19 @@ import java.io.InputStream;
import java.io.PrintWriter; import java.io.PrintWriter;
import java.net.URISyntaxException; import java.net.URISyntaxException;
import java.net.URL; 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.ArrayList;
import java.util.List; import java.util.List;
import java.util.stream.Stream;
import org.apache.commons.io.IOUtils;
import org.warp.picalculator.ConsoleUtils; import org.warp.picalculator.ConsoleUtils;
import org.warp.picalculator.Error; import org.warp.picalculator.Error;
import org.warp.picalculator.PlatformUtils; import org.warp.picalculator.PlatformUtils;
import org.warp.picalculator.StaticVars; import org.warp.picalculator.StaticVars;
import org.warp.picalculator.Utils;
import org.warp.picalculator.ZipUtils; import org.warp.picalculator.ZipUtils;
import org.warp.picalculator.deps.StorageUtils;
import org.warp.picalculator.deps.DJDTCompiler; import org.warp.picalculator.deps.DJDTCompiler;
import org.warp.picalculator.deps.DStandardOpenOption; import org.warp.picalculator.deps.DStandardOpenOption;
import org.warp.picalculator.deps.DSystem; import org.warp.picalculator.deps.DSystem;
import org.warp.picalculator.deps.DURLClassLoader; import org.warp.picalculator.deps.DURLClassLoader;
import org.warp.picalculator.deps.StorageUtils;
import org.warp.picalculator.math.Function; import org.warp.picalculator.math.Function;
import org.warp.picalculator.math.MathContext; import org.warp.picalculator.math.MathContext;
import org.warp.picalculator.math.functions.Expression; import org.warp.picalculator.math.functions.Expression;
@ -43,7 +36,7 @@ public class RulesManager {
private RulesManager() {} private RulesManager() {}
@SuppressWarnings({ "unchecked", "unused" }) @SuppressWarnings({ "unchecked" })
public static void initialize() { public static void initialize() {
ConsoleUtils.out.println(ConsoleUtils.OUTPUTLEVEL_NODEBUG, "RulesManager", "Loading the rules"); ConsoleUtils.out.println(ConsoleUtils.OUTPUTLEVEL_NODEBUG, "RulesManager", "Loading the rules");
rules = new ObjectArrayList[RuleType.values().length]; rules = new ObjectArrayList[RuleType.values().length];

View File

@ -4,6 +4,7 @@ import org.warp.picalculator.Error;
import org.warp.picalculator.math.Function; import org.warp.picalculator.math.Function;
import org.warp.picalculator.math.MathContext; import org.warp.picalculator.math.MathContext;
import org.warp.picalculator.math.functions.Multiplication; import org.warp.picalculator.math.functions.Multiplication;
import it.unimi.dsi.fastutil.objects.ObjectArrayList; import it.unimi.dsi.fastutil.objects.ObjectArrayList;
/** /**

View File

@ -1,7 +1,6 @@
package org.warp.picalculator.math.solver; package org.warp.picalculator.math.solver;
import java.util.List; import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
import org.warp.picalculator.ConsoleUtils; import org.warp.picalculator.ConsoleUtils;
import org.warp.picalculator.Error; import org.warp.picalculator.Error;
@ -12,7 +11,6 @@ import org.warp.picalculator.math.rules.Rule;
import org.warp.picalculator.math.rules.RuleType; import org.warp.picalculator.math.rules.RuleType;
import it.unimi.dsi.fastutil.objects.ObjectArrayList; import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import sun.reflect.generics.reflectiveObjects.NotImplementedException;
public class MathSolver { public class MathSolver {
@ -114,6 +112,7 @@ public class MathSolver {
return false; return false;
} }
@SuppressWarnings("unused")
private ObjectArrayList<Function> solveStep(ObjectArrayList<Function> fncs) throws InterruptedException, Error { private ObjectArrayList<Function> solveStep(ObjectArrayList<Function> fncs) throws InterruptedException, Error {
return solveStep(fncs, stepState); return solveStep(fncs, stepState);
} }
@ -143,8 +142,7 @@ public class MathSolver {
break; break;
} }
default: default:
System.err.println("Unknown Step State"); throw new RuntimeException("Unknown Step State");
throw new NotImplementedException();
} }
final ObjectArrayList<Function> results = applyRules(fncs, currentAcceptedRules); final ObjectArrayList<Function> results = applyRules(fncs, currentAcceptedRules);
switch (stepStates[stepState.get()]) { switch (stepStates[stepState.get()]) {
@ -203,8 +201,7 @@ public class MathSolver {
break; break;
} }
default: default:
System.err.println("Unknown Step State"); throw new RuntimeException("Unknown Step State");
throw new NotImplementedException();
} }
return null; return null;
} }
@ -214,7 +211,6 @@ public class MathSolver {
final ObjectArrayList<Rule> rules = initialFunction.getMathContext().getAcceptableRules(currentAcceptedRules); final ObjectArrayList<Rule> rules = initialFunction.getMathContext().getAcceptableRules(currentAcceptedRules);
ObjectArrayList<Function> results = null; ObjectArrayList<Function> results = null;
ObjectArrayList<Rule> appliedRules = new ObjectArrayList<>(); ObjectArrayList<Rule> appliedRules = new ObjectArrayList<>();
out: {
for (final Function fnc : fncs) { for (final Function fnc : fncs) {
boolean didSomething = false; boolean didSomething = false;
for (final Rule rule : rules) { for (final Rule rule : rules) {
@ -236,7 +232,6 @@ public class MathSolver {
results.add(fnc); results.add(fnc);
} }
} }
}
if (appliedRules.isEmpty()) if (appliedRules.isEmpty())
results = null; results = null;
if (StaticVars.debugOn & results != null && !appliedRules.isEmpty()) { if (StaticVars.debugOn & results != null && !appliedRules.isEmpty()) {