Completed the variable type menu and organized project imports

This commit is contained in:
Andrea Cavalli 2017-05-16 22:02:44 +02:00
parent 72e151b1e4
commit 234d43fe31
104 changed files with 416 additions and 311 deletions

View File

@ -2,15 +2,16 @@ package org.warp.picalculator;
import java.io.IOException; import java.io.IOException;
import org.warp.picalculator.gui.graphicengine.GraphicEngine;
import org.warp.picalculator.gui.graphicengine.Renderer;
import org.warp.picalculator.gui.graphicengine.RenderingLoop;
import org.warp.picalculator.device.Keyboard; import org.warp.picalculator.device.Keyboard;
import org.warp.picalculator.device.Keyboard.Key; import org.warp.picalculator.device.Keyboard.Key;
import org.warp.picalculator.device.KeyboardEventListener; import org.warp.picalculator.device.KeyboardEventListener;
import org.warp.picalculator.gui.expression.InputContext;
import org.warp.picalculator.gui.expression.blocks.BlockContainer; import org.warp.picalculator.gui.expression.blocks.BlockContainer;
import org.warp.picalculator.gui.expression.containers.NormalInputContainer; import org.warp.picalculator.gui.expression.containers.NormalInputContainer;
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.Renderer;
import org.warp.picalculator.gui.graphicengine.RenderingLoop;
import org.warp.picalculator.gui.graphicengine.Skin; import org.warp.picalculator.gui.graphicengine.Skin;
import org.warp.picalculator.gui.graphicengine.gpu.GPUEngine; import org.warp.picalculator.gui.graphicengine.gpu.GPUEngine;
import org.warp.picalculator.math.MathContext; import org.warp.picalculator.math.MathContext;
@ -109,6 +110,8 @@ public class TestGPU {
} catch (final Error e) { } catch (final Error e) {
e.printStackTrace(); e.printStackTrace();
} }
default:
break;
} }
return false; return false;
@ -121,7 +124,7 @@ public class TestGPU {
} }
}); });
final Scene s = new Scene(d); new Scene(d);
} }
private static NormalInputContainer c = null; private static NormalInputContainer c = null;
@ -146,7 +149,7 @@ public class TestGPU {
BlockContainer.initializeFonts(d.loadFont("ex"), d.loadFont("big")); BlockContainer.initializeFonts(d.loadFont("ex"), d.loadFont("big"));
//New expression framework test //New expression framework test
c = new NormalInputContainer(false, 0, 200); c = new NormalInputContainer(new InputContext(), false, 0, 200);
c.typeChar(MathematicalSymbols.DIVISION); c.typeChar(MathematicalSymbols.DIVISION);
c.typeChar('5'); c.typeChar('5');
c.typeChar(MathematicalSymbols.MULTIPLICATION); c.typeChar(MathematicalSymbols.MULTIPLICATION);

View File

@ -15,7 +15,6 @@ import java.lang.reflect.Modifier;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.BigInteger; import java.math.BigInteger;
import java.math.RoundingMode; import java.math.RoundingMode;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import java.util.List; import java.util.List;
import org.nevec.rjm.BigDecimalMath; import org.nevec.rjm.BigDecimalMath;
@ -23,8 +22,8 @@ import org.nevec.rjm.Rational;
import org.warp.picalculator.gui.DisplayManager; 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.FunctionSingle;
import org.warp.picalculator.math.FunctionOperator; import org.warp.picalculator.math.FunctionOperator;
import org.warp.picalculator.math.FunctionSingle;
import org.warp.picalculator.math.functions.Division; import org.warp.picalculator.math.functions.Division;
import org.warp.picalculator.math.functions.Expression; import org.warp.picalculator.math.functions.Expression;
import org.warp.picalculator.math.functions.Multiplication; import org.warp.picalculator.math.functions.Multiplication;
@ -37,6 +36,8 @@ import org.warp.picalculator.math.functions.Variable;
import org.warp.picalculator.math.functions.equations.Equation; import org.warp.picalculator.math.functions.equations.Equation;
import org.warp.picalculator.math.functions.equations.EquationsSystemPart; import org.warp.picalculator.math.functions.equations.EquationsSystemPart;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
public class Utils { public class Utils {
public static final int scale = 24; public static final int scale = 24;
@ -594,10 +595,11 @@ public class Utils {
return bd.signum() == 0 || bd.scale() <= 0 || bd.stripTrailingZeros().scale() <= 0; return bd.signum() == 0 || bd.scale() <= 0 || bd.stripTrailingZeros().scale() <= 0;
} }
@SafeVarargs
public static <T> String arrayToString(T... data) { public static <T> String arrayToString(T... data) {
String sdata = ""; String sdata = "";
for (final T o : data) { for (final T o : data) {
sdata += "," + o.toString(); sdata += "," + o;
} }
return sdata.substring(1); return sdata.substring(1);
} }

View File

@ -8,7 +8,6 @@ import org.warp.picalculator.device.chip.SerialToParallel;
import org.warp.picalculator.gui.DisplayManager; 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.Screen; import org.warp.picalculator.gui.screens.Screen;
import com.pi4j.wiringpi.Gpio; import com.pi4j.wiringpi.Gpio;

View File

@ -1,25 +1,25 @@
package org.warp.picalculator.gui; package org.warp.picalculator.gui;
import java.io.IOException; import java.io.IOException;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import org.warp.picalculator.Main; import org.warp.picalculator.Main;
import org.warp.picalculator.Utils; import org.warp.picalculator.Utils;
import org.warp.picalculator.device.Keyboard; import org.warp.picalculator.device.Keyboard;
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.Renderer; import org.warp.picalculator.gui.graphicengine.Renderer;
import org.warp.picalculator.gui.graphicengine.RenderingLoop;
import org.warp.picalculator.gui.graphicengine.Skin;
import org.warp.picalculator.gui.graphicengine.cpu.CPUEngine; import org.warp.picalculator.gui.graphicengine.cpu.CPUEngine;
import org.warp.picalculator.gui.graphicengine.gpu.GPUEngine; import org.warp.picalculator.gui.graphicengine.gpu.GPUEngine;
import org.warp.picalculator.gui.graphicengine.headless256.Headless8Engine; import org.warp.picalculator.gui.graphicengine.headless256.Headless8Engine;
import org.warp.picalculator.gui.graphicengine.headless8.Headless256Engine; import org.warp.picalculator.gui.graphicengine.headless8.Headless256Engine;
import org.warp.picalculator.gui.graphicengine.BinaryFont;
import org.warp.picalculator.gui.graphicengine.Skin;
import org.warp.picalculator.gui.screens.Screen; import org.warp.picalculator.gui.screens.Screen;
import com.pi4j.wiringpi.Gpio; import com.pi4j.wiringpi.Gpio;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
public final class DisplayManager implements RenderingLoop { public final class DisplayManager implements RenderingLoop {
public static DisplayManager INSTANCE; public static DisplayManager INSTANCE;
private static float brightness; private static float brightness;

View File

@ -1,11 +1,12 @@
package org.warp.picalculator.gui; package org.warp.picalculator.gui;
import org.warp.picalculator.Error;
import org.warp.picalculator.gui.graphicengine.GraphicEngine; import org.warp.picalculator.gui.graphicengine.GraphicEngine;
import org.warp.picalculator.gui.graphicengine.Renderer; import org.warp.picalculator.gui.graphicengine.Renderer;
import org.warp.picalculator.Error;
public class GUIErrorMessage { public class GUIErrorMessage {
@SuppressWarnings("unused")
private final String err; private final String err;
private final long creationTime; private final long creationTime;

View File

@ -17,6 +17,7 @@ public class GraphicUtils {
return cos[(int) (deg * degToIndex) & SIN_MASK]; return cos[(int) (deg * degToIndex) & SIN_MASK];
} }
@SuppressWarnings("unused")
private static final float RAD, DEG; private static final float RAD, DEG;
private static final int SIN_BITS, SIN_MASK, SIN_COUNT; private static final int SIN_BITS, SIN_MASK, SIN_COUNT;
private static final float radFull, radToIndex; private static final float radFull, radToIndex;

View File

@ -3,7 +3,6 @@ package org.warp.picalculator.gui.expression;
import java.io.Serializable; import java.io.Serializable;
import org.warp.picalculator.device.KeyboardEventListener; import org.warp.picalculator.device.KeyboardEventListener;
import org.warp.picalculator.gui.GraphicalElement;
import org.warp.picalculator.gui.expression.blocks.Block; import org.warp.picalculator.gui.expression.blocks.Block;
import org.warp.picalculator.gui.graphicengine.GraphicEngine; import org.warp.picalculator.gui.graphicengine.GraphicEngine;
import org.warp.picalculator.gui.graphicengine.Renderer; import org.warp.picalculator.gui.graphicengine.Renderer;

View File

@ -0,0 +1,19 @@
package org.warp.picalculator.gui.expression;
import java.util.HashMap;
import org.warp.picalculator.gui.expression.blocks.BlockVariable;
import org.warp.picalculator.math.functions.Variable.V_TYPE;
public class InputContext {
public final HashMap<Character, V_TYPE> variableTypes;
public BlockVariable variableTypeDirtyID = null;
public InputContext() {
this.variableTypes = new HashMap<>();
}
public InputContext(HashMap<Character, V_TYPE> variableTypes) {
this.variableTypes = variableTypes;
}
}

View File

@ -58,8 +58,8 @@ public abstract class Block implements GraphicalElement {
public abstract void setSmall(boolean small); public abstract void setSmall(boolean small);
public abstract int getClassID(); public abstract int getClassID();
public ExtraMenu getExtraMenu() { public ExtraMenu<?> getExtraMenu() {
return null; return null;
} }
} }

View File

@ -1,7 +1,5 @@
package org.warp.picalculator.gui.expression.blocks; package org.warp.picalculator.gui.expression.blocks;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
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;
@ -9,6 +7,8 @@ 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.Renderer; import org.warp.picalculator.gui.graphicengine.Renderer;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
public class BlockContainer implements GraphicalElement { public class BlockContainer implements GraphicalElement {
private static boolean initialized = false; private static boolean initialized = false;

View File

@ -1,7 +1,6 @@
package org.warp.picalculator.gui.expression.blocks; package org.warp.picalculator.gui.expression.blocks;
import org.warp.picalculator.gui.expression.Caret; import org.warp.picalculator.gui.expression.Caret;
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.Renderer; import org.warp.picalculator.gui.graphicengine.Renderer;

View File

@ -1,8 +1,6 @@
package org.warp.picalculator.gui.expression.blocks; package org.warp.picalculator.gui.expression.blocks;
import org.warp.picalculator.gui.expression.Caret; import org.warp.picalculator.gui.expression.Caret;
import org.warp.picalculator.gui.expression.blocks.Block;
import org.warp.picalculator.gui.expression.blocks.BlockContainer;
import org.warp.picalculator.gui.graphicengine.GraphicEngine; import org.warp.picalculator.gui.graphicengine.GraphicEngine;
import org.warp.picalculator.gui.graphicengine.Renderer; import org.warp.picalculator.gui.graphicengine.Renderer;
@ -53,7 +51,6 @@ public class BlockPower extends Block {
public void recomputeDimensions() { public void recomputeDimensions() {
final int w2 = containerExponent.getWidth(); final int w2 = containerExponent.getWidth();
final int h2 = containerExponent.getHeight(); final int h2 = containerExponent.getHeight();
final int l2 = containerExponent.getLine();
width = w2+1; width = w2+1;
height = h2+BlockContainer.getDefaultCharHeight(small)-3; height = h2+BlockContainer.getDefaultCharHeight(small)-3;
line = h2+BlockContainer.getDefaultCharHeight(small)/2-3; line = h2+BlockContainer.getDefaultCharHeight(small)/2-3;

View File

@ -4,31 +4,76 @@ import org.warp.picalculator.device.Keyboard.Key;
import org.warp.picalculator.gui.DisplayManager; 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.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.Renderer; import org.warp.picalculator.gui.graphicengine.Renderer;
import org.warp.picalculator.math.functions.Variable;
import org.warp.picalculator.math.functions.Variable.V_TYPE; import org.warp.picalculator.math.functions.Variable.V_TYPE;
public class BlockVariable extends Block { public class BlockVariable extends Block {
public static final int CLASS_ID = 0x00000007; public static final int CLASS_ID = 0x00000007;
private InputContext ic;
private final char ch; private final char ch;
private final VariableMenu menu; private final VariableMenu menu;
private V_TYPE type; private V_TYPE type;
private int color; private int color;
private boolean mustRefresh = true;
private BlockVariable typeDirtyID;
public BlockVariable(char ch) { public BlockVariable(InputContext ic, char ch) {
this.ic = ic;
this.ch = ch; this.ch = ch;
this.menu = new VariableMenu(this); this.menu = new VariableMenu(this);
this.type = V_TYPE.UNKNOWN; this.type = V_TYPE.UNKNOWN;
this.color = 0xFF304ffe; this.color = 0xFF304ffe;
this.typeDirtyID = this;
retrieveValue();
recomputeDimensions(); recomputeDimensions();
} }
private void retrieveValue() {
type = ic.variableTypes.getOrDefault(ch, V_TYPE.UNKNOWN);
typeDirtyID = ic.variableTypeDirtyID;
menu.mustRefreshMenu = true;
mustRefresh = true;
System.out.println("retrieve:"+type.toString());
}
public void pushValue() {
if (ic.variableTypeDirtyID != this) {
typeDirtyID = this;
ic.variableTypeDirtyID = this;
} else {
typeDirtyID = null;
ic.variableTypeDirtyID = null;
}
ic.variableTypes.put(ch, type);
System.out.println("push:"+type.toString());
}
@Override @Override
public void draw(GraphicEngine ge, Renderer r, int x, int y, Caret caret) { public void draw(GraphicEngine ge, Renderer r, int x, int y, Caret caret) {
if(ic.variableTypeDirtyID != typeDirtyID) {
retrieveValue();
}
if (mustRefresh) {
mustRefresh = false;
switch (type) {
case UNKNOWN:
color = 0xFF304ffe;
break;
case COEFFICIENT:
color = 0xFF35913F;
break;
case SOLUTION:
default:
color = 0xFFf50057;
break;
}
}
BlockContainer.getDefaultFont(small).use(ge); BlockContainer.getDefaultFont(small).use(ge);
r.glColor(color); r.glColor(color);
r.glDrawCharLeft(x, y, ch); r.glDrawCharLeft(x, y, ch);
@ -83,9 +128,8 @@ public class BlockVariable extends Block {
public class VariableMenu extends ExtraMenu<BlockVariable> { public class VariableMenu extends ExtraMenu<BlockVariable> {
boolean mustRefresh = true;
String text = ""; String text = "";
private int color; boolean mustRefreshMenu = true;
public VariableMenu(BlockVariable var) { public VariableMenu(BlockVariable var) {
super(var); super(var);
@ -100,7 +144,6 @@ public class BlockVariable extends Block {
@Override @Override
public void close() { public void close() {
} }
@Override @Override
@ -141,8 +184,10 @@ public class BlockVariable extends Block {
default: default:
return false; return false;
} }
block.pushValue();
mustRefresh = true; mustRefresh = true;
mustRefreshMenu = true;
return true; return true;
} }
@ -153,25 +198,14 @@ public class BlockVariable extends Block {
@Override @Override
public boolean beforeRender(float delta, Caret caret) { public boolean beforeRender(float delta, Caret caret) {
if (super.beforeRender(delta, caret)||mustRefresh) { if (mustRefreshMenu) {
mustRefresh = false; mustRefreshMenu = false;
switch (block.type) {
case UNKNOWN:
color = 0xFF304ffe;
break;
case COEFFICIENT:
color = 0xFFf50057;
break;
case SOLUTION:
default:
color = 0xFF64dd17;
break;
}
block.color = color;
text = block.type.toString(); text = block.type.toString();
BinaryFont f = BlockContainer.getDefaultFont(true); BinaryFont f = BlockContainer.getDefaultFont(true);
width = 2+f.getStringWidth(text)+2; width = 2+f.getStringWidth(text)+2;
height = 2+f.getCharacterHeight()+2; height = 2+f.getCharacterHeight()+2;
super.beforeRender(delta, caret);
return true; return true;
} }
return false; return false;
@ -181,9 +215,29 @@ public class BlockVariable extends Block {
public void draw(GraphicEngine ge, Renderer r, Caret caret) { public void draw(GraphicEngine ge, Renderer r, Caret caret) {
BlockContainer.getDefaultFont(true).use(ge); BlockContainer.getDefaultFont(true).use(ge);
r.glColor3f(1.0f, 1.0f, 1.0f); r.glColor3f(1.0f, 1.0f, 1.0f);
r.glFillColor(location[0], location[1], width, height); DisplayManager.guiSkin.use(ge);
int popupX = location[0];
int popupY = location[1];
if (popupX < 0) {
popupX = 0;
}
if (popupY < 0) {
popupY = 0;
}
int[] screenSize = ge.getSize();
if (popupX+width >= screenSize[0]) {
popupX=screenSize[0]-width-1;
}
if (popupY+height >= screenSize[1]) {
popupY=screenSize[1]-height-1;
}
r.glFillRect(location[0]+width/2-5, popupY+1, 10, 5, 163, 16, 10, 5);
r.glFillColor(popupX, popupY+5, width, height);
r.glFillColor(popupX+2, popupY+4, width-4, height+2);
r.glFillColor(popupX-1, popupY+7, width+2, height-4);
r.glColor(color); r.glColor(color);
r.glDrawStringCenter(location[0]+width/2, location[1]+2, text); r.glDrawStringCenter(popupX+width/2, popupY+2+5, text);
} }
} }

View File

@ -1,21 +1,32 @@
package org.warp.picalculator.gui.expression.containers; package org.warp.picalculator.gui.expression.containers;
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.BlockChar; import org.warp.picalculator.gui.expression.blocks.BlockChar;
import org.warp.picalculator.math.MathematicalSymbols; import org.warp.picalculator.math.MathematicalSymbols;
public class InlineInputContainer extends InputContainer { public class InlineInputContainer extends InputContainer {
private static final long serialVersionUID = 4307434049083324966L;
@Deprecated()
/**
* Use InlineInputContainer(InputContext) instead
*/
public InlineInputContainer() { public InlineInputContainer() {
super(); super();
} }
public InlineInputContainer(boolean small) { public InlineInputContainer(InputContext ic) {
super(small); super(ic);
} }
public InlineInputContainer(boolean small, int minWidth, int minHeight) { public InlineInputContainer(InputContext ic, boolean small) {
super(small, minWidth, minHeight); super(ic, small);
}
public InlineInputContainer(InputContext ic, boolean small, int minWidth, int minHeight) {
super(ic, small, minWidth, minHeight);
} }
@Override @Override

View File

@ -1,6 +1,5 @@
package org.warp.picalculator.gui.expression.containers; package org.warp.picalculator.gui.expression.containers;
import java.io.ObjectOutputStream;
import java.io.Serializable; import java.io.Serializable;
import org.warp.picalculator.device.KeyboardEventListener; import org.warp.picalculator.device.KeyboardEventListener;
@ -8,13 +7,13 @@ 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;
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.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;
import org.warp.picalculator.gui.expression.layouts.InputLayout; import org.warp.picalculator.gui.expression.layouts.InputLayout;
import org.warp.picalculator.gui.graphicengine.GraphicEngine; import org.warp.picalculator.gui.graphicengine.GraphicEngine;
import org.warp.picalculator.gui.graphicengine.Renderer; import org.warp.picalculator.gui.graphicengine.Renderer;
import it.unimi.dsi.fastutil.Arrays;
import it.unimi.dsi.fastutil.objects.ObjectArrayList; import it.unimi.dsi.fastutil.objects.ObjectArrayList;
public abstract class InputContainer implements GraphicalElement, InputLayout, Serializable { public abstract class InputContainer implements GraphicalElement, InputLayout, Serializable {
@ -26,18 +25,29 @@ public abstract class InputContainer implements GraphicalElement, InputLayout, S
private int maxPosition = 0; private int maxPosition = 0;
private boolean parsed = false; private boolean parsed = false;
private ExtraMenu<?> extra; private ExtraMenu<?> extra;
protected InputContext inputContext;
public synchronized InputContext getInputContext() {
return inputContext;
}
@Deprecated()
/**
* Use InputContainer(InputContext) instead
*/
public InputContainer() { public InputContainer() {
caret = new Caret(CaretState.VISIBLE_ON, 0); this(new InputContext());
root = new BlockContainer(false, false);
} }
public InputContainer(boolean small) { public InputContainer(InputContext ic) {
caret = new Caret(CaretState.VISIBLE_ON, 0); this(ic, false);
root = new BlockContainer(small, false);
} }
public InputContainer(boolean small, int minWidth, int minHeight) { public InputContainer(InputContext ic, boolean small) {
this(ic, small, 0, 0);
}
public InputContainer(InputContext ic, boolean small, int minWidth, int minHeight) {
inputContext = ic;
caret = new Caret(CaretState.VISIBLE_ON, 0); caret = new Caret(CaretState.VISIBLE_ON, 0);
root = new BlockContainer(small, false); root = new BlockContainer(small, false);
} }

View File

@ -1,5 +1,6 @@
package org.warp.picalculator.gui.expression.containers; package org.warp.picalculator.gui.expression.containers;
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.BlockChar; import org.warp.picalculator.gui.expression.blocks.BlockChar;
import org.warp.picalculator.gui.expression.blocks.BlockDivision; import org.warp.picalculator.gui.expression.blocks.BlockDivision;
@ -11,16 +12,26 @@ import org.warp.picalculator.math.MathematicalSymbols;
public class NormalInputContainer extends InputContainer { public class NormalInputContainer extends InputContainer {
private static final long serialVersionUID = 5236564695997222322L;
@Deprecated()
/**
* Use NormalInputContainer(InputContext) instead
*/
public NormalInputContainer() { public NormalInputContainer() {
super(); super();
} }
public NormalInputContainer(boolean small) { public NormalInputContainer(InputContext ic) {
super(small); super(ic);
} }
public NormalInputContainer(boolean small, int minWidth, int minHeight) { public NormalInputContainer(InputContext ic, boolean small) {
super(small, minWidth, minHeight); super(ic, small);
}
public NormalInputContainer(InputContext ic, boolean small, int minWidth, int minHeight) {
super(ic, small, minWidth, minHeight);
} }
@Override @Override
@ -55,7 +66,7 @@ public class NormalInputContainer extends InputContainer {
default: default:
for (char v : MathematicalSymbols.variables) { for (char v : MathematicalSymbols.variables) {
if (c == v) { if (c == v) {
return new BlockVariable(c); return new BlockVariable(inputContext, c);
} }
} }
return new BlockChar(c); return new BlockChar(c);

View File

@ -1,6 +1,9 @@
package org.warp.picalculator.gui.expression.containers; package org.warp.picalculator.gui.expression.containers;
public class NormalOutputContainer extends OutputContainer { public class NormalOutputContainer extends OutputContainer {
private static final long serialVersionUID = 5087850494875415142L;
public NormalOutputContainer() { public NormalOutputContainer() {
super(); super();
} }

View File

@ -8,11 +8,11 @@ import java.io.IOException;
import org.warp.picalculator.Main; import org.warp.picalculator.Main;
import org.warp.picalculator.Utils; import org.warp.picalculator.Utils;
import org.warp.picalculator.gui.DisplayManager; import org.warp.picalculator.gui.DisplayManager;
import org.warp.picalculator.gui.graphicengine.GraphicEngine;
import org.warp.picalculator.gui.graphicengine.RenderingLoop;
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.GraphicEngine;
import org.warp.picalculator.gui.graphicengine.Renderer; import org.warp.picalculator.gui.graphicengine.Renderer;
import org.warp.picalculator.gui.graphicengine.RenderingLoop;
import org.warp.picalculator.gui.graphicengine.Skin;
public class CPUEngine implements GraphicEngine { public class CPUEngine implements GraphicEngine {
@ -311,20 +311,28 @@ public class CPUEngine implements GraphicEngine {
final int iw = (int) width; final int iw = (int) width;
final int ih = (int) height; final int ih = (int) height;
int x0 = ix;
int y0 = iy;
int x1 = ix + iw; int x1 = ix + iw;
int y1 = iy + ih; int y1 = iy + ih;
if (ix >= size[0] || iy >= size[0]) { if (ix >= size[0] || iy >= size[0]) {
return; return;
} }
if (x0 < 0) {
x0 = 0;
}
if (x1 >= size[0]) { if (x1 >= size[0]) {
x1 = size[0]; x1 = size[0];
} }
if (y0 < 0) {
y0 = 0;
}
if (y1 >= size[1]) { if (y1 >= size[1]) {
y1 = size[1]; y1 = size[1];
} }
final int sizeW = size[0]; final int sizeW = size[0];
for (int px = ix; px < x1; px++) { for (int px = x0; px < x1; px++) {
for (int py = iy; py < y1; py++) { for (int py = y0; py < y1; py++) {
canvas2d[(px) + (py) * sizeW] = color; canvas2d[(px) + (py) * sizeW] = color;
} }
} }

View File

@ -12,8 +12,8 @@ import java.util.logging.Logger;
import javax.imageio.ImageIO; import javax.imageio.ImageIO;
import org.warp.picalculator.Utils; import org.warp.picalculator.Utils;
import org.warp.picalculator.gui.graphicengine.GraphicEngine;
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.cpu.CPUEngine.CPURenderer; import org.warp.picalculator.gui.graphicengine.cpu.CPUEngine.CPURenderer;
public class CPUFont implements BinaryFont { public class CPUFont implements BinaryFont {
@ -161,9 +161,9 @@ public class CPUFont implements BinaryFont {
@Override @Override
public int getStringWidth(String text) { public int getStringWidth(String text) {
final int w = (charW) * text.length(); final int w = (charW+1) * text.length();
if (text.length() > 0) { if (text.length() > 0 && w > 0) {
return w; return w-1;
} else { } else {
return 0; return 0;
} }

View File

@ -24,7 +24,6 @@ import java.nio.FloatBuffer;
import java.nio.IntBuffer; import java.nio.IntBuffer;
import java.nio.LongBuffer; import java.nio.LongBuffer;
import java.nio.ShortBuffer; import java.nio.ShortBuffer;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
@ -34,6 +33,8 @@ import java.util.Set;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
/** /**
* Helper to deallocate memory on the native heap allocated during the creation * Helper to deallocate memory on the native heap allocated during the creation
* of a direct byte buffer. It supports numerous virtual machines including * of a direct byte buffer. It supports numerous virtual machines including

View File

@ -4,8 +4,8 @@ import java.io.IOException;
import org.warp.picalculator.Main; import org.warp.picalculator.Main;
import org.warp.picalculator.Utils; import org.warp.picalculator.Utils;
import org.warp.picalculator.gui.graphicengine.RenderingLoop;
import org.warp.picalculator.gui.graphicengine.BinaryFont; import org.warp.picalculator.gui.graphicengine.BinaryFont;
import org.warp.picalculator.gui.graphicengine.RenderingLoop;
import org.warp.picalculator.gui.graphicengine.Skin; import org.warp.picalculator.gui.graphicengine.Skin;
import com.jogamp.opengl.GLProfile; import com.jogamp.opengl.GLProfile;
@ -125,6 +125,7 @@ public class GPUEngine implements org.warp.picalculator.gui.graphicengine.Graphi
@Override @Override
public boolean isSupported() { public boolean isSupported() {
if (Utils.debugOn) return false;
boolean available = false; boolean available = false;
boolean errored = false; boolean errored = false;
try { try {

View File

@ -3,8 +3,8 @@ package org.warp.picalculator.gui.graphicengine.gpu;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import java.io.IOException; import java.io.IOException;
import org.warp.picalculator.gui.graphicengine.GraphicEngine;
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.cpu.CPUFont; import org.warp.picalculator.gui.graphicengine.cpu.CPUFont;
import com.jogamp.opengl.GLException; import com.jogamp.opengl.GLException;

View File

@ -8,6 +8,7 @@ import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.nio.Buffer; import java.nio.Buffer;
import java.nio.FloatBuffer; import java.nio.FloatBuffer;
import javax.imageio.ImageIO; import javax.imageio.ImageIO;
import org.warp.picalculator.gui.graphicengine.BinaryFont; import org.warp.picalculator.gui.graphicengine.BinaryFont;
@ -200,7 +201,6 @@ public class GPURenderer implements Renderer {
} }
static BufferedImage openTexture(String file) throws GLException, IOException { static BufferedImage openTexture(String file) throws GLException, IOException {
final ByteArrayOutputStream os = new ByteArrayOutputStream();
return ImageIO.read(GPURenderer.class.getClassLoader().getResource(file)); return ImageIO.read(GPURenderer.class.getClassLoader().getResource(file));
} }

View File

@ -2,6 +2,7 @@ package org.warp.picalculator.gui.graphicengine.gpu;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import java.io.IOException; import java.io.IOException;
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;

View File

@ -28,28 +28,27 @@
package org.warp.picalculator.gui.graphicengine.gpu; package org.warp.picalculator.gui.graphicengine.gpu;
import com.jogamp.opengl.GL; import org.warp.picalculator.Utils;
import com.jogamp.opengl.GL2ES1; import org.warp.picalculator.device.Keyboard;
import com.jogamp.opengl.GLAutoDrawable; import org.warp.picalculator.device.Keyboard.Key;
import com.jogamp.opengl.GLEventListener; import org.warp.picalculator.gui.DisplayManager;
import com.jogamp.opengl.GLProfile;
import com.jogamp.opengl.fixedfunc.GLLightingFunc;
import com.jogamp.opengl.fixedfunc.GLMatrixFunc;
import com.jogamp.opengl.fixedfunc.GLPointerFunc;
import com.jogamp.opengl.GLCapabilities;
import com.jogamp.newt.event.KeyEvent; import com.jogamp.newt.event.KeyEvent;
import com.jogamp.newt.event.KeyListener; import com.jogamp.newt.event.KeyListener;
import com.jogamp.newt.event.WindowEvent; import com.jogamp.newt.event.WindowEvent;
import com.jogamp.newt.event.WindowListener; import com.jogamp.newt.event.WindowListener;
import com.jogamp.newt.event.WindowUpdateEvent; import com.jogamp.newt.event.WindowUpdateEvent;
import com.jogamp.newt.opengl.GLWindow; import com.jogamp.newt.opengl.GLWindow;
import com.jogamp.opengl.GL;
import com.jogamp.opengl.util.*; import com.jogamp.opengl.GL2ES1;
import com.jogamp.opengl.GLAutoDrawable;
import org.warp.picalculator.Utils; import com.jogamp.opengl.GLCapabilities;
import org.warp.picalculator.device.Keyboard; import com.jogamp.opengl.GLEventListener;
import org.warp.picalculator.device.Keyboard.Key; import com.jogamp.opengl.GLProfile;
import org.warp.picalculator.gui.DisplayManager; import com.jogamp.opengl.fixedfunc.GLLightingFunc;
import com.jogamp.opengl.fixedfunc.GLMatrixFunc;
import com.jogamp.opengl.fixedfunc.GLPointerFunc;
import com.jogamp.opengl.util.Animator;
/** /**
* *
@ -310,20 +309,12 @@ class NEWTWindow implements GLEventListener {
disp.size[0] = (Utils.debugOn & Utils.debugWindow2x) ? width / 2 : width; disp.size[0] = (Utils.debugOn & Utils.debugWindow2x) ? width / 2 : width;
disp.size[1] = (Utils.debugOn & Utils.debugWindow2x) ? height / 2 : height; disp.size[1] = (Utils.debugOn & Utils.debugWindow2x) ? height / 2 : height;
final GL2ES1 gl = glad.getGL().getGL2ES1(); final GL2ES1 gl = glad.getGL().getGL2ES1();
float max_wh, min_wh;
if (width == 0) { if (width == 0) {
width = 1; width = 1;
} }
if (height == 0) { if (height == 0) {
height = 1; height = 1;
} }
if (width > height) {
max_wh = width;
min_wh = height;
} else {
max_wh = height;
min_wh = width;
}
gl.glViewport(0, 0, width, height); gl.glViewport(0, 0, width, height);
@ -362,7 +353,7 @@ class NEWTWindow implements GLEventListener {
@Override @Override
public void dispose(GLAutoDrawable drawable) { public void dispose(GLAutoDrawable drawable) {
System.out.println("cleanup"); System.out.println("cleanup");
final GL2ES1 gl = drawable.getGL().getGL2ES1(); // final GL2ES1 gl = drawable.getGL().getGL2ES1();
System.exit(0); System.exit(0);
} }

View File

@ -1,14 +1,12 @@
package org.warp.picalculator.gui.graphicengine.headless256; package org.warp.picalculator.gui.graphicengine.headless256;
import java.io.IOException; import java.io.IOException;
import java.util.Arrays;
import java.util.logging.ConsoleHandler; import java.util.logging.ConsoleHandler;
import org.fusesource.jansi.AnsiConsole; import org.fusesource.jansi.AnsiConsole;
import org.warp.picalculator.Main; import org.warp.picalculator.Main;
import org.warp.picalculator.gui.graphicengine.Renderer; import org.warp.picalculator.gui.graphicengine.Renderer;
import org.warp.picalculator.gui.graphicengine.RenderingLoop; import org.warp.picalculator.gui.graphicengine.RenderingLoop;
import org.warp.picalculator.gui.graphicengine.Skin;
public class Headless8Engine implements org.warp.picalculator.gui.graphicengine.GraphicEngine { public class Headless8Engine implements org.warp.picalculator.gui.graphicengine.GraphicEngine {
@ -23,7 +21,7 @@ public class Headless8Engine implements org.warp.picalculator.gui.graphicengine.
@Override @Override
public int[] getSize() { public int[] getSize() {
ConsoleHandler ch = new ConsoleHandler(); new ConsoleHandler();
return new int[]{C_WIDTH, C_HEIGHT}; return new int[]{C_WIDTH, C_HEIGHT};
} }

View File

@ -1,6 +1,5 @@
package org.warp.picalculator.gui.graphicengine.headless256; package org.warp.picalculator.gui.graphicengine.headless256;
import org.warp.picalculator.Main;
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,6 +1,5 @@
package org.warp.picalculator.gui.graphicengine.headless256; package org.warp.picalculator.gui.graphicengine.headless256;
import java.awt.Graphics2D;
import java.awt.geom.AffineTransform; import java.awt.geom.AffineTransform;
import java.awt.image.AffineTransformOp; import java.awt.image.AffineTransformOp;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
@ -10,7 +9,6 @@ import javax.imageio.ImageIO;
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;
import org.warp.picalculator.gui.graphicengine.cpu.CPUEngine.CPURenderer;
public class Headless8Skin implements Skin { public class Headless8Skin implements Skin {

View File

@ -1,14 +1,12 @@
package org.warp.picalculator.gui.graphicengine.headless8; package org.warp.picalculator.gui.graphicengine.headless8;
import java.io.IOException; import java.io.IOException;
import java.util.Arrays;
import java.util.logging.ConsoleHandler; import java.util.logging.ConsoleHandler;
import org.fusesource.jansi.AnsiConsole; import org.fusesource.jansi.AnsiConsole;
import org.warp.picalculator.Main; import org.warp.picalculator.Main;
import org.warp.picalculator.gui.graphicengine.Renderer; import org.warp.picalculator.gui.graphicengine.Renderer;
import org.warp.picalculator.gui.graphicengine.RenderingLoop; import org.warp.picalculator.gui.graphicengine.RenderingLoop;
import org.warp.picalculator.gui.graphicengine.Skin;
public class Headless256Engine implements org.warp.picalculator.gui.graphicengine.GraphicEngine { public class Headless256Engine implements org.warp.picalculator.gui.graphicengine.GraphicEngine {
@ -23,7 +21,7 @@ public class Headless256Engine implements org.warp.picalculator.gui.graphicengin
@Override @Override
public int[] getSize() { public int[] getSize() {
ConsoleHandler ch = new ConsoleHandler(); new ConsoleHandler();
return new int[]{C_WIDTH, C_HEIGHT}; return new int[]{C_WIDTH, C_HEIGHT};
} }

View File

@ -1,6 +1,5 @@
package org.warp.picalculator.gui.graphicengine.headless8; package org.warp.picalculator.gui.graphicengine.headless8;
import org.warp.picalculator.Main;
import org.warp.picalculator.gui.graphicengine.Renderer; import org.warp.picalculator.gui.graphicengine.Renderer;
public class Headless256Renderer implements Renderer { public class Headless256Renderer implements Renderer {
@ -253,7 +252,6 @@ public class Headless256Renderer implements Renderer {
private void glDrawSkin(int x0, int y0, int s0, int t0, int s1, int t1, boolean transparent) { private void glDrawSkin(int x0, int y0, int s0, int t0, int s1, int t1, boolean transparent) {
int oldColor;
int newColor; int newColor;
final int onex = s0 <= s1 ? 1 : -1; final int onex = s0 <= s1 ? 1 : -1;
final int oney = t0 <= t1 ? 1 : -1; final int oney = t0 <= t1 ? 1 : -1;
@ -306,7 +304,6 @@ public class Headless256Renderer implements Renderer {
pixelY = (y0 + texy * oney + height); pixelY = (y0 + texy * oney + height);
if (pixelY < Headless256Engine.C_HEIGHT) { if (pixelY < Headless256Engine.C_HEIGHT) {
if (pixelX - (pixelX % Headless256Engine.C_WIDTH) == 0) { if (pixelX - (pixelX % Headless256Engine.C_WIDTH) == 0) {
int bgColor = bgColorMatrix[pixelX + pixelY * Headless256Engine.C_WIDTH];
newColor = currentSkin.skinData[(s0 + texx) + (t0 + texy) * currentSkin.skinSize[0]]; newColor = currentSkin.skinData[(s0 + texx) + (t0 + texy) * currentSkin.skinSize[0]];
if (transparent && !((newColor&TRANSPARENT) == TRANSPARENT)) { if (transparent && !((newColor&TRANSPARENT) == TRANSPARENT)) {
charmatrix[pixelX + pixelY * Headless256Engine.C_WIDTH] = ' '; charmatrix[pixelX + pixelY * Headless256Engine.C_WIDTH] = ' ';

View File

@ -1,6 +1,5 @@
package org.warp.picalculator.gui.graphicengine.headless8; package org.warp.picalculator.gui.graphicengine.headless8;
import java.awt.Graphics2D;
import java.awt.geom.AffineTransform; import java.awt.geom.AffineTransform;
import java.awt.image.AffineTransformOp; import java.awt.image.AffineTransformOp;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
@ -10,7 +9,6 @@ import javax.imageio.ImageIO;
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;
import org.warp.picalculator.gui.graphicengine.cpu.CPUEngine.CPURenderer;
public class Headless256Skin implements Skin { public class Headless256Skin implements Skin {

View File

@ -10,8 +10,6 @@ public class LoadingScreen extends Screen {
public float endLoading; public float endLoading;
boolean mustRefresh = true; boolean mustRefresh = true;
public float loadingTextTranslation = 0.0f; public float loadingTextTranslation = 0.0f;
private boolean loading;
private static final String titleString = "Andrea Cavalli's Algebraic Calculator";
public LoadingScreen() { public LoadingScreen() {
super(); super();
@ -32,7 +30,6 @@ public class LoadingScreen extends Screen {
endLoading += dt; endLoading += dt;
if (endLoading >= 5f) { if (endLoading >= 5f) {
loading = false;
DisplayManager.INSTANCE.setScreen(new MathInputScreen()); DisplayManager.INSTANCE.setScreen(new MathInputScreen());
} }
mustRefresh = true; mustRefresh = true;

View File

@ -2,7 +2,6 @@ package org.warp.picalculator.gui.screens;
import java.io.IOException; import java.io.IOException;
import org.warp.picalculator.Main;
import org.warp.picalculator.device.Keyboard; import org.warp.picalculator.device.Keyboard;
import org.warp.picalculator.device.Keyboard.Key; import org.warp.picalculator.device.Keyboard.Key;
import org.warp.picalculator.gui.DisplayManager; import org.warp.picalculator.gui.DisplayManager;

View File

@ -3,9 +3,6 @@ package org.warp.picalculator.gui.screens;
import java.io.IOException; import java.io.IOException;
import java.io.PrintWriter; import java.io.PrintWriter;
import java.io.StringWriter; import java.io.StringWriter;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import sun.reflect.generics.reflectiveObjects.NotImplementedException;
import java.util.Collections; import java.util.Collections;
import java.util.LinkedHashSet; import java.util.LinkedHashSet;
import java.util.List; import java.util.List;
@ -17,6 +14,7 @@ import org.warp.picalculator.Utils;
import org.warp.picalculator.device.Keyboard; import org.warp.picalculator.device.Keyboard;
import org.warp.picalculator.device.Keyboard.Key; import org.warp.picalculator.device.Keyboard.Key;
import org.warp.picalculator.gui.DisplayManager; 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.Block;
import org.warp.picalculator.gui.expression.blocks.BlockContainer; import org.warp.picalculator.gui.expression.blocks.BlockContainer;
import org.warp.picalculator.gui.expression.containers.InputContainer; import org.warp.picalculator.gui.expression.containers.InputContainer;
@ -26,22 +24,25 @@ import org.warp.picalculator.gui.expression.containers.OutputContainer;
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;
import org.warp.picalculator.math.AngleMode; import org.warp.picalculator.math.AngleMode;
import org.warp.picalculator.math.MathContext;
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.FunctionSingle;
import org.warp.picalculator.math.FunctionOperator; import org.warp.picalculator.math.FunctionOperator;
import org.warp.picalculator.math.FunctionSingle;
import org.warp.picalculator.math.MathContext;
import org.warp.picalculator.math.MathematicalSymbols; import org.warp.picalculator.math.MathematicalSymbols;
import org.warp.picalculator.math.functions.Expression;
import org.warp.picalculator.math.functions.Number;
import org.warp.picalculator.math.functions.Variable; import org.warp.picalculator.math.functions.Variable;
import org.warp.picalculator.math.functions.Variable.VariableValue; import org.warp.picalculator.math.functions.Variable.VariableValue;
import org.warp.picalculator.math.functions.equations.Equation; import org.warp.picalculator.math.functions.equations.Equation;
import org.warp.picalculator.math.parser.MathParser; import org.warp.picalculator.math.parser.MathParser;
import org.warp.picalculator.math.functions.Expression;
import org.warp.picalculator.math.functions.Number; import it.unimi.dsi.fastutil.objects.ObjectArrayList;
public class MathInputScreen extends Screen { public class MathInputScreen extends Screen {
public MathContext calc; public MathContext calc;
public InputContext ic;
public InputContainer userInput; public InputContainer userInput;
public OutputContainer result; public OutputContainer result;
public int errorLevel = 0; // 0 = nessuno, 1 = risultato, 2 = tutto public int errorLevel = 0; // 0 = nessuno, 1 = risultato, 2 = tutto
@ -54,6 +55,7 @@ public class MathInputScreen extends Screen {
@Override @Override
public void created() throws InterruptedException { public void created() throws InterruptedException {
ic = new InputContext();
calc = new MathContext(); calc = new MathContext();
try { try {
@ -63,7 +65,7 @@ public class MathInputScreen extends Screen {
System.exit(1); System.exit(1);
} }
userInput = new NormalInputContainer(); userInput = new NormalInputContainer(ic);
result = new NormalOutputContainer(); result = new NormalOutputContainer();
calc.init(); calc.init();
@ -523,7 +525,7 @@ public class MathInputScreen extends Screen {
@SuppressWarnings("unused") @SuppressWarnings("unused")
@Deprecated @Deprecated
private void changeEquationScreen() { private void changeEquationScreen() {
throw new NotImplementedException(); throw new UnsupportedOperationException();
// //
// if (!userInput.isEmpty()) { // if (!userInput.isEmpty()) {
// final MathInputScreen cloned = clone(); // final MathInputScreen cloned = clone();
@ -627,7 +629,7 @@ public class MathInputScreen extends Screen {
@Override @Override
@Deprecated @Deprecated
public MathInputScreen clone() { public MathInputScreen clone() {
throw new NotImplementedException(); throw new UnsupportedOperationException();
// final MathInputScreen es = this; // final MathInputScreen es = this;
// final MathInputScreen es2 = new MathInputScreen(); // final MathInputScreen es2 = new MathInputScreen();
// es2.errorLevel = es.errorLevel; // es2.errorLevel = es.errorLevel;

View File

@ -1,7 +1,6 @@
package org.warp.picalculator.gui.screens; package org.warp.picalculator.gui.screens;
import org.warp.picalculator.device.KeyboardEventListener; import org.warp.picalculator.device.KeyboardEventListener;
import org.warp.picalculator.device.Keyboard.Key;
import org.warp.picalculator.gui.DisplayManager; import org.warp.picalculator.gui.DisplayManager;
public abstract class Screen implements KeyboardEventListener { public abstract class Screen implements KeyboardEventListener {

View File

@ -1,12 +1,13 @@
package org.warp.picalculator.math; package org.warp.picalculator.math;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import org.warp.picalculator.Error; import org.warp.picalculator.Error;
import org.warp.picalculator.Utils; import org.warp.picalculator.Utils;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
public abstract class FunctionDynamic implements Function { public abstract class FunctionDynamic implements Function {
public FunctionDynamic(MathContext root) { public FunctionDynamic(MathContext root) {
this.root = root; this.root = root;

View File

@ -1,10 +1,10 @@
package org.warp.picalculator.math; package org.warp.picalculator.math;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import org.warp.picalculator.Error; import org.warp.picalculator.Error;
import org.warp.picalculator.Utils; import org.warp.picalculator.Utils;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
public abstract class FunctionOperator implements Function { public abstract class FunctionOperator implements Function {
/** /**

View File

@ -1,9 +1,9 @@
package org.warp.picalculator.math; package org.warp.picalculator.math;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import org.warp.picalculator.Error; import org.warp.picalculator.Error;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
public abstract class FunctionSingle implements Function { public abstract class FunctionSingle implements Function {
/** /**

View File

@ -2,6 +2,7 @@ package org.warp.picalculator.math;
import java.math.BigInteger; import java.math.BigInteger;
import java.util.List; import java.util.List;
import org.warp.picalculator.Error; import org.warp.picalculator.Error;
import org.warp.picalculator.Errors; import org.warp.picalculator.Errors;
import org.warp.picalculator.Utils; import org.warp.picalculator.Utils;
@ -12,7 +13,6 @@ import org.warp.picalculator.math.functions.equations.Equation;
import org.warp.picalculator.math.functions.equations.EquationsSystem; import org.warp.picalculator.math.functions.equations.EquationsSystem;
import it.unimi.dsi.fastutil.objects.ObjectArrayList; import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import sun.reflect.generics.reflectiveObjects.NotImplementedException;
public class MathContext { public class MathContext {
@ -133,6 +133,6 @@ public class MathContext {
// mc.variablesValues = this.variablesValues; // mc.variablesValues = this.variablesValues;
// mc.resultsCount = this.resultsCount; // mc.resultsCount = this.resultsCount;
// return mc; // return mc;
throw new NotImplementedException(); throw new UnsupportedOperationException();
} }
} }

View File

@ -1,9 +1,9 @@
package org.warp.picalculator.math; package org.warp.picalculator.math;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import org.warp.picalculator.math.functions.equations.Equation; import org.warp.picalculator.math.functions.equations.Equation;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
public interface SolveMethod { public interface SolveMethod {
public static final SolveMethod[] techniques = new SolveMethod[] {}; public static final SolveMethod[] techniques = new SolveMethod[] {};

View File

@ -1,11 +1,9 @@
package org.warp.picalculator.math.functions; package org.warp.picalculator.math.functions;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import org.warp.picalculator.Error; import org.warp.picalculator.Error;
import org.warp.picalculator.math.MathContext;
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.rules.FractionsRule1; import org.warp.picalculator.math.rules.FractionsRule1;
import org.warp.picalculator.math.rules.FractionsRule11; import org.warp.picalculator.math.rules.FractionsRule11;
import org.warp.picalculator.math.rules.FractionsRule12; import org.warp.picalculator.math.rules.FractionsRule12;
@ -13,6 +11,8 @@ import org.warp.picalculator.math.rules.FractionsRule2;
import org.warp.picalculator.math.rules.FractionsRule3; import org.warp.picalculator.math.rules.FractionsRule3;
import org.warp.picalculator.math.rules.UndefinedRule2; import org.warp.picalculator.math.rules.UndefinedRule2;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
public class Division extends FunctionOperator { public class Division extends FunctionOperator {
public Division(MathContext root, Function value1, Function value2) { public Division(MathContext root, Function value1, Function value2) {

View File

@ -1,9 +1,10 @@
package org.warp.picalculator.math.functions; package org.warp.picalculator.math.functions;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import org.warp.picalculator.Error; import org.warp.picalculator.Error;
import org.warp.picalculator.math.MathContext;
import org.warp.picalculator.math.Function; import org.warp.picalculator.math.Function;
import org.warp.picalculator.math.MathContext;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
public class EmptyNumber implements Function { public class EmptyNumber implements Function {

View File

@ -4,7 +4,6 @@ import static org.warp.picalculator.Utils.ArrayToRegex;
import static org.warp.picalculator.Utils.concat; import static org.warp.picalculator.Utils.concat;
import java.math.BigDecimal; import java.math.BigDecimal;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import java.util.List; import java.util.List;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
@ -12,11 +11,11 @@ import java.util.regex.Pattern;
import org.warp.picalculator.Error; import org.warp.picalculator.Error;
import org.warp.picalculator.Errors; import org.warp.picalculator.Errors;
import org.warp.picalculator.Utils; import org.warp.picalculator.Utils;
import org.warp.picalculator.math.MathContext;
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.FunctionSingle;
import org.warp.picalculator.math.FunctionOperator; import org.warp.picalculator.math.FunctionOperator;
import org.warp.picalculator.math.FunctionSingle;
import org.warp.picalculator.math.MathContext;
import org.warp.picalculator.math.MathematicalSymbols; import org.warp.picalculator.math.MathematicalSymbols;
import org.warp.picalculator.math.functions.trigonometry.ArcCosine; import org.warp.picalculator.math.functions.trigonometry.ArcCosine;
import org.warp.picalculator.math.functions.trigonometry.ArcSine; import org.warp.picalculator.math.functions.trigonometry.ArcSine;
@ -25,6 +24,8 @@ import org.warp.picalculator.math.functions.trigonometry.Cosine;
import org.warp.picalculator.math.functions.trigonometry.Sine; import org.warp.picalculator.math.functions.trigonometry.Sine;
import org.warp.picalculator.math.functions.trigonometry.Tangent; import org.warp.picalculator.math.functions.trigonometry.Tangent;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
public class Expression extends FunctionDynamic { public class Expression extends FunctionDynamic {
public Expression(MathContext root) { public Expression(MathContext root) {

View File

@ -1,16 +1,19 @@
package org.warp.picalculator.math.functions; package org.warp.picalculator.math.functions;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import org.warp.picalculator.Error; import org.warp.picalculator.Error;
import org.warp.picalculator.math.MathContext;
import org.warp.picalculator.math.Function; import org.warp.picalculator.math.Function;
import org.warp.picalculator.math.MathContext;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
public class Joke implements Function { public class Joke implements Function {
public static final byte FISH = 0; public static final byte FISH = 0;
public static final byte TORNADO = 1; public static final byte TORNADO = 1;
public static final byte SHARKNADO = 2; public static final byte SHARKNADO = 2;
@SuppressWarnings("unused")
private static final String[] jokes = new String[] { "", "TORNADO", "SHARKNADO" }; private static final String[] jokes = new String[] { "", "TORNADO", "SHARKNADO" };
@SuppressWarnings("unused")
private static final int[] jokesFont = new int[] { 4, -1, -1 }; private static final int[] jokesFont = new int[] { 4, -1, -1 };
private final byte joke; private final byte joke;
private final MathContext root; private final MathContext root;

View File

@ -1,11 +1,9 @@
package org.warp.picalculator.math.functions; package org.warp.picalculator.math.functions;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import org.warp.picalculator.Error; import org.warp.picalculator.Error;
import org.warp.picalculator.math.MathContext;
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.rules.ExponentRule15; import org.warp.picalculator.math.rules.ExponentRule15;
import org.warp.picalculator.math.rules.ExponentRule16; import org.warp.picalculator.math.rules.ExponentRule16;
import org.warp.picalculator.math.rules.FractionsRule14; import org.warp.picalculator.math.rules.FractionsRule14;
@ -15,6 +13,8 @@ import org.warp.picalculator.math.rules.NumberRule6;
import org.warp.picalculator.math.rules.SyntaxRule1; import org.warp.picalculator.math.rules.SyntaxRule1;
import org.warp.picalculator.math.rules.methods.MultiplicationMethod1; import org.warp.picalculator.math.rules.methods.MultiplicationMethod1;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
public class Multiplication extends FunctionOperator { public class Multiplication extends FunctionOperator {
public Multiplication(MathContext root, Function value1, Function value2) { public Multiplication(MathContext root, Function value1, Function value2) {

View File

@ -1,15 +1,15 @@
package org.warp.picalculator.math.functions; package org.warp.picalculator.math.functions;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import org.warp.picalculator.Error; import org.warp.picalculator.Error;
import org.warp.picalculator.Errors; import org.warp.picalculator.Errors;
import org.warp.picalculator.math.MathContext;
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.rules.ExpandRule1; import org.warp.picalculator.math.rules.ExpandRule1;
import org.warp.picalculator.math.rules.ExpandRule5; import org.warp.picalculator.math.rules.ExpandRule5;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
public class Negative extends FunctionSingle { public class Negative extends FunctionSingle {
public Negative(MathContext root, Function value) { public Negative(MathContext root, Function value) {

View File

@ -2,15 +2,16 @@ package org.warp.picalculator.math.functions;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.BigInteger; import java.math.BigInteger;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
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;
import org.warp.picalculator.math.MathContext;
import org.warp.picalculator.math.Function; import org.warp.picalculator.math.Function;
import org.warp.picalculator.math.MathContext;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
public class Number implements Function { public class Number implements Function {

View File

@ -1,11 +1,9 @@
package org.warp.picalculator.math.functions; package org.warp.picalculator.math.functions;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import org.warp.picalculator.Error; import org.warp.picalculator.Error;
import org.warp.picalculator.math.MathContext;
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.rules.ExponentRule1; import org.warp.picalculator.math.rules.ExponentRule1;
import org.warp.picalculator.math.rules.ExponentRule2; import org.warp.picalculator.math.rules.ExponentRule2;
import org.warp.picalculator.math.rules.ExponentRule3; import org.warp.picalculator.math.rules.ExponentRule3;
@ -15,6 +13,8 @@ import org.warp.picalculator.math.rules.FractionsRule4;
import org.warp.picalculator.math.rules.FractionsRule5; import org.warp.picalculator.math.rules.FractionsRule5;
import org.warp.picalculator.math.rules.UndefinedRule1; import org.warp.picalculator.math.rules.UndefinedRule1;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
public class Power extends FunctionOperator { public class Power extends FunctionOperator {
public Power(MathContext root, Function value1, Function value2) { public Power(MathContext root, Function value1, Function value2) {

View File

@ -2,12 +2,13 @@ package org.warp.picalculator.math.functions;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.BigInteger; import java.math.BigInteger;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import org.warp.picalculator.Error; import org.warp.picalculator.Error;
import org.warp.picalculator.math.MathContext;
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 it.unimi.dsi.fastutil.objects.ObjectArrayList;
public class Root extends FunctionOperator { public class Root extends FunctionOperator {

View File

@ -1,12 +1,13 @@
package org.warp.picalculator.math.functions; package org.warp.picalculator.math.functions;
import java.math.BigInteger; import java.math.BigInteger;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import org.warp.picalculator.Error; import org.warp.picalculator.Error;
import org.warp.picalculator.math.MathContext;
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 it.unimi.dsi.fastutil.objects.ObjectArrayList;
public class RootSquare extends FunctionSingle { public class RootSquare extends FunctionSingle {

View File

@ -1,11 +1,9 @@
package org.warp.picalculator.math.functions; package org.warp.picalculator.math.functions;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import org.warp.picalculator.Error; import org.warp.picalculator.Error;
import org.warp.picalculator.math.MathContext;
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.rules.ExpandRule1; import org.warp.picalculator.math.rules.ExpandRule1;
import org.warp.picalculator.math.rules.ExpandRule5; import org.warp.picalculator.math.rules.ExpandRule5;
import org.warp.picalculator.math.rules.NumberRule3; import org.warp.picalculator.math.rules.NumberRule3;
@ -15,6 +13,8 @@ import org.warp.picalculator.math.rules.VariableRule2;
import org.warp.picalculator.math.rules.VariableRule3; import org.warp.picalculator.math.rules.VariableRule3;
import org.warp.picalculator.math.rules.methods.SumMethod1; import org.warp.picalculator.math.rules.methods.SumMethod1;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
public class Subtraction extends FunctionOperator { public class Subtraction extends FunctionOperator {
public Subtraction(MathContext root, Function value1, Function value2) { public Subtraction(MathContext root, Function value1, Function value2) {

View File

@ -1,13 +1,12 @@
package org.warp.picalculator.math.functions; package org.warp.picalculator.math.functions;
import java.math.BigDecimal; import java.math.BigDecimal;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import org.warp.picalculator.Error; import org.warp.picalculator.Error;
import org.warp.picalculator.Errors; import org.warp.picalculator.Errors;
import org.warp.picalculator.math.MathContext;
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.rules.NumberRule3; import org.warp.picalculator.math.rules.NumberRule3;
import org.warp.picalculator.math.rules.NumberRule5; import org.warp.picalculator.math.rules.NumberRule5;
import org.warp.picalculator.math.rules.NumberRule7; import org.warp.picalculator.math.rules.NumberRule7;
@ -17,6 +16,8 @@ import org.warp.picalculator.math.rules.VariableRule2;
import org.warp.picalculator.math.rules.VariableRule3; import org.warp.picalculator.math.rules.VariableRule3;
import org.warp.picalculator.math.rules.methods.SumMethod1; import org.warp.picalculator.math.rules.methods.SumMethod1;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
public class Sum extends FunctionOperator { public class Sum extends FunctionOperator {
public Sum(MathContext root, Function value1, Function value2) { public Sum(MathContext root, Function value1, Function value2) {

View File

@ -1,17 +1,17 @@
package org.warp.picalculator.math.functions; package org.warp.picalculator.math.functions;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import org.warp.picalculator.Error; import org.warp.picalculator.Error;
import org.warp.picalculator.Errors; import org.warp.picalculator.Errors;
import org.warp.picalculator.math.MathContext;
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.rules.ExpandRule1; import org.warp.picalculator.math.rules.ExpandRule1;
import org.warp.picalculator.math.rules.NumberRule3; import org.warp.picalculator.math.rules.NumberRule3;
import org.warp.picalculator.math.rules.NumberRule4; import org.warp.picalculator.math.rules.NumberRule4;
import org.warp.picalculator.math.rules.NumberRule5; import org.warp.picalculator.math.rules.NumberRule5;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
public class SumSubtraction extends FunctionOperator { public class SumSubtraction extends FunctionOperator {
public SumSubtraction(MathContext root, Function value1, Function value2) { public SumSubtraction(MathContext root, Function value1, Function value2) {

View File

@ -3,8 +3,8 @@ package org.warp.picalculator.math.functions;
import java.util.List; import java.util.List;
import org.warp.picalculator.Error; import org.warp.picalculator.Error;
import org.warp.picalculator.math.MathContext;
import org.warp.picalculator.math.Function; import org.warp.picalculator.math.Function;
import org.warp.picalculator.math.MathContext;
public class Undefined implements Function { public class Undefined implements Function {

View File

@ -1,11 +1,12 @@
package org.warp.picalculator.math.functions; package org.warp.picalculator.math.functions;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import java.util.List; import java.util.List;
import org.warp.picalculator.Error; import org.warp.picalculator.Error;
import org.warp.picalculator.math.MathContext;
import org.warp.picalculator.math.Function; import org.warp.picalculator.math.Function;
import org.warp.picalculator.math.MathContext;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
public class Variable implements Function { public class Variable implements Function {

View File

@ -1,20 +1,21 @@
package org.warp.picalculator.math.functions.equations; package org.warp.picalculator.math.functions.equations;
import java.math.BigDecimal; import java.math.BigDecimal;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import org.warp.picalculator.Error; import org.warp.picalculator.Error;
import org.warp.picalculator.Errors; import org.warp.picalculator.Errors;
import org.warp.picalculator.math.MathContext;
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.SolveMethod; import org.warp.picalculator.math.SolveMethod;
import org.warp.picalculator.math.functions.Number; import org.warp.picalculator.math.functions.Number;
import org.warp.picalculator.math.functions.Subtraction; import org.warp.picalculator.math.functions.Subtraction;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
public class Equation extends FunctionOperator { public class Equation extends FunctionOperator {
public Equation(MathContext root, Function value1, Function value2) { public Equation(MathContext root, Function value1, Function value2) {

View File

@ -1,15 +1,16 @@
package org.warp.picalculator.math.functions.equations; package org.warp.picalculator.math.functions.equations;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import java.util.List; import java.util.List;
import org.warp.picalculator.Error; import org.warp.picalculator.Error;
import org.warp.picalculator.math.MathContext;
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.functions.Expression; import org.warp.picalculator.math.functions.Expression;
import org.warp.picalculator.math.functions.Number; import org.warp.picalculator.math.functions.Number;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
public class EquationsSystem extends FunctionDynamic { public class EquationsSystem extends FunctionDynamic {
static final int spacing = 2; static final int spacing = 2;

View File

@ -1,10 +1,11 @@
package org.warp.picalculator.math.functions.equations; package org.warp.picalculator.math.functions.equations;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import org.warp.picalculator.Error; import org.warp.picalculator.Error;
import org.warp.picalculator.math.MathContext;
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 it.unimi.dsi.fastutil.objects.ObjectArrayList;
public class EquationsSystemPart extends FunctionSingle { public class EquationsSystemPart extends FunctionSingle {

View File

@ -1,11 +1,11 @@
package org.warp.picalculator.math.functions.trigonometry; package org.warp.picalculator.math.functions.trigonometry;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import org.warp.picalculator.Error; import org.warp.picalculator.Error;
import org.warp.picalculator.math.MathContext;
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 it.unimi.dsi.fastutil.objects.ObjectArrayList;
public class ArcCosine extends FunctionSingle { public class ArcCosine extends FunctionSingle {

View File

@ -1,11 +1,11 @@
package org.warp.picalculator.math.functions.trigonometry; package org.warp.picalculator.math.functions.trigonometry;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import org.warp.picalculator.Error; import org.warp.picalculator.Error;
import org.warp.picalculator.math.MathContext;
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 it.unimi.dsi.fastutil.objects.ObjectArrayList;
public class ArcSine extends FunctionSingle { public class ArcSine extends FunctionSingle {

View File

@ -1,11 +1,11 @@
package org.warp.picalculator.math.functions.trigonometry; package org.warp.picalculator.math.functions.trigonometry;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import org.warp.picalculator.Error; import org.warp.picalculator.Error;
import org.warp.picalculator.math.MathContext;
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 it.unimi.dsi.fastutil.objects.ObjectArrayList;
public class ArcTangent extends FunctionSingle { public class ArcTangent extends FunctionSingle {

View File

@ -1,11 +1,11 @@
package org.warp.picalculator.math.functions.trigonometry; package org.warp.picalculator.math.functions.trigonometry;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import org.warp.picalculator.Error; import org.warp.picalculator.Error;
import org.warp.picalculator.math.MathContext;
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 it.unimi.dsi.fastutil.objects.ObjectArrayList;
public class Cosine extends FunctionSingle { public class Cosine extends FunctionSingle {

View File

@ -1,21 +1,22 @@
package org.warp.picalculator.math.functions.trigonometry; package org.warp.picalculator.math.functions.trigonometry;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import org.nevec.rjm.BigDecimalMath; import org.nevec.rjm.BigDecimalMath;
import org.warp.picalculator.Error; import org.warp.picalculator.Error;
import org.warp.picalculator.math.AngleMode; import org.warp.picalculator.math.AngleMode;
import org.warp.picalculator.math.MathContext;
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.functions.Number; import org.warp.picalculator.math.functions.Number;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
public class Sine extends FunctionSingle { public class Sine extends FunctionSingle {
public Sine(MathContext root, Function value) { public Sine(MathContext root, Function value) {
super(root, value); super(root, value);
} }
@SuppressWarnings("unused")
@Override @Override
protected boolean isSolvable() { protected boolean isSolvable() {
if (parameter instanceof Number) { if (parameter instanceof Number) {

View File

@ -1,11 +1,11 @@
package org.warp.picalculator.math.functions.trigonometry; package org.warp.picalculator.math.functions.trigonometry;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import org.warp.picalculator.Error; import org.warp.picalculator.Error;
import org.warp.picalculator.math.MathContext;
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 it.unimi.dsi.fastutil.objects.ObjectArrayList;
public class Tangent extends FunctionSingle { public class Tangent extends FunctionSingle {

View File

@ -1,9 +1,5 @@
package org.warp.picalculator.math.parser; package org.warp.picalculator.math.parser;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.Arrays;
import org.warp.picalculator.Error; import org.warp.picalculator.Error;
import org.warp.picalculator.Errors; import org.warp.picalculator.Errors;
import org.warp.picalculator.gui.expression.blocks.Block; import org.warp.picalculator.gui.expression.blocks.Block;
@ -20,6 +16,9 @@ import org.warp.picalculator.math.FunctionOperator;
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 org.warp.picalculator.math.MathematicalSymbols; import org.warp.picalculator.math.MathematicalSymbols;
import org.warp.picalculator.math.functions.Division;
import org.warp.picalculator.math.functions.Expression;
import org.warp.picalculator.math.functions.Multiplication;
import org.warp.picalculator.math.functions.Number; import org.warp.picalculator.math.functions.Number;
import org.warp.picalculator.math.functions.Power; import org.warp.picalculator.math.functions.Power;
import org.warp.picalculator.math.functions.RootSquare; import org.warp.picalculator.math.functions.RootSquare;
@ -28,9 +27,6 @@ import org.warp.picalculator.math.functions.Sum;
import org.warp.picalculator.math.functions.SumSubtraction; import org.warp.picalculator.math.functions.SumSubtraction;
import org.warp.picalculator.math.functions.Variable; import org.warp.picalculator.math.functions.Variable;
import org.warp.picalculator.math.functions.Variable.V_TYPE; import org.warp.picalculator.math.functions.Variable.V_TYPE;
import org.warp.picalculator.math.functions.Division;
import org.warp.picalculator.math.functions.Expression;
import org.warp.picalculator.math.functions.Multiplication;
import org.warp.picalculator.math.parser.features.FeatureChar; import org.warp.picalculator.math.parser.features.FeatureChar;
import org.warp.picalculator.math.parser.features.FeatureDivision; import org.warp.picalculator.math.parser.features.FeatureDivision;
import org.warp.picalculator.math.parser.features.FeatureMultiplication; import org.warp.picalculator.math.parser.features.FeatureMultiplication;
@ -45,11 +41,9 @@ import org.warp.picalculator.math.parser.features.interfaces.FeatureDouble;
import org.warp.picalculator.math.parser.features.interfaces.FeatureSingle; import org.warp.picalculator.math.parser.features.interfaces.FeatureSingle;
import com.sun.org.apache.xpath.internal.functions.Function2Args; import com.sun.org.apache.xpath.internal.functions.Function2Args;
import com.sun.org.apache.xpath.internal.operations.Mult;
import it.unimi.dsi.fastutil.objects.ObjectArrayList; import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import it.unimi.dsi.fastutil.objects.ObjectListIterator; import it.unimi.dsi.fastutil.objects.ObjectListIterator;
import sun.reflect.generics.reflectiveObjects.NotImplementedException;
public class MathParser { public class MathParser {
public static Expression parseInput(MathContext context, InputContainer c) throws Error { public static Expression parseInput(MathContext context, InputContainer c) throws Error {

View File

@ -1,7 +1,6 @@
package org.warp.picalculator.math.parser.features; package org.warp.picalculator.math.parser.features;
import org.warp.picalculator.math.functions.Variable.V_TYPE; import org.warp.picalculator.math.functions.Variable.V_TYPE;
import org.warp.picalculator.math.parser.features.interfaces.Feature;
public class FeatureVariable extends FeatureChar { public class FeatureVariable extends FeatureChar {

View File

@ -1,17 +1,17 @@
package org.warp.picalculator.math.rules; package org.warp.picalculator.math.rules;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import org.warp.picalculator.Error; import org.warp.picalculator.Error;
import org.warp.picalculator.math.MathContext;
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.functions.Expression; import org.warp.picalculator.math.functions.Expression;
import org.warp.picalculator.math.functions.Negative; import org.warp.picalculator.math.functions.Negative;
import org.warp.picalculator.math.functions.Subtraction; import org.warp.picalculator.math.functions.Subtraction;
import org.warp.picalculator.math.functions.Sum; import org.warp.picalculator.math.functions.Sum;
import org.warp.picalculator.math.functions.SumSubtraction; import org.warp.picalculator.math.functions.SumSubtraction;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
/** /**
* Expand rule<br> * Expand rule<br>
* <b>-(+a+b) = -a-b</b><br> * <b>-(+a+b) = -a-b</b><br>

View File

@ -1,13 +1,13 @@
package org.warp.picalculator.math.rules; package org.warp.picalculator.math.rules;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import org.warp.picalculator.Error; import org.warp.picalculator.Error;
import org.warp.picalculator.math.Function; import org.warp.picalculator.math.Function;
import org.warp.picalculator.math.functions.Expression; import org.warp.picalculator.math.functions.Expression;
import org.warp.picalculator.math.functions.Negative; import org.warp.picalculator.math.functions.Negative;
import org.warp.picalculator.math.functions.Subtraction; import org.warp.picalculator.math.functions.Subtraction;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
/** /**
* Expand rule<br> * Expand rule<br>
* <b>-(-a) = a</b> * <b>-(-a) = a</b>
@ -36,8 +36,7 @@ public class ExpandRule5 {
public static ObjectArrayList<Function> execute(Function f) throws Error { public static ObjectArrayList<Function> execute(Function f) throws Error {
final ObjectArrayList<Function> result = new ObjectArrayList<>(); final ObjectArrayList<Function> result = new ObjectArrayList<>();
final Function a = null;
if (f instanceof Negative) { if (f instanceof Negative) {
final Negative fnc = (Negative) f; final Negative fnc = (Negative) f;
result.add(((Negative) ((Expression) fnc.getParameter()).getParameter(0)).getParameter()); result.add(((Negative) ((Expression) fnc.getParameter()).getParameter(0)).getParameter());

View File

@ -1,13 +1,13 @@
package org.warp.picalculator.math.rules; package org.warp.picalculator.math.rules;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import org.warp.picalculator.Error; import org.warp.picalculator.Error;
import org.warp.picalculator.math.MathContext;
import org.warp.picalculator.math.Function; import org.warp.picalculator.math.Function;
import org.warp.picalculator.math.MathContext;
import org.warp.picalculator.math.functions.Number; import org.warp.picalculator.math.functions.Number;
import org.warp.picalculator.math.functions.Power; import org.warp.picalculator.math.functions.Power;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
/** /**
* Exponent rule<br> * Exponent rule<br>
* <b>1^a=1</b> * <b>1^a=1</b>

View File

@ -1,15 +1,15 @@
package org.warp.picalculator.math.rules; package org.warp.picalculator.math.rules;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import org.warp.picalculator.Error; import org.warp.picalculator.Error;
import org.warp.picalculator.math.MathContext;
import org.warp.picalculator.math.Function; import org.warp.picalculator.math.Function;
import org.warp.picalculator.math.MathContext;
import org.warp.picalculator.math.functions.Expression; import org.warp.picalculator.math.functions.Expression;
import org.warp.picalculator.math.functions.Multiplication; import org.warp.picalculator.math.functions.Multiplication;
import org.warp.picalculator.math.functions.Number; import org.warp.picalculator.math.functions.Number;
import org.warp.picalculator.math.functions.Power; import org.warp.picalculator.math.functions.Power;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
/** /**
* Exponent rule<br> * Exponent rule<br>
* <b>a*a=a^2</b> * <b>a*a=a^2</b>

View File

@ -1,16 +1,16 @@
package org.warp.picalculator.math.rules; package org.warp.picalculator.math.rules;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import org.warp.picalculator.Error; import org.warp.picalculator.Error;
import org.warp.picalculator.math.MathContext;
import org.warp.picalculator.math.Function; import org.warp.picalculator.math.Function;
import org.warp.picalculator.math.MathContext;
import org.warp.picalculator.math.functions.Expression; import org.warp.picalculator.math.functions.Expression;
import org.warp.picalculator.math.functions.Multiplication; import org.warp.picalculator.math.functions.Multiplication;
import org.warp.picalculator.math.functions.Number; import org.warp.picalculator.math.functions.Number;
import org.warp.picalculator.math.functions.Power; import org.warp.picalculator.math.functions.Power;
import org.warp.picalculator.math.functions.Sum; import org.warp.picalculator.math.functions.Sum;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
/** /**
* Exponent rule<br> * Exponent rule<br>
* <b>(a ^ b) * (a ^ c) = a ^ (b + c)</b> * <b>(a ^ b) * (a ^ c) = a ^ (b + c)</b>

View File

@ -1,16 +1,16 @@
package org.warp.picalculator.math.rules; package org.warp.picalculator.math.rules;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import org.warp.picalculator.Error; import org.warp.picalculator.Error;
import org.warp.picalculator.math.MathContext;
import org.warp.picalculator.math.Function; import org.warp.picalculator.math.Function;
import org.warp.picalculator.math.MathContext;
import org.warp.picalculator.math.functions.Expression; import org.warp.picalculator.math.functions.Expression;
import org.warp.picalculator.math.functions.Multiplication; import org.warp.picalculator.math.functions.Multiplication;
import org.warp.picalculator.math.functions.Number; import org.warp.picalculator.math.functions.Number;
import org.warp.picalculator.math.functions.Power; import org.warp.picalculator.math.functions.Power;
import org.warp.picalculator.math.functions.Root; import org.warp.picalculator.math.functions.Root;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
/** /**
* Exponent rule<br> * Exponent rule<br>
* <b>ax=x^1/a</b> * <b>ax=x^1/a</b>

View File

@ -1,12 +1,12 @@
package org.warp.picalculator.math.rules; package org.warp.picalculator.math.rules;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import org.warp.picalculator.Error; import org.warp.picalculator.Error;
import org.warp.picalculator.math.Function; import org.warp.picalculator.math.Function;
import org.warp.picalculator.math.functions.Number; import org.warp.picalculator.math.functions.Number;
import org.warp.picalculator.math.functions.Power; import org.warp.picalculator.math.functions.Power;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
/** /**
* Exponent rule<br> * Exponent rule<br>
* <b>a^1=a</b> * <b>a^1=a</b>

View File

@ -1,12 +1,12 @@
package org.warp.picalculator.math.rules; package org.warp.picalculator.math.rules;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import org.warp.picalculator.Error; import org.warp.picalculator.Error;
import org.warp.picalculator.math.Function; import org.warp.picalculator.math.Function;
import org.warp.picalculator.math.functions.Number; import org.warp.picalculator.math.functions.Number;
import org.warp.picalculator.math.functions.Power; import org.warp.picalculator.math.functions.Power;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
/** /**
* Exponent rule<br> * Exponent rule<br>
* <b>a^0=1</b> * <b>a^0=1</b>

View File

@ -1,15 +1,15 @@
package org.warp.picalculator.math.rules; package org.warp.picalculator.math.rules;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import org.warp.picalculator.Error; import org.warp.picalculator.Error;
import org.warp.picalculator.math.MathContext;
import org.warp.picalculator.math.Function; import org.warp.picalculator.math.Function;
import org.warp.picalculator.math.MathContext;
import org.warp.picalculator.math.functions.Expression; import org.warp.picalculator.math.functions.Expression;
import org.warp.picalculator.math.functions.Multiplication; import org.warp.picalculator.math.functions.Multiplication;
import org.warp.picalculator.math.functions.Number; import org.warp.picalculator.math.functions.Number;
import org.warp.picalculator.math.functions.Power; import org.warp.picalculator.math.functions.Power;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
/** /**
* Exponent rule<br> * Exponent rule<br>
* <b>(a*b)^n=a^n*b^n</b> * <b>(a*b)^n=a^n*b^n</b>

View File

@ -1,14 +1,14 @@
package org.warp.picalculator.math.rules; package org.warp.picalculator.math.rules;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import org.warp.picalculator.Error; import org.warp.picalculator.Error;
import org.warp.picalculator.math.MathContext;
import org.warp.picalculator.math.Function; import org.warp.picalculator.math.Function;
import org.warp.picalculator.math.MathContext;
import org.warp.picalculator.math.functions.Expression; import org.warp.picalculator.math.functions.Expression;
import org.warp.picalculator.math.functions.Multiplication; import org.warp.picalculator.math.functions.Multiplication;
import org.warp.picalculator.math.functions.Power; import org.warp.picalculator.math.functions.Power;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
/** /**
* Exponent rule<br> * Exponent rule<br>
* <b>(a ^ b) ^ c = a ^ (b * c)</b> * <b>(a ^ b) ^ c = a ^ (b * c)</b>

View File

@ -1,13 +1,13 @@
package org.warp.picalculator.math.rules; package org.warp.picalculator.math.rules;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import org.warp.picalculator.Error; import org.warp.picalculator.Error;
import org.warp.picalculator.math.MathContext;
import org.warp.picalculator.math.Function; import org.warp.picalculator.math.Function;
import org.warp.picalculator.math.MathContext;
import org.warp.picalculator.math.functions.Division; import org.warp.picalculator.math.functions.Division;
import org.warp.picalculator.math.functions.Number; import org.warp.picalculator.math.functions.Number;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
/** /**
* Fractions rule<br> * Fractions rule<br>
* <b>0 / a = 0</b> * <b>0 / a = 0</b>

View File

@ -1,13 +1,13 @@
package org.warp.picalculator.math.rules; package org.warp.picalculator.math.rules;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import org.warp.picalculator.Error; import org.warp.picalculator.Error;
import org.warp.picalculator.math.Function; import org.warp.picalculator.math.Function;
import org.warp.picalculator.math.functions.Division; import org.warp.picalculator.math.functions.Division;
import org.warp.picalculator.math.functions.Expression; import org.warp.picalculator.math.functions.Expression;
import org.warp.picalculator.math.functions.Multiplication; import org.warp.picalculator.math.functions.Multiplication;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
/** /**
* Fractions rule<br> * Fractions rule<br>
* <b>a / (b / c) = (a * c) / b</b> * <b>a / (b / c) = (a * c) / b</b>

View File

@ -1,13 +1,13 @@
package org.warp.picalculator.math.rules; package org.warp.picalculator.math.rules;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import org.warp.picalculator.Error; import org.warp.picalculator.Error;
import org.warp.picalculator.math.Function; import org.warp.picalculator.math.Function;
import org.warp.picalculator.math.functions.Division; import org.warp.picalculator.math.functions.Division;
import org.warp.picalculator.math.functions.Expression; import org.warp.picalculator.math.functions.Expression;
import org.warp.picalculator.math.functions.Multiplication; import org.warp.picalculator.math.functions.Multiplication;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
/** /**
* Fractions rule<br> * Fractions rule<br>
* <b>(b / c) / a = b / (a * c)</b> * <b>(b / c) / a = b / (a * c)</b>

View File

@ -1,13 +1,13 @@
package org.warp.picalculator.math.rules; package org.warp.picalculator.math.rules;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import org.warp.picalculator.Error; import org.warp.picalculator.Error;
import org.warp.picalculator.math.Function; import org.warp.picalculator.math.Function;
import org.warp.picalculator.math.functions.Division; import org.warp.picalculator.math.functions.Division;
import org.warp.picalculator.math.functions.Expression; import org.warp.picalculator.math.functions.Expression;
import org.warp.picalculator.math.functions.Multiplication; import org.warp.picalculator.math.functions.Multiplication;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
/** /**
* Fractions rule<br> * Fractions rule<br>
* <b>(a / b) * (c / d) = (a * c) / (b * d)</b> * <b>(a / b) * (c / d) = (a * c) / (b * d)</b>

View File

@ -1,12 +1,12 @@
package org.warp.picalculator.math.rules; package org.warp.picalculator.math.rules;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import org.warp.picalculator.Error; import org.warp.picalculator.Error;
import org.warp.picalculator.math.Function; import org.warp.picalculator.math.Function;
import org.warp.picalculator.math.functions.Division; import org.warp.picalculator.math.functions.Division;
import org.warp.picalculator.math.functions.Number; import org.warp.picalculator.math.functions.Number;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
/** /**
* Fractions rule<br> * Fractions rule<br>
* <b>a / 1 = a</b> * <b>a / 1 = a</b>

View File

@ -1,12 +1,12 @@
package org.warp.picalculator.math.rules; package org.warp.picalculator.math.rules;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import org.warp.picalculator.Error; import org.warp.picalculator.Error;
import org.warp.picalculator.math.Function; import org.warp.picalculator.math.Function;
import org.warp.picalculator.math.functions.Division; import org.warp.picalculator.math.functions.Division;
import org.warp.picalculator.math.functions.Number; import org.warp.picalculator.math.functions.Number;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
/** /**
* Fractions rule<br> * Fractions rule<br>
* <b>a / a = 1</b> * <b>a / a = 1</b>

View File

@ -1,13 +1,13 @@
package org.warp.picalculator.math.rules; package org.warp.picalculator.math.rules;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import org.warp.picalculator.Error; import org.warp.picalculator.Error;
import org.warp.picalculator.math.Function; import org.warp.picalculator.math.Function;
import org.warp.picalculator.math.functions.Division; import org.warp.picalculator.math.functions.Division;
import org.warp.picalculator.math.functions.Number; import org.warp.picalculator.math.functions.Number;
import org.warp.picalculator.math.functions.Power; import org.warp.picalculator.math.functions.Power;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
/** /**
* Fractions rule<br> * Fractions rule<br>
* <b>(a / b) ^ -1 = b / a</b> * <b>(a / b) ^ -1 = b / a</b>

View File

@ -1,15 +1,16 @@
package org.warp.picalculator.math.rules; package org.warp.picalculator.math.rules;
import java.math.BigDecimal; import java.math.BigDecimal;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import org.warp.picalculator.Error; import org.warp.picalculator.Error;
import org.warp.picalculator.math.MathContext;
import org.warp.picalculator.math.Function; import org.warp.picalculator.math.Function;
import org.warp.picalculator.math.MathContext;
import org.warp.picalculator.math.functions.Division; import org.warp.picalculator.math.functions.Division;
import org.warp.picalculator.math.functions.Number; import org.warp.picalculator.math.functions.Number;
import org.warp.picalculator.math.functions.Power; import org.warp.picalculator.math.functions.Power;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
/** /**
* Fractions rule<br> * Fractions rule<br>
* <b>(a / b) ^ -c = (b / a) ^ c</b> * <b>(a / b) ^ -c = (b / a) ^ c</b>

View File

@ -1,13 +1,13 @@
package org.warp.picalculator.math.rules; package org.warp.picalculator.math.rules;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import org.warp.picalculator.Error; import org.warp.picalculator.Error;
import org.warp.picalculator.math.MathContext;
import org.warp.picalculator.math.Function; import org.warp.picalculator.math.Function;
import org.warp.picalculator.math.MathContext;
import org.warp.picalculator.math.functions.Multiplication; import org.warp.picalculator.math.functions.Multiplication;
import org.warp.picalculator.math.functions.Number; import org.warp.picalculator.math.functions.Number;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
/** /**
* Number rule<br> * Number rule<br>
* <b>a * 0 = 0</b> * <b>a * 0 = 0</b>

View File

@ -1,13 +1,13 @@
package org.warp.picalculator.math.rules; package org.warp.picalculator.math.rules;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import org.warp.picalculator.Error; import org.warp.picalculator.Error;
import org.warp.picalculator.math.MathContext;
import org.warp.picalculator.math.Function; import org.warp.picalculator.math.Function;
import org.warp.picalculator.math.MathContext;
import org.warp.picalculator.math.functions.Multiplication; import org.warp.picalculator.math.functions.Multiplication;
import org.warp.picalculator.math.functions.Number; import org.warp.picalculator.math.functions.Number;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
/** /**
* Number rule<br> * Number rule<br>
* <b>a * 1 = a</b> * <b>a * 1 = a</b>

View File

@ -1,10 +1,8 @@
package org.warp.picalculator.math.rules; package org.warp.picalculator.math.rules;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import org.warp.picalculator.Error; import org.warp.picalculator.Error;
import org.warp.picalculator.math.MathContext;
import org.warp.picalculator.math.Function; import org.warp.picalculator.math.Function;
import org.warp.picalculator.math.MathContext;
import org.warp.picalculator.math.functions.Multiplication; import org.warp.picalculator.math.functions.Multiplication;
import org.warp.picalculator.math.functions.Negative; import org.warp.picalculator.math.functions.Negative;
import org.warp.picalculator.math.functions.Number; import org.warp.picalculator.math.functions.Number;
@ -12,6 +10,8 @@ import org.warp.picalculator.math.functions.Subtraction;
import org.warp.picalculator.math.functions.Sum; import org.warp.picalculator.math.functions.Sum;
import org.warp.picalculator.math.functions.SumSubtraction; import org.warp.picalculator.math.functions.SumSubtraction;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
/** /**
* Number rule<br> * Number rule<br>
* <b>a - a = 0</b><br> * <b>a - a = 0</b><br>

View File

@ -1,14 +1,14 @@
package org.warp.picalculator.math.rules; package org.warp.picalculator.math.rules;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import org.warp.picalculator.Error; import org.warp.picalculator.Error;
import org.warp.picalculator.math.MathContext;
import org.warp.picalculator.math.Function; import org.warp.picalculator.math.Function;
import org.warp.picalculator.math.MathContext;
import org.warp.picalculator.math.functions.Subtraction; import org.warp.picalculator.math.functions.Subtraction;
import org.warp.picalculator.math.functions.Sum; import org.warp.picalculator.math.functions.Sum;
import org.warp.picalculator.math.functions.SumSubtraction; import org.warp.picalculator.math.functions.SumSubtraction;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
/** /**
* Number rule<br> * Number rule<br>
* <b>a ± b = {a+b, a-b}</b> * <b>a ± b = {a+b, a-b}</b>

View File

@ -1,13 +1,13 @@
package org.warp.picalculator.math.rules; package org.warp.picalculator.math.rules;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import org.warp.picalculator.Error; import org.warp.picalculator.Error;
import org.warp.picalculator.math.MathContext;
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.functions.Number; import org.warp.picalculator.math.functions.Number;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
/** /**
* Number rule<br> * Number rule<br>
* <b>a + 0 = a</b><br> * <b>a + 0 = a</b><br>

View File

@ -1,14 +1,14 @@
package org.warp.picalculator.math.rules; package org.warp.picalculator.math.rules;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import org.warp.picalculator.Error; import org.warp.picalculator.Error;
import org.warp.picalculator.math.MathContext;
import org.warp.picalculator.math.Function; import org.warp.picalculator.math.Function;
import org.warp.picalculator.math.MathContext;
import org.warp.picalculator.math.functions.Multiplication; import org.warp.picalculator.math.functions.Multiplication;
import org.warp.picalculator.math.functions.Negative; import org.warp.picalculator.math.functions.Negative;
import org.warp.picalculator.math.functions.Number; import org.warp.picalculator.math.functions.Number;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
/** /**
* Number rule<br> * Number rule<br>
* <b>a * -1 = -a</b> * <b>a * -1 = -a</b>

View File

@ -1,14 +1,14 @@
package org.warp.picalculator.math.rules; package org.warp.picalculator.math.rules;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import org.warp.picalculator.Error; import org.warp.picalculator.Error;
import org.warp.picalculator.math.MathContext;
import org.warp.picalculator.math.Function; import org.warp.picalculator.math.Function;
import org.warp.picalculator.math.MathContext;
import org.warp.picalculator.math.functions.Multiplication; import org.warp.picalculator.math.functions.Multiplication;
import org.warp.picalculator.math.functions.Number; import org.warp.picalculator.math.functions.Number;
import org.warp.picalculator.math.functions.Sum; import org.warp.picalculator.math.functions.Sum;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
/** /**
* Number rule<br> * Number rule<br>
* <b>a + a = 2a</b> * <b>a + a = 2a</b>

View File

@ -1,14 +1,14 @@
package org.warp.picalculator.math.rules; package org.warp.picalculator.math.rules;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import org.warp.picalculator.Error; import org.warp.picalculator.Error;
import org.warp.picalculator.math.MathContext;
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.functions.Multiplication; import org.warp.picalculator.math.functions.Multiplication;
import org.warp.picalculator.math.functions.Sum; import org.warp.picalculator.math.functions.Sum;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
/** /**
* Syntax rule<br> * Syntax rule<br>
* <b>(a*b)*c=a*(b*c)</b> * <b>(a*b)*c=a*(b*c)</b>

View File

@ -1,13 +1,13 @@
package org.warp.picalculator.math.rules; package org.warp.picalculator.math.rules;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import org.warp.picalculator.Error; import org.warp.picalculator.Error;
import org.warp.picalculator.math.MathContext;
import org.warp.picalculator.math.Function; import org.warp.picalculator.math.Function;
import org.warp.picalculator.math.MathContext;
import org.warp.picalculator.math.functions.Expression; import org.warp.picalculator.math.functions.Expression;
import org.warp.picalculator.math.functions.Sum; import org.warp.picalculator.math.functions.Sum;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
/** /**
* Syntax rule<br> * Syntax rule<br>
* <b>a+(b+c)=(a+b)+c</b> * <b>a+(b+c)=(a+b)+c</b>

View File

@ -1,14 +1,14 @@
package org.warp.picalculator.math.rules; package org.warp.picalculator.math.rules;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import org.warp.picalculator.Error; import org.warp.picalculator.Error;
import org.warp.picalculator.math.MathContext;
import org.warp.picalculator.math.Function; import org.warp.picalculator.math.Function;
import org.warp.picalculator.math.MathContext;
import org.warp.picalculator.math.functions.Number; import org.warp.picalculator.math.functions.Number;
import org.warp.picalculator.math.functions.Power; import org.warp.picalculator.math.functions.Power;
import org.warp.picalculator.math.functions.Undefined; import org.warp.picalculator.math.functions.Undefined;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
/** /**
* Undefined rule<br> * Undefined rule<br>
* <b>0^0=undefined</b> * <b>0^0=undefined</b>

View File

@ -1,14 +1,14 @@
package org.warp.picalculator.math.rules; package org.warp.picalculator.math.rules;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import org.warp.picalculator.Error; import org.warp.picalculator.Error;
import org.warp.picalculator.math.MathContext;
import org.warp.picalculator.math.Function; import org.warp.picalculator.math.Function;
import org.warp.picalculator.math.MathContext;
import org.warp.picalculator.math.functions.Division; import org.warp.picalculator.math.functions.Division;
import org.warp.picalculator.math.functions.Number; import org.warp.picalculator.math.functions.Number;
import org.warp.picalculator.math.functions.Undefined; import org.warp.picalculator.math.functions.Undefined;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
/** /**
* Undefined rule<br> * Undefined rule<br>
* <b>a / 0 = undefined</b> * <b>a / 0 = undefined</b>

View File

@ -1,16 +1,16 @@
package org.warp.picalculator.math.rules; package org.warp.picalculator.math.rules;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import org.warp.picalculator.Error; import org.warp.picalculator.Error;
import org.warp.picalculator.math.MathContext;
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.functions.Expression; import org.warp.picalculator.math.functions.Expression;
import org.warp.picalculator.math.functions.Multiplication; import org.warp.picalculator.math.functions.Multiplication;
import org.warp.picalculator.math.functions.Subtraction; import org.warp.picalculator.math.functions.Subtraction;
import org.warp.picalculator.math.functions.Sum; import org.warp.picalculator.math.functions.Sum;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
/** /**
* Variable rule<br> * Variable rule<br>
* <b>ax+bx=(a+b)*x (a,b NUMBER; x VARIABLE|MULTIPLICATION)</b> * <b>ax+bx=(a+b)*x (a,b NUMBER; x VARIABLE|MULTIPLICATION)</b>

View File

@ -1,17 +1,17 @@
package org.warp.picalculator.math.rules; package org.warp.picalculator.math.rules;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import org.warp.picalculator.Error; import org.warp.picalculator.Error;
import org.warp.picalculator.math.MathContext;
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.functions.Expression; import org.warp.picalculator.math.functions.Expression;
import org.warp.picalculator.math.functions.Multiplication; import org.warp.picalculator.math.functions.Multiplication;
import org.warp.picalculator.math.functions.Number; import org.warp.picalculator.math.functions.Number;
import org.warp.picalculator.math.functions.Subtraction; import org.warp.picalculator.math.functions.Subtraction;
import org.warp.picalculator.math.functions.Sum; import org.warp.picalculator.math.functions.Sum;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
/** /**
* Variable rule<br> * Variable rule<br>
* <b>ax+x=(a+1)*x (a,b NUMBER; x VARIABLES)</b> * <b>ax+x=(a+1)*x (a,b NUMBER; x VARIABLES)</b>

View File

@ -1,17 +1,17 @@
package org.warp.picalculator.math.rules; package org.warp.picalculator.math.rules;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import org.warp.picalculator.Error; import org.warp.picalculator.Error;
import org.warp.picalculator.math.MathContext;
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.functions.Expression; import org.warp.picalculator.math.functions.Expression;
import org.warp.picalculator.math.functions.Multiplication; import org.warp.picalculator.math.functions.Multiplication;
import org.warp.picalculator.math.functions.Number; import org.warp.picalculator.math.functions.Number;
import org.warp.picalculator.math.functions.Subtraction; import org.warp.picalculator.math.functions.Subtraction;
import org.warp.picalculator.math.functions.Sum; import org.warp.picalculator.math.functions.Sum;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
/** /**
* Variable rule<br> * Variable rule<br>
* <b>x+ax=(a+1)*x (a,b NUMBER; x VARIABLES)</b> * <b>x+ax=(a+1)*x (a,b NUMBER; x VARIABLES)</b>

View File

@ -1,14 +1,14 @@
package org.warp.picalculator.math.rules.methods; package org.warp.picalculator.math.rules.methods;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import org.warp.picalculator.Error; import org.warp.picalculator.Error;
import org.warp.picalculator.math.functions.Multiplication;
import org.warp.picalculator.math.MathContext;
import org.warp.picalculator.math.Function; import org.warp.picalculator.math.Function;
import org.warp.picalculator.math.MathContext;
import org.warp.picalculator.math.functions.Division; import org.warp.picalculator.math.functions.Division;
import org.warp.picalculator.math.functions.Multiplication;
import org.warp.picalculator.math.functions.Number; import org.warp.picalculator.math.functions.Number;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
/** /**
* Division method<br> * Division method<br>
* <b>Example: (XY)/(YZ) = X/Z</b> * <b>Example: (XY)/(YZ) = X/Z</b>

View File

@ -1,13 +1,13 @@
package org.warp.picalculator.math.rules.methods; package org.warp.picalculator.math.rules.methods;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import org.warp.picalculator.Error; import org.warp.picalculator.Error;
import org.warp.picalculator.math.MathContext;
import org.warp.picalculator.math.Function; import org.warp.picalculator.math.Function;
import org.warp.picalculator.math.MathContext;
import org.warp.picalculator.math.functions.Multiplication; import org.warp.picalculator.math.functions.Multiplication;
import org.warp.picalculator.math.functions.Number; import org.warp.picalculator.math.functions.Number;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
/** /**
* Multiplication method<br> * Multiplication method<br>
* <b>Example: X*3*X*2 = 6*X^2</b> * <b>Example: X*3*X*2 = 6*X^2</b>

Some files were not shown because too many files have changed in this diff Show More