Completed the variable type menu and organized project imports
This commit is contained in:
parent
72e151b1e4
commit
234d43fe31
@ -2,15 +2,16 @@ package org.warp.picalculator;
|
||||
|
||||
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.Key;
|
||||
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.containers.NormalInputContainer;
|
||||
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.gpu.GPUEngine;
|
||||
import org.warp.picalculator.math.MathContext;
|
||||
@ -109,6 +110,8 @@ public class TestGPU {
|
||||
} catch (final Error e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
|
||||
@ -121,7 +124,7 @@ public class TestGPU {
|
||||
}
|
||||
});
|
||||
|
||||
final Scene s = new Scene(d);
|
||||
new Scene(d);
|
||||
}
|
||||
|
||||
private static NormalInputContainer c = null;
|
||||
@ -146,7 +149,7 @@ public class TestGPU {
|
||||
BlockContainer.initializeFonts(d.loadFont("ex"), d.loadFont("big"));
|
||||
|
||||
//New expression framework test
|
||||
c = new NormalInputContainer(false, 0, 200);
|
||||
c = new NormalInputContainer(new InputContext(), false, 0, 200);
|
||||
c.typeChar(MathematicalSymbols.DIVISION);
|
||||
c.typeChar('5');
|
||||
c.typeChar(MathematicalSymbols.MULTIPLICATION);
|
||||
|
@ -15,7 +15,6 @@ import java.lang.reflect.Modifier;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.BigInteger;
|
||||
import java.math.RoundingMode;
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
import java.util.List;
|
||||
|
||||
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.graphicengine.BinaryFont;
|
||||
import org.warp.picalculator.math.Function;
|
||||
import org.warp.picalculator.math.FunctionSingle;
|
||||
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.Expression;
|
||||
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.EquationsSystemPart;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
|
||||
public class Utils {
|
||||
|
||||
public static final int scale = 24;
|
||||
@ -594,10 +595,11 @@ public class Utils {
|
||||
return bd.signum() == 0 || bd.scale() <= 0 || bd.stripTrailingZeros().scale() <= 0;
|
||||
}
|
||||
|
||||
@SafeVarargs
|
||||
public static <T> String arrayToString(T... data) {
|
||||
String sdata = "";
|
||||
for (final T o : data) {
|
||||
sdata += "," + o.toString();
|
||||
sdata += "," + o;
|
||||
}
|
||||
return sdata.substring(1);
|
||||
}
|
||||
|
@ -8,7 +8,6 @@ import org.warp.picalculator.device.chip.SerialToParallel;
|
||||
import org.warp.picalculator.gui.DisplayManager;
|
||||
import org.warp.picalculator.gui.GUIErrorMessage;
|
||||
import org.warp.picalculator.gui.screens.KeyboardDebugScreen;
|
||||
import org.warp.picalculator.gui.screens.MarioScreen;
|
||||
import org.warp.picalculator.gui.screens.Screen;
|
||||
|
||||
import com.pi4j.wiringpi.Gpio;
|
||||
|
@ -1,25 +1,25 @@
|
||||
package org.warp.picalculator.gui;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
|
||||
|
||||
import org.warp.picalculator.Main;
|
||||
import org.warp.picalculator.Utils;
|
||||
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.RenderingLoop;
|
||||
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.gpu.GPUEngine;
|
||||
import org.warp.picalculator.gui.graphicengine.headless256.Headless8Engine;
|
||||
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 com.pi4j.wiringpi.Gpio;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
|
||||
public final class DisplayManager implements RenderingLoop {
|
||||
public static DisplayManager INSTANCE;
|
||||
private static float brightness;
|
||||
|
@ -1,11 +1,12 @@
|
||||
package org.warp.picalculator.gui;
|
||||
|
||||
import org.warp.picalculator.Error;
|
||||
import org.warp.picalculator.gui.graphicengine.GraphicEngine;
|
||||
import org.warp.picalculator.gui.graphicengine.Renderer;
|
||||
import org.warp.picalculator.Error;
|
||||
|
||||
public class GUIErrorMessage {
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private final String err;
|
||||
private final long creationTime;
|
||||
|
||||
|
@ -17,6 +17,7 @@ public class GraphicUtils {
|
||||
return cos[(int) (deg * degToIndex) & SIN_MASK];
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private static final float RAD, DEG;
|
||||
private static final int SIN_BITS, SIN_MASK, SIN_COUNT;
|
||||
private static final float radFull, radToIndex;
|
||||
|
@ -3,7 +3,6 @@ package org.warp.picalculator.gui.expression;
|
||||
import java.io.Serializable;
|
||||
|
||||
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.graphicengine.GraphicEngine;
|
||||
import org.warp.picalculator.gui.graphicengine.Renderer;
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
@ -58,8 +58,8 @@ public abstract class Block implements GraphicalElement {
|
||||
public abstract void setSmall(boolean small);
|
||||
|
||||
public abstract int getClassID();
|
||||
|
||||
public ExtraMenu getExtraMenu() {
|
||||
|
||||
public ExtraMenu<?> getExtraMenu() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,5 @@
|
||||
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.expression.Caret;
|
||||
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.Renderer;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
|
||||
public class BlockContainer implements GraphicalElement {
|
||||
|
||||
private static boolean initialized = false;
|
||||
|
@ -1,7 +1,6 @@
|
||||
package org.warp.picalculator.gui.expression.blocks;
|
||||
|
||||
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.Renderer;
|
||||
|
||||
|
@ -1,8 +1,6 @@
|
||||
package org.warp.picalculator.gui.expression.blocks;
|
||||
|
||||
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.Renderer;
|
||||
|
||||
@ -53,7 +51,6 @@ public class BlockPower extends Block {
|
||||
public void recomputeDimensions() {
|
||||
final int w2 = containerExponent.getWidth();
|
||||
final int h2 = containerExponent.getHeight();
|
||||
final int l2 = containerExponent.getLine();
|
||||
width = w2+1;
|
||||
height = h2+BlockContainer.getDefaultCharHeight(small)-3;
|
||||
line = h2+BlockContainer.getDefaultCharHeight(small)/2-3;
|
||||
|
@ -4,31 +4,76 @@ import org.warp.picalculator.device.Keyboard.Key;
|
||||
import org.warp.picalculator.gui.DisplayManager;
|
||||
import org.warp.picalculator.gui.expression.Caret;
|
||||
import org.warp.picalculator.gui.expression.ExtraMenu;
|
||||
import org.warp.picalculator.gui.expression.InputContext;
|
||||
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.math.functions.Variable;
|
||||
import org.warp.picalculator.math.functions.Variable.V_TYPE;
|
||||
|
||||
public class BlockVariable extends Block {
|
||||
|
||||
public static final int CLASS_ID = 0x00000007;
|
||||
|
||||
private InputContext ic;
|
||||
private final char ch;
|
||||
private final VariableMenu menu;
|
||||
private V_TYPE type;
|
||||
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.menu = new VariableMenu(this);
|
||||
this.type = V_TYPE.UNKNOWN;
|
||||
this.color = 0xFF304ffe;
|
||||
this.typeDirtyID = this;
|
||||
retrieveValue();
|
||||
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
|
||||
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);
|
||||
r.glColor(color);
|
||||
r.glDrawCharLeft(x, y, ch);
|
||||
@ -83,9 +128,8 @@ public class BlockVariable extends Block {
|
||||
|
||||
public class VariableMenu extends ExtraMenu<BlockVariable> {
|
||||
|
||||
boolean mustRefresh = true;
|
||||
String text = "";
|
||||
private int color;
|
||||
boolean mustRefreshMenu = true;
|
||||
|
||||
public VariableMenu(BlockVariable var) {
|
||||
super(var);
|
||||
@ -100,7 +144,6 @@ public class BlockVariable extends Block {
|
||||
|
||||
@Override
|
||||
public void close() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -141,8 +184,10 @@ public class BlockVariable extends Block {
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
block.pushValue();
|
||||
mustRefresh = true;
|
||||
mustRefreshMenu = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -153,25 +198,14 @@ public class BlockVariable extends Block {
|
||||
|
||||
@Override
|
||||
public boolean beforeRender(float delta, Caret caret) {
|
||||
if (super.beforeRender(delta, caret)||mustRefresh) {
|
||||
mustRefresh = false;
|
||||
switch (block.type) {
|
||||
case UNKNOWN:
|
||||
color = 0xFF304ffe;
|
||||
break;
|
||||
case COEFFICIENT:
|
||||
color = 0xFFf50057;
|
||||
break;
|
||||
case SOLUTION:
|
||||
default:
|
||||
color = 0xFF64dd17;
|
||||
break;
|
||||
}
|
||||
block.color = color;
|
||||
if (mustRefreshMenu) {
|
||||
mustRefreshMenu = false;
|
||||
text = block.type.toString();
|
||||
BinaryFont f = BlockContainer.getDefaultFont(true);
|
||||
width = 2+f.getStringWidth(text)+2;
|
||||
height = 2+f.getCharacterHeight()+2;
|
||||
|
||||
super.beforeRender(delta, caret);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@ -181,9 +215,29 @@ public class BlockVariable extends Block {
|
||||
public void draw(GraphicEngine ge, Renderer r, Caret caret) {
|
||||
BlockContainer.getDefaultFont(true).use(ge);
|
||||
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.glDrawStringCenter(location[0]+width/2, location[1]+2, text);
|
||||
r.glDrawStringCenter(popupX+width/2, popupY+2+5, text);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,21 +1,32 @@
|
||||
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.BlockChar;
|
||||
import org.warp.picalculator.math.MathematicalSymbols;
|
||||
|
||||
public class InlineInputContainer extends InputContainer {
|
||||
|
||||
private static final long serialVersionUID = 4307434049083324966L;
|
||||
|
||||
@Deprecated()
|
||||
/**
|
||||
* Use InlineInputContainer(InputContext) instead
|
||||
*/
|
||||
public InlineInputContainer() {
|
||||
super();
|
||||
}
|
||||
|
||||
public InlineInputContainer(boolean small) {
|
||||
super(small);
|
||||
|
||||
public InlineInputContainer(InputContext ic) {
|
||||
super(ic);
|
||||
}
|
||||
|
||||
public InlineInputContainer(boolean small, int minWidth, int minHeight) {
|
||||
super(small, minWidth, minHeight);
|
||||
public InlineInputContainer(InputContext ic, boolean small) {
|
||||
super(ic, small);
|
||||
}
|
||||
|
||||
public InlineInputContainer(InputContext ic, boolean small, int minWidth, int minHeight) {
|
||||
super(ic, small, minWidth, minHeight);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1,6 +1,5 @@
|
||||
package org.warp.picalculator.gui.expression.containers;
|
||||
|
||||
import java.io.ObjectOutputStream;
|
||||
import java.io.Serializable;
|
||||
|
||||
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.CaretState;
|
||||
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.BlockContainer;
|
||||
import org.warp.picalculator.gui.expression.layouts.InputLayout;
|
||||
import org.warp.picalculator.gui.graphicengine.GraphicEngine;
|
||||
import org.warp.picalculator.gui.graphicengine.Renderer;
|
||||
|
||||
import it.unimi.dsi.fastutil.Arrays;
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
|
||||
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 boolean parsed = false;
|
||||
private ExtraMenu<?> extra;
|
||||
protected InputContext inputContext;
|
||||
|
||||
public synchronized InputContext getInputContext() {
|
||||
return inputContext;
|
||||
}
|
||||
@Deprecated()
|
||||
/**
|
||||
* Use InputContainer(InputContext) instead
|
||||
*/
|
||||
public InputContainer() {
|
||||
caret = new Caret(CaretState.VISIBLE_ON, 0);
|
||||
root = new BlockContainer(false, false);
|
||||
this(new InputContext());
|
||||
}
|
||||
|
||||
public InputContainer(boolean small) {
|
||||
caret = new Caret(CaretState.VISIBLE_ON, 0);
|
||||
root = new BlockContainer(small, false);
|
||||
public InputContainer(InputContext ic) {
|
||||
this(ic, 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);
|
||||
root = new BlockContainer(small, false);
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
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.BlockChar;
|
||||
import org.warp.picalculator.gui.expression.blocks.BlockDivision;
|
||||
@ -11,16 +12,26 @@ import org.warp.picalculator.math.MathematicalSymbols;
|
||||
|
||||
public class NormalInputContainer extends InputContainer {
|
||||
|
||||
private static final long serialVersionUID = 5236564695997222322L;
|
||||
|
||||
@Deprecated()
|
||||
/**
|
||||
* Use NormalInputContainer(InputContext) instead
|
||||
*/
|
||||
public NormalInputContainer() {
|
||||
super();
|
||||
}
|
||||
|
||||
public NormalInputContainer(boolean small) {
|
||||
super(small);
|
||||
|
||||
public NormalInputContainer(InputContext ic) {
|
||||
super(ic);
|
||||
}
|
||||
|
||||
public NormalInputContainer(boolean small, int minWidth, int minHeight) {
|
||||
super(small, minWidth, minHeight);
|
||||
public NormalInputContainer(InputContext ic, boolean small) {
|
||||
super(ic, small);
|
||||
}
|
||||
|
||||
public NormalInputContainer(InputContext ic, boolean small, int minWidth, int minHeight) {
|
||||
super(ic, small, minWidth, minHeight);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -55,7 +66,7 @@ public class NormalInputContainer extends InputContainer {
|
||||
default:
|
||||
for (char v : MathematicalSymbols.variables) {
|
||||
if (c == v) {
|
||||
return new BlockVariable(c);
|
||||
return new BlockVariable(inputContext, c);
|
||||
}
|
||||
}
|
||||
return new BlockChar(c);
|
||||
|
@ -1,6 +1,9 @@
|
||||
package org.warp.picalculator.gui.expression.containers;
|
||||
|
||||
public class NormalOutputContainer extends OutputContainer {
|
||||
|
||||
private static final long serialVersionUID = 5087850494875415142L;
|
||||
|
||||
public NormalOutputContainer() {
|
||||
super();
|
||||
}
|
||||
|
@ -8,11 +8,11 @@ import java.io.IOException;
|
||||
import org.warp.picalculator.Main;
|
||||
import org.warp.picalculator.Utils;
|
||||
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.Skin;
|
||||
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;
|
||||
|
||||
public class CPUEngine implements GraphicEngine {
|
||||
|
||||
@ -311,20 +311,28 @@ public class CPUEngine implements GraphicEngine {
|
||||
final int iw = (int) width;
|
||||
final int ih = (int) height;
|
||||
|
||||
int x0 = ix;
|
||||
int y0 = iy;
|
||||
int x1 = ix + iw;
|
||||
int y1 = iy + ih;
|
||||
if (ix >= size[0] || iy >= size[0]) {
|
||||
return;
|
||||
}
|
||||
if (x0 < 0) {
|
||||
x0 = 0;
|
||||
}
|
||||
if (x1 >= size[0]) {
|
||||
x1 = size[0];
|
||||
}
|
||||
if (y0 < 0) {
|
||||
y0 = 0;
|
||||
}
|
||||
if (y1 >= size[1]) {
|
||||
y1 = size[1];
|
||||
}
|
||||
final int sizeW = size[0];
|
||||
for (int px = ix; px < x1; px++) {
|
||||
for (int py = iy; py < y1; py++) {
|
||||
for (int px = x0; px < x1; px++) {
|
||||
for (int py = y0; py < y1; py++) {
|
||||
canvas2d[(px) + (py) * sizeW] = color;
|
||||
}
|
||||
}
|
||||
|
@ -12,8 +12,8 @@ import java.util.logging.Logger;
|
||||
import javax.imageio.ImageIO;
|
||||
|
||||
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.GraphicEngine;
|
||||
import org.warp.picalculator.gui.graphicengine.cpu.CPUEngine.CPURenderer;
|
||||
|
||||
public class CPUFont implements BinaryFont {
|
||||
@ -161,9 +161,9 @@ public class CPUFont implements BinaryFont {
|
||||
|
||||
@Override
|
||||
public int getStringWidth(String text) {
|
||||
final int w = (charW) * text.length();
|
||||
if (text.length() > 0) {
|
||||
return w;
|
||||
final int w = (charW+1) * text.length();
|
||||
if (text.length() > 0 && w > 0) {
|
||||
return w-1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
|
@ -24,7 +24,6 @@ import java.nio.FloatBuffer;
|
||||
import java.nio.IntBuffer;
|
||||
import java.nio.LongBuffer;
|
||||
import java.nio.ShortBuffer;
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
@ -34,6 +33,8 @@ import java.util.Set;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
|
||||
/**
|
||||
* Helper to deallocate memory on the native heap allocated during the creation
|
||||
* of a direct byte buffer. It supports numerous virtual machines including
|
||||
|
@ -4,8 +4,8 @@ import java.io.IOException;
|
||||
|
||||
import org.warp.picalculator.Main;
|
||||
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.RenderingLoop;
|
||||
import org.warp.picalculator.gui.graphicengine.Skin;
|
||||
|
||||
import com.jogamp.opengl.GLProfile;
|
||||
@ -125,6 +125,7 @@ public class GPUEngine implements org.warp.picalculator.gui.graphicengine.Graphi
|
||||
|
||||
@Override
|
||||
public boolean isSupported() {
|
||||
if (Utils.debugOn) return false;
|
||||
boolean available = false;
|
||||
boolean errored = false;
|
||||
try {
|
||||
|
@ -3,8 +3,8 @@ package org.warp.picalculator.gui.graphicengine.gpu;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.IOException;
|
||||
|
||||
import org.warp.picalculator.gui.graphicengine.GraphicEngine;
|
||||
import org.warp.picalculator.gui.graphicengine.BinaryFont;
|
||||
import org.warp.picalculator.gui.graphicengine.GraphicEngine;
|
||||
import org.warp.picalculator.gui.graphicengine.cpu.CPUFont;
|
||||
|
||||
import com.jogamp.opengl.GLException;
|
||||
|
@ -8,6 +8,7 @@ import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.nio.Buffer;
|
||||
import java.nio.FloatBuffer;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
|
||||
import org.warp.picalculator.gui.graphicengine.BinaryFont;
|
||||
@ -200,7 +201,6 @@ public class GPURenderer implements Renderer {
|
||||
}
|
||||
|
||||
static BufferedImage openTexture(String file) throws GLException, IOException {
|
||||
final ByteArrayOutputStream os = new ByteArrayOutputStream();
|
||||
return ImageIO.read(GPURenderer.class.getClassLoader().getResource(file));
|
||||
}
|
||||
|
||||
|
@ -2,6 +2,7 @@ package org.warp.picalculator.gui.graphicengine.gpu;
|
||||
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.IOException;
|
||||
|
||||
import org.warp.picalculator.gui.graphicengine.GraphicEngine;
|
||||
import org.warp.picalculator.gui.graphicengine.Skin;
|
||||
|
||||
|
@ -28,28 +28,27 @@
|
||||
|
||||
package org.warp.picalculator.gui.graphicengine.gpu;
|
||||
|
||||
import com.jogamp.opengl.GL;
|
||||
import com.jogamp.opengl.GL2ES1;
|
||||
import com.jogamp.opengl.GLAutoDrawable;
|
||||
import com.jogamp.opengl.GLEventListener;
|
||||
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 org.warp.picalculator.Utils;
|
||||
import org.warp.picalculator.device.Keyboard;
|
||||
import org.warp.picalculator.device.Keyboard.Key;
|
||||
import org.warp.picalculator.gui.DisplayManager;
|
||||
|
||||
import com.jogamp.newt.event.KeyEvent;
|
||||
import com.jogamp.newt.event.KeyListener;
|
||||
import com.jogamp.newt.event.WindowEvent;
|
||||
import com.jogamp.newt.event.WindowListener;
|
||||
import com.jogamp.newt.event.WindowUpdateEvent;
|
||||
import com.jogamp.newt.opengl.GLWindow;
|
||||
|
||||
import com.jogamp.opengl.util.*;
|
||||
|
||||
import org.warp.picalculator.Utils;
|
||||
import org.warp.picalculator.device.Keyboard;
|
||||
import org.warp.picalculator.device.Keyboard.Key;
|
||||
import org.warp.picalculator.gui.DisplayManager;
|
||||
import com.jogamp.opengl.GL;
|
||||
import com.jogamp.opengl.GL2ES1;
|
||||
import com.jogamp.opengl.GLAutoDrawable;
|
||||
import com.jogamp.opengl.GLCapabilities;
|
||||
import com.jogamp.opengl.GLEventListener;
|
||||
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.util.Animator;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -310,20 +309,12 @@ class NEWTWindow implements GLEventListener {
|
||||
disp.size[0] = (Utils.debugOn & Utils.debugWindow2x) ? width / 2 : width;
|
||||
disp.size[1] = (Utils.debugOn & Utils.debugWindow2x) ? height / 2 : height;
|
||||
final GL2ES1 gl = glad.getGL().getGL2ES1();
|
||||
float max_wh, min_wh;
|
||||
if (width == 0) {
|
||||
width = 1;
|
||||
}
|
||||
if (height == 0) {
|
||||
height = 1;
|
||||
}
|
||||
if (width > height) {
|
||||
max_wh = width;
|
||||
min_wh = height;
|
||||
} else {
|
||||
max_wh = height;
|
||||
min_wh = width;
|
||||
}
|
||||
|
||||
gl.glViewport(0, 0, width, height);
|
||||
|
||||
@ -362,7 +353,7 @@ class NEWTWindow implements GLEventListener {
|
||||
@Override
|
||||
public void dispose(GLAutoDrawable drawable) {
|
||||
System.out.println("cleanup");
|
||||
final GL2ES1 gl = drawable.getGL().getGL2ES1();
|
||||
// final GL2ES1 gl = drawable.getGL().getGL2ES1();
|
||||
System.exit(0);
|
||||
}
|
||||
|
||||
|
@ -1,14 +1,12 @@
|
||||
package org.warp.picalculator.gui.graphicengine.headless256;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.logging.ConsoleHandler;
|
||||
|
||||
import org.fusesource.jansi.AnsiConsole;
|
||||
import org.warp.picalculator.Main;
|
||||
import org.warp.picalculator.gui.graphicengine.Renderer;
|
||||
import org.warp.picalculator.gui.graphicengine.RenderingLoop;
|
||||
import org.warp.picalculator.gui.graphicengine.Skin;
|
||||
|
||||
public class Headless8Engine implements org.warp.picalculator.gui.graphicengine.GraphicEngine {
|
||||
|
||||
@ -23,7 +21,7 @@ public class Headless8Engine implements org.warp.picalculator.gui.graphicengine.
|
||||
|
||||
@Override
|
||||
public int[] getSize() {
|
||||
ConsoleHandler ch = new ConsoleHandler();
|
||||
new ConsoleHandler();
|
||||
return new int[]{C_WIDTH, C_HEIGHT};
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
package org.warp.picalculator.gui.graphicengine.headless256;
|
||||
|
||||
import org.warp.picalculator.Main;
|
||||
import org.warp.picalculator.gui.graphicengine.Renderer;
|
||||
|
||||
public class Headless8Renderer implements Renderer {
|
||||
|
@ -1,6 +1,5 @@
|
||||
package org.warp.picalculator.gui.graphicengine.headless256;
|
||||
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.geom.AffineTransform;
|
||||
import java.awt.image.AffineTransformOp;
|
||||
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.Skin;
|
||||
import org.warp.picalculator.gui.graphicengine.cpu.CPUEngine.CPURenderer;
|
||||
|
||||
public class Headless8Skin implements Skin {
|
||||
|
||||
|
@ -1,14 +1,12 @@
|
||||
package org.warp.picalculator.gui.graphicengine.headless8;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.logging.ConsoleHandler;
|
||||
|
||||
import org.fusesource.jansi.AnsiConsole;
|
||||
import org.warp.picalculator.Main;
|
||||
import org.warp.picalculator.gui.graphicengine.Renderer;
|
||||
import org.warp.picalculator.gui.graphicengine.RenderingLoop;
|
||||
import org.warp.picalculator.gui.graphicengine.Skin;
|
||||
|
||||
public class Headless256Engine implements org.warp.picalculator.gui.graphicengine.GraphicEngine {
|
||||
|
||||
@ -23,7 +21,7 @@ public class Headless256Engine implements org.warp.picalculator.gui.graphicengin
|
||||
|
||||
@Override
|
||||
public int[] getSize() {
|
||||
ConsoleHandler ch = new ConsoleHandler();
|
||||
new ConsoleHandler();
|
||||
return new int[]{C_WIDTH, C_HEIGHT};
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
package org.warp.picalculator.gui.graphicengine.headless8;
|
||||
|
||||
import org.warp.picalculator.Main;
|
||||
import org.warp.picalculator.gui.graphicengine.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) {
|
||||
int oldColor;
|
||||
int newColor;
|
||||
final int onex = s0 <= s1 ? 1 : -1;
|
||||
final int oney = t0 <= t1 ? 1 : -1;
|
||||
@ -306,7 +304,6 @@ public class Headless256Renderer implements Renderer {
|
||||
pixelY = (y0 + texy * oney + height);
|
||||
if (pixelY < Headless256Engine.C_HEIGHT) {
|
||||
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]];
|
||||
if (transparent && !((newColor&TRANSPARENT) == TRANSPARENT)) {
|
||||
charmatrix[pixelX + pixelY * Headless256Engine.C_WIDTH] = ' ';
|
||||
|
@ -1,6 +1,5 @@
|
||||
package org.warp.picalculator.gui.graphicengine.headless8;
|
||||
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.geom.AffineTransform;
|
||||
import java.awt.image.AffineTransformOp;
|
||||
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.Skin;
|
||||
import org.warp.picalculator.gui.graphicengine.cpu.CPUEngine.CPURenderer;
|
||||
|
||||
public class Headless256Skin implements Skin {
|
||||
|
||||
|
@ -10,8 +10,6 @@ public class LoadingScreen extends Screen {
|
||||
public float endLoading;
|
||||
boolean mustRefresh = true;
|
||||
public float loadingTextTranslation = 0.0f;
|
||||
private boolean loading;
|
||||
private static final String titleString = "Andrea Cavalli's Algebraic Calculator";
|
||||
|
||||
public LoadingScreen() {
|
||||
super();
|
||||
@ -32,7 +30,6 @@ public class LoadingScreen extends Screen {
|
||||
|
||||
endLoading += dt;
|
||||
if (endLoading >= 5f) {
|
||||
loading = false;
|
||||
DisplayManager.INSTANCE.setScreen(new MathInputScreen());
|
||||
}
|
||||
mustRefresh = true;
|
||||
|
@ -2,7 +2,6 @@ package org.warp.picalculator.gui.screens;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.warp.picalculator.Main;
|
||||
import org.warp.picalculator.device.Keyboard;
|
||||
import org.warp.picalculator.device.Keyboard.Key;
|
||||
import org.warp.picalculator.gui.DisplayManager;
|
||||
|
@ -3,9 +3,6 @@ package org.warp.picalculator.gui.screens;
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringWriter;
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
import sun.reflect.generics.reflectiveObjects.NotImplementedException;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedHashSet;
|
||||
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.Key;
|
||||
import org.warp.picalculator.gui.DisplayManager;
|
||||
import org.warp.picalculator.gui.expression.InputContext;
|
||||
import org.warp.picalculator.gui.expression.blocks.Block;
|
||||
import org.warp.picalculator.gui.expression.blocks.BlockContainer;
|
||||
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.Renderer;
|
||||
import org.warp.picalculator.math.AngleMode;
|
||||
import org.warp.picalculator.math.MathContext;
|
||||
import org.warp.picalculator.math.Function;
|
||||
import org.warp.picalculator.math.FunctionDynamic;
|
||||
import org.warp.picalculator.math.FunctionSingle;
|
||||
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.functions.Expression;
|
||||
import org.warp.picalculator.math.functions.Number;
|
||||
import org.warp.picalculator.math.functions.Variable;
|
||||
import org.warp.picalculator.math.functions.Variable.VariableValue;
|
||||
import org.warp.picalculator.math.functions.equations.Equation;
|
||||
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 MathContext calc;
|
||||
public InputContext ic;
|
||||
public InputContainer userInput;
|
||||
public OutputContainer result;
|
||||
public int errorLevel = 0; // 0 = nessuno, 1 = risultato, 2 = tutto
|
||||
@ -54,6 +55,7 @@ public class MathInputScreen extends Screen {
|
||||
|
||||
@Override
|
||||
public void created() throws InterruptedException {
|
||||
ic = new InputContext();
|
||||
calc = new MathContext();
|
||||
|
||||
try {
|
||||
@ -63,7 +65,7 @@ public class MathInputScreen extends Screen {
|
||||
System.exit(1);
|
||||
}
|
||||
|
||||
userInput = new NormalInputContainer();
|
||||
userInput = new NormalInputContainer(ic);
|
||||
result = new NormalOutputContainer();
|
||||
|
||||
calc.init();
|
||||
@ -523,7 +525,7 @@ public class MathInputScreen extends Screen {
|
||||
@SuppressWarnings("unused")
|
||||
@Deprecated
|
||||
private void changeEquationScreen() {
|
||||
throw new NotImplementedException();
|
||||
throw new UnsupportedOperationException();
|
||||
//
|
||||
// if (!userInput.isEmpty()) {
|
||||
// final MathInputScreen cloned = clone();
|
||||
@ -627,7 +629,7 @@ public class MathInputScreen extends Screen {
|
||||
@Override
|
||||
@Deprecated
|
||||
public MathInputScreen clone() {
|
||||
throw new NotImplementedException();
|
||||
throw new UnsupportedOperationException();
|
||||
// final MathInputScreen es = this;
|
||||
// final MathInputScreen es2 = new MathInputScreen();
|
||||
// es2.errorLevel = es.errorLevel;
|
||||
|
@ -1,7 +1,6 @@
|
||||
package org.warp.picalculator.gui.screens;
|
||||
|
||||
import org.warp.picalculator.device.KeyboardEventListener;
|
||||
import org.warp.picalculator.device.Keyboard.Key;
|
||||
import org.warp.picalculator.gui.DisplayManager;
|
||||
|
||||
public abstract class Screen implements KeyboardEventListener {
|
||||
|
@ -1,12 +1,13 @@
|
||||
package org.warp.picalculator.math;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import org.warp.picalculator.Error;
|
||||
import org.warp.picalculator.Utils;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
|
||||
public abstract class FunctionDynamic implements Function {
|
||||
public FunctionDynamic(MathContext root) {
|
||||
this.root = root;
|
||||
|
@ -1,10 +1,10 @@
|
||||
package org.warp.picalculator.math;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
|
||||
import org.warp.picalculator.Error;
|
||||
import org.warp.picalculator.Utils;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
|
||||
public abstract class FunctionOperator implements Function {
|
||||
|
||||
/**
|
||||
|
@ -1,9 +1,9 @@
|
||||
package org.warp.picalculator.math;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
|
||||
import org.warp.picalculator.Error;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
|
||||
public abstract class FunctionSingle implements Function {
|
||||
|
||||
/**
|
||||
|
@ -2,6 +2,7 @@ package org.warp.picalculator.math;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import java.util.List;
|
||||
|
||||
import org.warp.picalculator.Error;
|
||||
import org.warp.picalculator.Errors;
|
||||
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 it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
import sun.reflect.generics.reflectiveObjects.NotImplementedException;
|
||||
|
||||
public class MathContext {
|
||||
|
||||
@ -133,6 +133,6 @@ public class MathContext {
|
||||
// mc.variablesValues = this.variablesValues;
|
||||
// mc.resultsCount = this.resultsCount;
|
||||
// return mc;
|
||||
throw new NotImplementedException();
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,9 @@
|
||||
package org.warp.picalculator.math;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
|
||||
import org.warp.picalculator.math.functions.equations.Equation;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
|
||||
public interface SolveMethod {
|
||||
public static final SolveMethod[] techniques = new SolveMethod[] {};
|
||||
|
||||
|
@ -1,11 +1,9 @@
|
||||
package org.warp.picalculator.math.functions;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
|
||||
import org.warp.picalculator.Error;
|
||||
import org.warp.picalculator.math.MathContext;
|
||||
import org.warp.picalculator.math.Function;
|
||||
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.FractionsRule11;
|
||||
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.UndefinedRule2;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
|
||||
public class Division extends FunctionOperator {
|
||||
|
||||
public Division(MathContext root, Function value1, Function value2) {
|
||||
|
@ -1,9 +1,10 @@
|
||||
package org.warp.picalculator.math.functions;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
import org.warp.picalculator.Error;
|
||||
import org.warp.picalculator.math.MathContext;
|
||||
import org.warp.picalculator.math.Function;
|
||||
import org.warp.picalculator.math.MathContext;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
|
||||
public class EmptyNumber implements Function {
|
||||
|
||||
|
@ -4,7 +4,6 @@ import static org.warp.picalculator.Utils.ArrayToRegex;
|
||||
import static org.warp.picalculator.Utils.concat;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
import java.util.List;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
@ -12,11 +11,11 @@ import java.util.regex.Pattern;
|
||||
import org.warp.picalculator.Error;
|
||||
import org.warp.picalculator.Errors;
|
||||
import org.warp.picalculator.Utils;
|
||||
import org.warp.picalculator.math.MathContext;
|
||||
import org.warp.picalculator.math.Function;
|
||||
import org.warp.picalculator.math.FunctionDynamic;
|
||||
import org.warp.picalculator.math.FunctionSingle;
|
||||
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.functions.trigonometry.ArcCosine;
|
||||
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.Tangent;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
|
||||
public class Expression extends FunctionDynamic {
|
||||
|
||||
public Expression(MathContext root) {
|
||||
|
@ -1,16 +1,19 @@
|
||||
package org.warp.picalculator.math.functions;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
import org.warp.picalculator.Error;
|
||||
import org.warp.picalculator.math.MathContext;
|
||||
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 static final byte FISH = 0;
|
||||
public static final byte TORNADO = 1;
|
||||
public static final byte SHARKNADO = 2;
|
||||
@SuppressWarnings("unused")
|
||||
private static final String[] jokes = new String[] { "♓", "TORNADO", "SHARKNADO" };
|
||||
@SuppressWarnings("unused")
|
||||
private static final int[] jokesFont = new int[] { 4, -1, -1 };
|
||||
private final byte joke;
|
||||
private final MathContext root;
|
||||
|
@ -1,11 +1,9 @@
|
||||
package org.warp.picalculator.math.functions;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
|
||||
import org.warp.picalculator.Error;
|
||||
import org.warp.picalculator.math.MathContext;
|
||||
import org.warp.picalculator.math.Function;
|
||||
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.ExponentRule16;
|
||||
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.methods.MultiplicationMethod1;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
|
||||
public class Multiplication extends FunctionOperator {
|
||||
|
||||
public Multiplication(MathContext root, Function value1, Function value2) {
|
||||
|
@ -1,15 +1,15 @@
|
||||
package org.warp.picalculator.math.functions;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
|
||||
import org.warp.picalculator.Error;
|
||||
import org.warp.picalculator.Errors;
|
||||
import org.warp.picalculator.math.MathContext;
|
||||
import org.warp.picalculator.math.Function;
|
||||
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.ExpandRule5;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
|
||||
public class Negative extends FunctionSingle {
|
||||
|
||||
public Negative(MathContext root, Function value) {
|
||||
|
@ -2,15 +2,16 @@ package org.warp.picalculator.math.functions;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.BigInteger;
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import org.nevec.rjm.BigDecimalMath;
|
||||
import org.warp.picalculator.Error;
|
||||
import org.warp.picalculator.Utils;
|
||||
import org.warp.picalculator.math.MathContext;
|
||||
import org.warp.picalculator.math.Function;
|
||||
import org.warp.picalculator.math.MathContext;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
|
||||
public class Number implements Function {
|
||||
|
||||
|
@ -1,11 +1,9 @@
|
||||
package org.warp.picalculator.math.functions;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
|
||||
import org.warp.picalculator.Error;
|
||||
import org.warp.picalculator.math.MathContext;
|
||||
import org.warp.picalculator.math.Function;
|
||||
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.ExponentRule2;
|
||||
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.UndefinedRule1;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
|
||||
public class Power extends FunctionOperator {
|
||||
|
||||
public Power(MathContext root, Function value1, Function value2) {
|
||||
|
@ -2,12 +2,13 @@ package org.warp.picalculator.math.functions;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.BigInteger;
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
|
||||
import org.warp.picalculator.Error;
|
||||
import org.warp.picalculator.math.MathContext;
|
||||
import org.warp.picalculator.math.Function;
|
||||
import org.warp.picalculator.math.FunctionOperator;
|
||||
import org.warp.picalculator.math.MathContext;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
|
||||
public class Root extends FunctionOperator {
|
||||
|
||||
|
@ -1,12 +1,13 @@
|
||||
package org.warp.picalculator.math.functions;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
|
||||
import org.warp.picalculator.Error;
|
||||
import org.warp.picalculator.math.MathContext;
|
||||
import org.warp.picalculator.math.Function;
|
||||
import org.warp.picalculator.math.FunctionSingle;
|
||||
import org.warp.picalculator.math.MathContext;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
|
||||
public class RootSquare extends FunctionSingle {
|
||||
|
||||
|
@ -1,11 +1,9 @@
|
||||
package org.warp.picalculator.math.functions;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
|
||||
import org.warp.picalculator.Error;
|
||||
import org.warp.picalculator.math.MathContext;
|
||||
import org.warp.picalculator.math.Function;
|
||||
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.ExpandRule5;
|
||||
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.methods.SumMethod1;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
|
||||
public class Subtraction extends FunctionOperator {
|
||||
|
||||
public Subtraction(MathContext root, Function value1, Function value2) {
|
||||
|
@ -1,13 +1,12 @@
|
||||
package org.warp.picalculator.math.functions;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
|
||||
import org.warp.picalculator.Error;
|
||||
import org.warp.picalculator.Errors;
|
||||
import org.warp.picalculator.math.MathContext;
|
||||
import org.warp.picalculator.math.Function;
|
||||
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.NumberRule5;
|
||||
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.methods.SumMethod1;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
|
||||
public class Sum extends FunctionOperator {
|
||||
|
||||
public Sum(MathContext root, Function value1, Function value2) {
|
||||
|
@ -1,17 +1,17 @@
|
||||
package org.warp.picalculator.math.functions;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
|
||||
import org.warp.picalculator.Error;
|
||||
import org.warp.picalculator.Errors;
|
||||
import org.warp.picalculator.math.MathContext;
|
||||
import org.warp.picalculator.math.Function;
|
||||
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.NumberRule3;
|
||||
import org.warp.picalculator.math.rules.NumberRule4;
|
||||
import org.warp.picalculator.math.rules.NumberRule5;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
|
||||
public class SumSubtraction extends FunctionOperator {
|
||||
|
||||
public SumSubtraction(MathContext root, Function value1, Function value2) {
|
||||
|
@ -3,8 +3,8 @@ package org.warp.picalculator.math.functions;
|
||||
import java.util.List;
|
||||
|
||||
import org.warp.picalculator.Error;
|
||||
import org.warp.picalculator.math.MathContext;
|
||||
import org.warp.picalculator.math.Function;
|
||||
import org.warp.picalculator.math.MathContext;
|
||||
|
||||
public class Undefined implements Function {
|
||||
|
||||
|
@ -1,11 +1,12 @@
|
||||
package org.warp.picalculator.math.functions;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.warp.picalculator.Error;
|
||||
import org.warp.picalculator.math.MathContext;
|
||||
import org.warp.picalculator.math.Function;
|
||||
import org.warp.picalculator.math.MathContext;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
|
||||
public class Variable implements Function {
|
||||
|
||||
|
@ -1,20 +1,21 @@
|
||||
package org.warp.picalculator.math.functions.equations;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.warp.picalculator.Error;
|
||||
import org.warp.picalculator.Errors;
|
||||
import org.warp.picalculator.math.MathContext;
|
||||
import org.warp.picalculator.math.Function;
|
||||
import org.warp.picalculator.math.FunctionOperator;
|
||||
import org.warp.picalculator.math.MathContext;
|
||||
import org.warp.picalculator.math.SolveMethod;
|
||||
import org.warp.picalculator.math.functions.Number;
|
||||
import org.warp.picalculator.math.functions.Subtraction;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
|
||||
public class Equation extends FunctionOperator {
|
||||
|
||||
public Equation(MathContext root, Function value1, Function value2) {
|
||||
|
@ -1,15 +1,16 @@
|
||||
package org.warp.picalculator.math.functions.equations;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.warp.picalculator.Error;
|
||||
import org.warp.picalculator.math.MathContext;
|
||||
import org.warp.picalculator.math.Function;
|
||||
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.Number;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
|
||||
public class EquationsSystem extends FunctionDynamic {
|
||||
static final int spacing = 2;
|
||||
|
||||
|
@ -1,10 +1,11 @@
|
||||
package org.warp.picalculator.math.functions.equations;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
import org.warp.picalculator.Error;
|
||||
import org.warp.picalculator.math.MathContext;
|
||||
import org.warp.picalculator.math.Function;
|
||||
import org.warp.picalculator.math.FunctionSingle;
|
||||
import org.warp.picalculator.math.MathContext;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
|
||||
public class EquationsSystemPart extends FunctionSingle {
|
||||
|
||||
|
@ -1,11 +1,11 @@
|
||||
package org.warp.picalculator.math.functions.trigonometry;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
|
||||
import org.warp.picalculator.Error;
|
||||
import org.warp.picalculator.math.MathContext;
|
||||
import org.warp.picalculator.math.Function;
|
||||
import org.warp.picalculator.math.FunctionSingle;
|
||||
import org.warp.picalculator.math.MathContext;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
|
||||
public class ArcCosine extends FunctionSingle {
|
||||
|
||||
|
@ -1,11 +1,11 @@
|
||||
package org.warp.picalculator.math.functions.trigonometry;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
|
||||
import org.warp.picalculator.Error;
|
||||
import org.warp.picalculator.math.MathContext;
|
||||
import org.warp.picalculator.math.Function;
|
||||
import org.warp.picalculator.math.FunctionSingle;
|
||||
import org.warp.picalculator.math.MathContext;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
|
||||
public class ArcSine extends FunctionSingle {
|
||||
|
||||
|
@ -1,11 +1,11 @@
|
||||
package org.warp.picalculator.math.functions.trigonometry;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
|
||||
import org.warp.picalculator.Error;
|
||||
import org.warp.picalculator.math.MathContext;
|
||||
import org.warp.picalculator.math.Function;
|
||||
import org.warp.picalculator.math.FunctionSingle;
|
||||
import org.warp.picalculator.math.MathContext;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
|
||||
public class ArcTangent extends FunctionSingle {
|
||||
|
||||
|
@ -1,11 +1,11 @@
|
||||
package org.warp.picalculator.math.functions.trigonometry;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
|
||||
import org.warp.picalculator.Error;
|
||||
import org.warp.picalculator.math.MathContext;
|
||||
import org.warp.picalculator.math.Function;
|
||||
import org.warp.picalculator.math.FunctionSingle;
|
||||
import org.warp.picalculator.math.MathContext;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
|
||||
public class Cosine extends FunctionSingle {
|
||||
|
||||
|
@ -1,21 +1,22 @@
|
||||
package org.warp.picalculator.math.functions.trigonometry;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
|
||||
import org.nevec.rjm.BigDecimalMath;
|
||||
import org.warp.picalculator.Error;
|
||||
import org.warp.picalculator.math.AngleMode;
|
||||
import org.warp.picalculator.math.MathContext;
|
||||
import org.warp.picalculator.math.Function;
|
||||
import org.warp.picalculator.math.FunctionSingle;
|
||||
import org.warp.picalculator.math.MathContext;
|
||||
import org.warp.picalculator.math.functions.Number;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
|
||||
public class Sine extends FunctionSingle {
|
||||
|
||||
public Sine(MathContext root, Function value) {
|
||||
super(root, value);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@Override
|
||||
protected boolean isSolvable() {
|
||||
if (parameter instanceof Number) {
|
||||
|
@ -1,11 +1,11 @@
|
||||
package org.warp.picalculator.math.functions.trigonometry;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
|
||||
import org.warp.picalculator.Error;
|
||||
import org.warp.picalculator.math.MathContext;
|
||||
import org.warp.picalculator.math.Function;
|
||||
import org.warp.picalculator.math.FunctionSingle;
|
||||
import org.warp.picalculator.math.MathContext;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
|
||||
public class Tangent extends FunctionSingle {
|
||||
|
||||
|
@ -1,9 +1,5 @@
|
||||
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.Errors;
|
||||
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.MathContext;
|
||||
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.Power;
|
||||
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.Variable;
|
||||
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.FeatureDivision;
|
||||
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 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.ObjectListIterator;
|
||||
import sun.reflect.generics.reflectiveObjects.NotImplementedException;
|
||||
|
||||
public class MathParser {
|
||||
public static Expression parseInput(MathContext context, InputContainer c) throws Error {
|
||||
|
@ -1,7 +1,6 @@
|
||||
package org.warp.picalculator.math.parser.features;
|
||||
|
||||
import org.warp.picalculator.math.functions.Variable.V_TYPE;
|
||||
import org.warp.picalculator.math.parser.features.interfaces.Feature;
|
||||
|
||||
public class FeatureVariable extends FeatureChar {
|
||||
|
||||
|
@ -1,17 +1,17 @@
|
||||
package org.warp.picalculator.math.rules;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
|
||||
import org.warp.picalculator.Error;
|
||||
import org.warp.picalculator.math.MathContext;
|
||||
import org.warp.picalculator.math.Function;
|
||||
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.Negative;
|
||||
import org.warp.picalculator.math.functions.Subtraction;
|
||||
import org.warp.picalculator.math.functions.Sum;
|
||||
import org.warp.picalculator.math.functions.SumSubtraction;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
|
||||
/**
|
||||
* Expand rule<br>
|
||||
* <b>-(+a+b) = -a-b</b><br>
|
||||
|
@ -1,13 +1,13 @@
|
||||
package org.warp.picalculator.math.rules;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
|
||||
import org.warp.picalculator.Error;
|
||||
import org.warp.picalculator.math.Function;
|
||||
import org.warp.picalculator.math.functions.Expression;
|
||||
import org.warp.picalculator.math.functions.Negative;
|
||||
import org.warp.picalculator.math.functions.Subtraction;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
|
||||
/**
|
||||
* Expand rule<br>
|
||||
* <b>-(-a) = a</b>
|
||||
@ -36,8 +36,7 @@ public class ExpandRule5 {
|
||||
|
||||
public static ObjectArrayList<Function> execute(Function f) throws Error {
|
||||
final ObjectArrayList<Function> result = new ObjectArrayList<>();
|
||||
final Function a = null;
|
||||
|
||||
|
||||
if (f instanceof Negative) {
|
||||
final Negative fnc = (Negative) f;
|
||||
result.add(((Negative) ((Expression) fnc.getParameter()).getParameter(0)).getParameter());
|
||||
|
@ -1,13 +1,13 @@
|
||||
package org.warp.picalculator.math.rules;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
|
||||
import org.warp.picalculator.Error;
|
||||
import org.warp.picalculator.math.MathContext;
|
||||
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.Power;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
|
||||
/**
|
||||
* Exponent rule<br>
|
||||
* <b>1^a=1</b>
|
||||
|
@ -1,15 +1,15 @@
|
||||
package org.warp.picalculator.math.rules;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
|
||||
import org.warp.picalculator.Error;
|
||||
import org.warp.picalculator.math.MathContext;
|
||||
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.Multiplication;
|
||||
import org.warp.picalculator.math.functions.Number;
|
||||
import org.warp.picalculator.math.functions.Power;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
|
||||
/**
|
||||
* Exponent rule<br>
|
||||
* <b>a*a=a^2</b>
|
||||
|
@ -1,16 +1,16 @@
|
||||
package org.warp.picalculator.math.rules;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
|
||||
import org.warp.picalculator.Error;
|
||||
import org.warp.picalculator.math.MathContext;
|
||||
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.Multiplication;
|
||||
import org.warp.picalculator.math.functions.Number;
|
||||
import org.warp.picalculator.math.functions.Power;
|
||||
import org.warp.picalculator.math.functions.Sum;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
|
||||
/**
|
||||
* Exponent rule<br>
|
||||
* <b>(a ^ b) * (a ^ c) = a ^ (b + c)</b>
|
||||
|
@ -1,16 +1,16 @@
|
||||
package org.warp.picalculator.math.rules;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
|
||||
import org.warp.picalculator.Error;
|
||||
import org.warp.picalculator.math.MathContext;
|
||||
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.Multiplication;
|
||||
import org.warp.picalculator.math.functions.Number;
|
||||
import org.warp.picalculator.math.functions.Power;
|
||||
import org.warp.picalculator.math.functions.Root;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
|
||||
/**
|
||||
* Exponent rule<br>
|
||||
* <b>a√x=x^1/a</b>
|
||||
|
@ -1,12 +1,12 @@
|
||||
package org.warp.picalculator.math.rules;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
|
||||
import org.warp.picalculator.Error;
|
||||
import org.warp.picalculator.math.Function;
|
||||
import org.warp.picalculator.math.functions.Number;
|
||||
import org.warp.picalculator.math.functions.Power;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
|
||||
/**
|
||||
* Exponent rule<br>
|
||||
* <b>a^1=a</b>
|
||||
|
@ -1,12 +1,12 @@
|
||||
package org.warp.picalculator.math.rules;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
|
||||
import org.warp.picalculator.Error;
|
||||
import org.warp.picalculator.math.Function;
|
||||
import org.warp.picalculator.math.functions.Number;
|
||||
import org.warp.picalculator.math.functions.Power;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
|
||||
/**
|
||||
* Exponent rule<br>
|
||||
* <b>a^0=1</b>
|
||||
|
@ -1,15 +1,15 @@
|
||||
package org.warp.picalculator.math.rules;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
|
||||
import org.warp.picalculator.Error;
|
||||
import org.warp.picalculator.math.MathContext;
|
||||
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.Multiplication;
|
||||
import org.warp.picalculator.math.functions.Number;
|
||||
import org.warp.picalculator.math.functions.Power;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
|
||||
/**
|
||||
* Exponent rule<br>
|
||||
* <b>(a*b)^n=a^n*b^n</b>
|
||||
|
@ -1,14 +1,14 @@
|
||||
package org.warp.picalculator.math.rules;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
|
||||
import org.warp.picalculator.Error;
|
||||
import org.warp.picalculator.math.MathContext;
|
||||
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.Multiplication;
|
||||
import org.warp.picalculator.math.functions.Power;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
|
||||
/**
|
||||
* Exponent rule<br>
|
||||
* <b>(a ^ b) ^ c = a ^ (b * c)</b>
|
||||
|
@ -1,13 +1,13 @@
|
||||
package org.warp.picalculator.math.rules;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
|
||||
import org.warp.picalculator.Error;
|
||||
import org.warp.picalculator.math.MathContext;
|
||||
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.Number;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
|
||||
/**
|
||||
* Fractions rule<br>
|
||||
* <b>0 / a = 0</b>
|
||||
|
@ -1,13 +1,13 @@
|
||||
package org.warp.picalculator.math.rules;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
|
||||
import org.warp.picalculator.Error;
|
||||
import org.warp.picalculator.math.Function;
|
||||
import org.warp.picalculator.math.functions.Division;
|
||||
import org.warp.picalculator.math.functions.Expression;
|
||||
import org.warp.picalculator.math.functions.Multiplication;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
|
||||
/**
|
||||
* Fractions rule<br>
|
||||
* <b>a / (b / c) = (a * c) / b</b>
|
||||
|
@ -1,13 +1,13 @@
|
||||
package org.warp.picalculator.math.rules;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
|
||||
import org.warp.picalculator.Error;
|
||||
import org.warp.picalculator.math.Function;
|
||||
import org.warp.picalculator.math.functions.Division;
|
||||
import org.warp.picalculator.math.functions.Expression;
|
||||
import org.warp.picalculator.math.functions.Multiplication;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
|
||||
/**
|
||||
* Fractions rule<br>
|
||||
* <b>(b / c) / a = b / (a * c)</b>
|
||||
|
@ -1,13 +1,13 @@
|
||||
package org.warp.picalculator.math.rules;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
|
||||
import org.warp.picalculator.Error;
|
||||
import org.warp.picalculator.math.Function;
|
||||
import org.warp.picalculator.math.functions.Division;
|
||||
import org.warp.picalculator.math.functions.Expression;
|
||||
import org.warp.picalculator.math.functions.Multiplication;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
|
||||
/**
|
||||
* Fractions rule<br>
|
||||
* <b>(a / b) * (c / d) = (a * c) / (b * d)</b>
|
||||
|
@ -1,12 +1,12 @@
|
||||
package org.warp.picalculator.math.rules;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
|
||||
import org.warp.picalculator.Error;
|
||||
import org.warp.picalculator.math.Function;
|
||||
import org.warp.picalculator.math.functions.Division;
|
||||
import org.warp.picalculator.math.functions.Number;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
|
||||
/**
|
||||
* Fractions rule<br>
|
||||
* <b>a / 1 = a</b>
|
||||
|
@ -1,12 +1,12 @@
|
||||
package org.warp.picalculator.math.rules;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
|
||||
import org.warp.picalculator.Error;
|
||||
import org.warp.picalculator.math.Function;
|
||||
import org.warp.picalculator.math.functions.Division;
|
||||
import org.warp.picalculator.math.functions.Number;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
|
||||
/**
|
||||
* Fractions rule<br>
|
||||
* <b>a / a = 1</b>
|
||||
|
@ -1,13 +1,13 @@
|
||||
package org.warp.picalculator.math.rules;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
|
||||
import org.warp.picalculator.Error;
|
||||
import org.warp.picalculator.math.Function;
|
||||
import org.warp.picalculator.math.functions.Division;
|
||||
import org.warp.picalculator.math.functions.Number;
|
||||
import org.warp.picalculator.math.functions.Power;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
|
||||
/**
|
||||
* Fractions rule<br>
|
||||
* <b>(a / b) ^ -1 = b / a</b>
|
||||
|
@ -1,15 +1,16 @@
|
||||
package org.warp.picalculator.math.rules;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
|
||||
import org.warp.picalculator.Error;
|
||||
import org.warp.picalculator.math.MathContext;
|
||||
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.Number;
|
||||
import org.warp.picalculator.math.functions.Power;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
|
||||
/**
|
||||
* Fractions rule<br>
|
||||
* <b>(a / b) ^ -c = (b / a) ^ c</b>
|
||||
|
@ -1,13 +1,13 @@
|
||||
package org.warp.picalculator.math.rules;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
|
||||
import org.warp.picalculator.Error;
|
||||
import org.warp.picalculator.math.MathContext;
|
||||
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.Number;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
|
||||
/**
|
||||
* Number rule<br>
|
||||
* <b>a * 0 = 0</b>
|
||||
|
@ -1,13 +1,13 @@
|
||||
package org.warp.picalculator.math.rules;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
|
||||
import org.warp.picalculator.Error;
|
||||
import org.warp.picalculator.math.MathContext;
|
||||
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.Number;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
|
||||
/**
|
||||
* Number rule<br>
|
||||
* <b>a * 1 = a</b>
|
||||
|
@ -1,10 +1,8 @@
|
||||
package org.warp.picalculator.math.rules;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
|
||||
import org.warp.picalculator.Error;
|
||||
import org.warp.picalculator.math.MathContext;
|
||||
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.Negative;
|
||||
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.SumSubtraction;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
|
||||
/**
|
||||
* Number rule<br>
|
||||
* <b>a - a = 0</b><br>
|
||||
|
@ -1,14 +1,14 @@
|
||||
package org.warp.picalculator.math.rules;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
|
||||
import org.warp.picalculator.Error;
|
||||
import org.warp.picalculator.math.MathContext;
|
||||
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.Sum;
|
||||
import org.warp.picalculator.math.functions.SumSubtraction;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
|
||||
/**
|
||||
* Number rule<br>
|
||||
* <b>a ± b = {a+b, a-b}</b>
|
||||
|
@ -1,13 +1,13 @@
|
||||
package org.warp.picalculator.math.rules;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
|
||||
import org.warp.picalculator.Error;
|
||||
import org.warp.picalculator.math.MathContext;
|
||||
import org.warp.picalculator.math.Function;
|
||||
import org.warp.picalculator.math.FunctionOperator;
|
||||
import org.warp.picalculator.math.MathContext;
|
||||
import org.warp.picalculator.math.functions.Number;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
|
||||
/**
|
||||
* Number rule<br>
|
||||
* <b>a + 0 = a</b><br>
|
||||
|
@ -1,14 +1,14 @@
|
||||
package org.warp.picalculator.math.rules;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
|
||||
import org.warp.picalculator.Error;
|
||||
import org.warp.picalculator.math.MathContext;
|
||||
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.Negative;
|
||||
import org.warp.picalculator.math.functions.Number;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
|
||||
/**
|
||||
* Number rule<br>
|
||||
* <b>a * -1 = -a</b>
|
||||
|
@ -1,14 +1,14 @@
|
||||
package org.warp.picalculator.math.rules;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
|
||||
import org.warp.picalculator.Error;
|
||||
import org.warp.picalculator.math.MathContext;
|
||||
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.Number;
|
||||
import org.warp.picalculator.math.functions.Sum;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
|
||||
/**
|
||||
* Number rule<br>
|
||||
* <b>a + a = 2a</b>
|
||||
|
@ -1,14 +1,14 @@
|
||||
package org.warp.picalculator.math.rules;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
|
||||
import org.warp.picalculator.Error;
|
||||
import org.warp.picalculator.math.MathContext;
|
||||
import org.warp.picalculator.math.Function;
|
||||
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.Sum;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
|
||||
/**
|
||||
* Syntax rule<br>
|
||||
* <b>(a*b)*c=a*(b*c)</b>
|
||||
|
@ -1,13 +1,13 @@
|
||||
package org.warp.picalculator.math.rules;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
|
||||
import org.warp.picalculator.Error;
|
||||
import org.warp.picalculator.math.MathContext;
|
||||
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.Sum;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
|
||||
/**
|
||||
* Syntax rule<br>
|
||||
* <b>a+(b+c)=(a+b)+c</b>
|
||||
|
@ -1,14 +1,14 @@
|
||||
package org.warp.picalculator.math.rules;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
|
||||
import org.warp.picalculator.Error;
|
||||
import org.warp.picalculator.math.MathContext;
|
||||
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.Power;
|
||||
import org.warp.picalculator.math.functions.Undefined;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
|
||||
/**
|
||||
* Undefined rule<br>
|
||||
* <b>0^0=undefined</b>
|
||||
|
@ -1,14 +1,14 @@
|
||||
package org.warp.picalculator.math.rules;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
|
||||
import org.warp.picalculator.Error;
|
||||
import org.warp.picalculator.math.MathContext;
|
||||
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.Number;
|
||||
import org.warp.picalculator.math.functions.Undefined;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
|
||||
/**
|
||||
* Undefined rule<br>
|
||||
* <b>a / 0 = undefined</b>
|
||||
|
@ -1,16 +1,16 @@
|
||||
package org.warp.picalculator.math.rules;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
|
||||
import org.warp.picalculator.Error;
|
||||
import org.warp.picalculator.math.MathContext;
|
||||
import org.warp.picalculator.math.Function;
|
||||
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.Multiplication;
|
||||
import org.warp.picalculator.math.functions.Subtraction;
|
||||
import org.warp.picalculator.math.functions.Sum;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
|
||||
/**
|
||||
* Variable rule<br>
|
||||
* <b>ax+bx=(a+b)*x (a,b NUMBER; x VARIABLE|MULTIPLICATION)</b>
|
||||
|
@ -1,17 +1,17 @@
|
||||
package org.warp.picalculator.math.rules;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
|
||||
import org.warp.picalculator.Error;
|
||||
import org.warp.picalculator.math.MathContext;
|
||||
import org.warp.picalculator.math.Function;
|
||||
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.Multiplication;
|
||||
import org.warp.picalculator.math.functions.Number;
|
||||
import org.warp.picalculator.math.functions.Subtraction;
|
||||
import org.warp.picalculator.math.functions.Sum;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
|
||||
/**
|
||||
* Variable rule<br>
|
||||
* <b>ax+x=(a+1)*x (a,b NUMBER; x VARIABLES)</b>
|
||||
|
@ -1,17 +1,17 @@
|
||||
package org.warp.picalculator.math.rules;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
|
||||
import org.warp.picalculator.Error;
|
||||
import org.warp.picalculator.math.MathContext;
|
||||
import org.warp.picalculator.math.Function;
|
||||
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.Multiplication;
|
||||
import org.warp.picalculator.math.functions.Number;
|
||||
import org.warp.picalculator.math.functions.Subtraction;
|
||||
import org.warp.picalculator.math.functions.Sum;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
|
||||
/**
|
||||
* Variable rule<br>
|
||||
* <b>x+ax=(a+1)*x (a,b NUMBER; x VARIABLES)</b>
|
||||
|
@ -1,14 +1,14 @@
|
||||
package org.warp.picalculator.math.rules.methods;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
|
||||
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.MathContext;
|
||||
import org.warp.picalculator.math.functions.Division;
|
||||
import org.warp.picalculator.math.functions.Multiplication;
|
||||
import org.warp.picalculator.math.functions.Number;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
|
||||
/**
|
||||
* Division method<br>
|
||||
* <b>Example: (XY)/(YZ) = X/Z</b>
|
||||
|
@ -1,13 +1,13 @@
|
||||
package org.warp.picalculator.math.rules.methods;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
|
||||
import org.warp.picalculator.Error;
|
||||
import org.warp.picalculator.math.MathContext;
|
||||
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.Number;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
|
||||
/**
|
||||
* Multiplication method<br>
|
||||
* <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
Loading…
Reference in New Issue
Block a user