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>
<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
View File

@ -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>

View File

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

View File

@ -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 {

View File

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

View File

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

View File

@ -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) {

View File

@ -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 {

View File

@ -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 {

View File

@ -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) {

View File

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

View File

@ -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 {

View File

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

View File

@ -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);
/*

View File

@ -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 {

View File

@ -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 {

View File

@ -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;
@ -14,7 +14,7 @@ public class StaticVars {
public static boolean haxMode = true;
public static final boolean zoomed = true;
public static int[] screenPos = new int[] { 0, 0 };
public static final int[] screenSize = new int[] {480, 320};
public static final int[] screenSize = new int[] { 480, 320 };
public static boolean debugOn;
public static int outputLevel = 0;
public static boolean debugWindow2x = false;

View File

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

View File

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

View File

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

View File

@ -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 {

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

View File

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

View File

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

View File

@ -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,
}

View File

@ -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);

View File

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

View File

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

View File

@ -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;
@ -39,7 +36,7 @@ public class BehaviorSubject<T> extends Subject<T> {
public void onError(Throwable e) {
for (Subscriber<? super T> sub : this.subscribers) {
sub.onError(e);
};
} ;
}
@Override

View File

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

View File

@ -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();
@ -103,15 +121,15 @@ public abstract class Observable<T> implements ObservableSource<T> {
return new ObservableMap<T, U>(this, f);
}
public static final <T, U> Observable<Pair<T,U>> combineLatest(Observable<T> a, Observable<U> b) {
public static final <T, U> Observable<Pair<T, U>> combineLatest(Observable<T> a, Observable<U> b) {
return new ObservableCombinedLatest<>(a, b);
}
public static final <T, U> Observable<Pair<T,U>> combineChanged(Observable<T> a, Observable<U> b) {
public static final <T, U> Observable<Pair<T, U>> combineChanged(Observable<T> a, Observable<U> b) {
return new ObservableCombinedChanged<>(a, b);
}
public static final <T, U> Observable<Pair<T,U>> zip(Observable<T> a, Observable<U> b) {
public static final <T, U> Observable<Pair<T, U>> zip(Observable<T> a, Observable<U> b) {
return new ObservableZipped<>(a, b);
}

View File

@ -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() {
@ -28,24 +23,24 @@ public class ObservableCombinedChanged<T, U> extends Observable<Pair<T, U>> {
}, (e) -> {
for (Subscriber<? super Pair<T, U>> sub : this.subscribers) {
sub.onError(e);
};
} ;
}, () -> {
for (Subscriber<? super Pair<T, U>> sub : this.subscribers) {
sub.onComplete();
};
} ;
});
this.disposableB = b.subscribe((t) -> {
for (Subscriber<? super Pair<T, U>> sub : this.subscribers) {
sub.onNext(Pair.of(null, t));
};
} ;
}, (e) -> {
for (Subscriber<? super Pair<T, U>> sub : this.subscribers) {
sub.onError(e);
};
} ;
}, () -> {
for (Subscriber<? super Pair<T, U>> sub : this.subscribers) {
sub.onComplete();
};
} ;
});
}
@ -57,7 +52,7 @@ public class ObservableCombinedChanged<T, U> extends Observable<Pair<T, U>> {
}
@Override
public Disposable subscribe(Subscriber<? super Pair<T,U>> sub) {
public Disposable subscribe(Subscriber<? super Pair<T, U>> sub) {
Disposable disp = super.subscribe(sub);
chechInitialized();
return disp;

View File

@ -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() {
@ -32,11 +27,11 @@ public class ObservableCombinedLatest<T, U> extends Observable<Pair<T, U>> {
}, (e) -> {
for (Subscriber<? super Pair<T, U>> sub : this.subscribers) {
sub.onError(e);
};
} ;
}, () -> {
for (Subscriber<? super Pair<T, U>> sub : this.subscribers) {
sub.onComplete();
};
} ;
});
this.disposableB = b.subscribe((t) -> {
lastB = t;
@ -45,11 +40,11 @@ public class ObservableCombinedLatest<T, U> extends Observable<Pair<T, U>> {
}, (e) -> {
for (Subscriber<? super Pair<T, U>> sub : this.subscribers) {
sub.onError(e);
};
} ;
}, () -> {
for (Subscriber<? super Pair<T, U>> sub : this.subscribers) {
sub.onComplete();
};
} ;
});
}
@ -69,7 +64,7 @@ public class ObservableCombinedLatest<T, U> extends Observable<Pair<T, U>> {
}
@Override
public Disposable subscribe(Subscriber<? super Pair<T,U>> sub) {
public Disposable subscribe(Subscriber<? super Pair<T, U>> sub) {
Disposable disp = super.subscribe(sub);
chechInitialized();
return disp;

View File

@ -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> {
@ -44,7 +41,7 @@ public class ObservableInterval extends Observable<Long> {
}
timeThread = new Thread(() -> {
try {
while(!Thread.interrupted()) {
while (!Thread.interrupted()) {
for (Subscriber<? super Long> sub : this.subscribers) {
sub.onNext(System.currentTimeMillis());
}

View File

@ -2,35 +2,31 @@ 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() {
this.mapDisposable = originalObservable.subscribe((t) -> {
for (Subscriber<? super U> sub : this.subscribers) {
sub.onNext(mapAction.apply(t));
};
} ;
}, (e) -> {
for (Subscriber<? super U> sub : this.subscribers) {
sub.onError(e);
};
} ;
}, () -> {
for (Subscriber<? super U> sub : this.subscribers) {
sub.onComplete();
};
} ;
});
}
@ -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);

View File

@ -1,50 +1,44 @@
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() {
this.mapDisposableA = originalObservableA.subscribe((t) -> {
for (Subscriber<? super T> sub : this.subscribers) {
sub.onNext(t);
};
} ;
}, (e) -> {
for (Subscriber<? super T> sub : this.subscribers) {
sub.onError(e);
};
} ;
}, () -> {
for (Subscriber<? super T> sub : this.subscribers) {
sub.onComplete();
};
} ;
});
this.mapDisposableB = originalObservableB.subscribe((t) -> {
for (Subscriber<? super T> sub : this.subscribers) {
sub.onNext(t);
};
} ;
}, (e) -> {
for (Subscriber<? super T> sub : this.subscribers) {
sub.onError(e);
};
} ;
}, () -> {
for (Subscriber<? super T> sub : this.subscribers) {
sub.onComplete();
};
} ;
});
}

View File

@ -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() {
@ -32,11 +27,11 @@ public class ObservableZipped<T, U> extends Observable<Pair<T, U>> {
}, (e) -> {
for (Subscriber<? super Pair<T, U>> sub : this.subscribers) {
sub.onError(e);
};
} ;
}, () -> {
for (Subscriber<? super Pair<T, U>> sub : this.subscribers) {
sub.onComplete();
};
} ;
});
this.disposableB = b.subscribe((t) -> {
lastB = t;
@ -45,11 +40,11 @@ public class ObservableZipped<T, U> extends Observable<Pair<T, U>> {
}, (e) -> {
for (Subscriber<? super Pair<T, U>> sub : this.subscribers) {
sub.onError(e);
};
} ;
}, () -> {
for (Subscriber<? super Pair<T, U>> sub : this.subscribers) {
sub.onComplete();
};
} ;
});
}
@ -59,7 +54,7 @@ public class ObservableZipped<T, U> extends Observable<Pair<T, U>> {
didB = false;
for (Subscriber<? super Pair<T, U>> sub : this.subscribers) {
sub.onNext(Pair.of(lastA, lastB));
};
} ;
}
}
@ -71,7 +66,7 @@ public class ObservableZipped<T, U> extends Observable<Pair<T, U>> {
}
@Override
public Disposable subscribe(Subscriber<? super Pair<T,U>> sub) {
public Disposable subscribe(Subscriber<? super Pair<T, U>> sub) {
Disposable disp = super.subscribe(sub);
chechInitialized();
return disp;

View File

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

View File

@ -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<>();
@ -18,21 +12,21 @@ public class SimpleSubject<T> extends Subject<T> {
public void onComplete() {
for (Subscriber<? super T> sub : this.subscribers) {
sub.onComplete();
};
} ;
}
@Override
public void onError(Throwable e) {
for (Subscriber<? super T> sub : this.subscribers) {
sub.onError(e);
};
} ;
}
@Override
public void onNext(T t) {
for (Subscriber<? super T> sub : this.subscribers) {
sub.onNext(t);
};
} ;
}
@Override
@ -66,7 +60,6 @@ public class SimpleSubject<T> extends Subject<T> {
}
@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> {
abstract Throwable getThrowable();
abstract boolean hasComplete();
abstract boolean hasObservers();
abstract boolean hasThrowable();
abstract Subject<T> toSerialized();
@Override

View File

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

View File

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

View File

@ -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();
}

View File

@ -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);

View File

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

View File

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

View File

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

View File

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

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.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;

View File

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

View File

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

View File

@ -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 {

View File

@ -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;
@ -99,7 +97,7 @@ public class SwingWindow extends JFrame {
@Override
public void componentResized(ComponentEvent e) {
onResize.onNext(new Integer[] {getWidth(), getHeight()});
onResize.onNext(new Integer[] { getWidth(), getHeight() });
}
@Override
@ -178,13 +176,12 @@ public class SwingWindow extends JFrame {
StaticVars.windowZoom$.subscribe((newZoomValue) -> {
if (newZoomValue != mult) {
mult = (int) newZoomValue.floatValue();
this.onResize.onNext(new Integer[] {getWidth(), getHeight()});
this.onResize.onNext(new Integer[] { getWidth(), getHeight() });
ConsoleUtils.out.println(3, "Engine", "CPU", "Zoom changed");
}
});
}
public Observable<Integer[]> onResize() {
return onResize$;
}

View File

@ -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;
@ -58,7 +60,7 @@ public class FBEngine implements GraphicEngine {
@Override
public void create(Runnable onInitialized) {
onResize = BehaviorSubject.create(new Integer[] {SIZE[0], SIZE[1]});
onResize = BehaviorSubject.create(new Integer[] { SIZE[0], SIZE[1] });
realFb = jni.retrieveBuffer();
final long fbLen = realFb.getLength();
fb = (MappedByteBuffer) ByteBuffer.allocateDirect((int) fbLen);

View File

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

View File

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

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.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;

View File

@ -94,7 +94,7 @@ class NEWTWindow implements GLEventListener {
disp.size[1] = StaticVars.screenSize[1];
realWindowSize = new int[] { StaticVars.screenSize[0], StaticVars.screenSize[1] };
windowZoom = StaticVars.windowZoomFunction.apply(StaticVars.windowZoom.getLastValue());
onRealResize = BehaviorSubject.create(new Integer[] {(int) (StaticVars.screenSize[0] * windowZoom), (int) (StaticVars.screenSize[1] * windowZoom)});
onRealResize = BehaviorSubject.create(new Integer[] { (int) (StaticVars.screenSize[0] * windowZoom), (int) (StaticVars.screenSize[1] * windowZoom) });
onRealResize.subscribe((realSize) -> {
System.err.println("[[[SET REALWINDOWZOOM");
@ -102,14 +102,16 @@ class NEWTWindow implements GLEventListener {
realWindowSize[1] = realSize[1];
disp.size[0] = realSize[0] / (int) windowZoom;
disp.size[1] = realSize[1] / (int) windowZoom;
System.err.println("[[["+realWindowSize[0]);
System.err.println("[[["+windowZoom);
System.err.println("[[["+disp.size[0]);
onResizeEvent.onNext(new Integer[] {disp.size[0], disp.size[1]});
System.err.println("[[[" + realWindowSize[0]);
System.err.println("[[[" + windowZoom);
System.err.println("[[[" + disp.size[0]);
onResizeEvent.onNext(new Integer[] { disp.size[0], disp.size[1] });
refreshViewport = true;
});
StaticVars.windowZoom$.subscribe((zoom) -> {onZoom.onNext(zoom);});
onZoom.subscribe((z)-> {
StaticVars.windowZoom$.subscribe((zoom) -> {
onZoom.onNext(zoom);
});
onZoom.subscribe((z) -> {
if (windowZoom != 0) {
windowZoom = z;
disp.size[0] = (int) (realWindowSize[0] / windowZoom);
@ -117,9 +119,9 @@ class NEWTWindow implements GLEventListener {
StaticVars.screenSize[0] = disp.size[0];
StaticVars.screenSize[1] = disp.size[1];
System.err.println("[[[SET WINDOWZOOM");
System.err.println("[[["+realWindowSize[0]);
System.err.println("[[["+windowZoom);
System.err.println("[[[A:"+disp.size[0]);
System.err.println("[[[" + realWindowSize[0]);
System.err.println("[[[" + windowZoom);
System.err.println("[[[A:" + disp.size[0]);
refreshViewport = true;
}
});
@ -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();
@ -494,7 +498,7 @@ class NEWTWindow implements GLEventListener {
@Override
public void reshape(GLAutoDrawable glad, int x, int y, int width, int height) {
onRealResize.onNext(new Integer[] {width, height});
onRealResize.onNext(new Integer[] { width, height });
}
@Override
@ -556,7 +560,7 @@ class NEWTWindow implements GLEventListener {
zoom = 1;
}
window.setSize(width * zoom, height * zoom);
onRealResize.onNext(new Integer[] {width * zoom, height * zoom});
onRealResize.onNext(new Integer[] { width * zoom, height * zoom });
}
@Override

View File

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

View File

@ -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 {

View File

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

View File

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

View File

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

View File

@ -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 {

View File

@ -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 {

View File

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

View File

@ -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() {

View File

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

View File

@ -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 {

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.FunctionOperator;
import org.warp.picalculator.math.MathContext;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
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.MathContext;
import org.warp.picalculator.math.MathematicalSymbols;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
public class Multiplication extends FunctionOperator {

View File

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

View File

@ -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 {

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.FunctionDynamic;
import org.warp.picalculator.math.MathContext;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
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.FunctionSingle;
import org.warp.picalculator.math.MathContext;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
public class Sine extends FunctionSingle {

View File

@ -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) {

View File

@ -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();
/**

View File

@ -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];

View File

@ -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;
/**

View File

@ -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()) {