Changed the internal structure of the function parser
This commit is contained in:
parent
3ab1e7102c
commit
845e4cdfe0
@ -1,10 +1,13 @@
|
|||||||
package org.warp.picalculator.gui.expression.blocks;
|
package org.warp.picalculator.gui.expression.blocks;
|
||||||
|
|
||||||
|
import org.warp.picalculator.Error;
|
||||||
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.ExtraMenu;
|
import org.warp.picalculator.gui.expression.ExtraMenu;
|
||||||
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.MathContext;
|
||||||
|
import org.warp.picalculator.math.parser.features.interfaces.Feature;
|
||||||
|
|
||||||
public abstract class Block implements GraphicalElement {
|
public abstract class Block implements GraphicalElement {
|
||||||
|
|
||||||
@ -56,10 +59,10 @@ public abstract class Block implements GraphicalElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public abstract void setSmall(boolean small);
|
public abstract void setSmall(boolean small);
|
||||||
|
|
||||||
public abstract int getClassID();
|
|
||||||
|
|
||||||
public ExtraMenu<?> getExtraMenu() {
|
public ExtraMenu<?> getExtraMenu() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public abstract Feature toFeature(MathContext context) throws Error;
|
||||||
}
|
}
|
||||||
|
@ -3,11 +3,12 @@ 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.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.MathContext;
|
||||||
|
import org.warp.picalculator.math.parser.features.FeatureChar;
|
||||||
|
import org.warp.picalculator.math.parser.features.interfaces.Feature;
|
||||||
|
|
||||||
public class BlockChar extends Block {
|
public class BlockChar extends Block {
|
||||||
|
|
||||||
public static final int CLASS_ID = 0x00000001;
|
|
||||||
|
|
||||||
private final char ch;
|
private final char ch;
|
||||||
|
|
||||||
public BlockChar(char ch) {
|
public BlockChar(char ch) {
|
||||||
@ -54,14 +55,14 @@ public class BlockChar extends Block {
|
|||||||
return ch;
|
return ch;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getClassID() {
|
|
||||||
return CLASS_ID;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int computeCaretMaxBound() {
|
public int computeCaretMaxBound() {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Feature toFeature(MathContext context) {
|
||||||
|
return new FeatureChar(getChar());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,17 @@
|
|||||||
package org.warp.picalculator.gui.expression.blocks;
|
package org.warp.picalculator.gui.expression.blocks;
|
||||||
|
|
||||||
|
import org.warp.picalculator.Error;
|
||||||
|
import org.warp.picalculator.Errors;
|
||||||
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;
|
||||||
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.Function;
|
||||||
|
import org.warp.picalculator.math.MathContext;
|
||||||
|
import org.warp.picalculator.math.parser.MathParser;
|
||||||
|
import org.warp.picalculator.math.parser.features.interfaces.Feature;
|
||||||
|
|
||||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||||
|
|
||||||
@ -340,4 +346,18 @@ public class BlockContainer implements GraphicalElement {
|
|||||||
return maxpos + 1;
|
return maxpos + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Function toFunction(MathContext context) throws Error {
|
||||||
|
ObjectArrayList<Block> blocks = getContent();
|
||||||
|
final ObjectArrayList<Feature> blockFeatures = new ObjectArrayList<>();
|
||||||
|
|
||||||
|
for (final Block block : blocks) {
|
||||||
|
final Feature blockFeature = block.toFeature(context);
|
||||||
|
if (blockFeature == null) throw new Error(Errors.NOT_IMPLEMENTED, "The block " + block.getClass().getSimpleName() + " isn't a known Block");
|
||||||
|
blockFeatures.add(blockFeature);
|
||||||
|
}
|
||||||
|
|
||||||
|
final Function result = MathParser.joinFeatures(context, blockFeatures);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -1,13 +1,16 @@
|
|||||||
package org.warp.picalculator.gui.expression.blocks;
|
package org.warp.picalculator.gui.expression.blocks;
|
||||||
|
|
||||||
|
import org.warp.picalculator.Error;
|
||||||
import org.warp.picalculator.gui.expression.Caret;
|
import org.warp.picalculator.gui.expression.Caret;
|
||||||
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.Function;
|
||||||
|
import org.warp.picalculator.math.MathContext;
|
||||||
|
import org.warp.picalculator.math.parser.features.FeatureDivision;
|
||||||
|
import org.warp.picalculator.math.parser.features.interfaces.Feature;
|
||||||
|
|
||||||
public class BlockDivision extends Block {
|
public class BlockDivision extends Block {
|
||||||
|
|
||||||
public static final int CLASS_ID = 0x00000002;
|
|
||||||
|
|
||||||
private final BlockContainer containerUp;
|
private final BlockContainer containerUp;
|
||||||
private final BlockContainer containerDown;
|
private final BlockContainer containerDown;
|
||||||
|
|
||||||
@ -104,13 +107,15 @@ public class BlockDivision extends Block {
|
|||||||
return containerDown;
|
return containerDown;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getClassID() {
|
|
||||||
return CLASS_ID;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int computeCaretMaxBound() {
|
public int computeCaretMaxBound() {
|
||||||
return containerUp.computeCaretMaxBound() + containerDown.computeCaretMaxBound();
|
return containerUp.computeCaretMaxBound() + containerDown.computeCaretMaxBound();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Feature toFeature(MathContext context) throws Error {
|
||||||
|
final Function upper = getUpperContainer().toFunction(context);
|
||||||
|
final Function lower = getLowerContainer().toFunction(context);
|
||||||
|
return new FeatureDivision(upper, lower);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,8 +7,6 @@ import org.warp.picalculator.gui.graphicengine.Renderer;
|
|||||||
public class BlockExponentialNotation extends BlockPower {
|
public class BlockExponentialNotation extends BlockPower {
|
||||||
private int bw;
|
private int bw;
|
||||||
private int bh;
|
private int bh;
|
||||||
|
|
||||||
public static final int CLASS_ID = 0x00000006;
|
|
||||||
|
|
||||||
@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) {
|
||||||
@ -25,9 +23,4 @@ public class BlockExponentialNotation extends BlockPower {
|
|||||||
bh = BlockContainer.getDefaultCharHeight(small);
|
bh = BlockContainer.getDefaultCharHeight(small);
|
||||||
this.width+=bw;
|
this.width+=bw;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getClassID() {
|
|
||||||
return CLASS_ID;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,13 +1,16 @@
|
|||||||
package org.warp.picalculator.gui.expression.blocks;
|
package org.warp.picalculator.gui.expression.blocks;
|
||||||
|
|
||||||
|
import org.warp.picalculator.Error;
|
||||||
import org.warp.picalculator.gui.expression.Caret;
|
import org.warp.picalculator.gui.expression.Caret;
|
||||||
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.Function;
|
||||||
|
import org.warp.picalculator.math.MathContext;
|
||||||
|
import org.warp.picalculator.math.parser.features.FeatureParenthesis;
|
||||||
|
import org.warp.picalculator.math.parser.features.interfaces.Feature;
|
||||||
|
|
||||||
public class BlockParenthesis extends Block {
|
public class BlockParenthesis extends Block {
|
||||||
|
|
||||||
public static final int CLASS_ID = 0x00000004;
|
|
||||||
|
|
||||||
private final BlockContainer containerNumber;
|
private final BlockContainer containerNumber;
|
||||||
|
|
||||||
private int chw;
|
private int chw;
|
||||||
@ -76,14 +79,15 @@ public class BlockParenthesis extends Block {
|
|||||||
return containerNumber;
|
return containerNumber;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getClassID() {
|
|
||||||
return CLASS_ID;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int computeCaretMaxBound() {
|
public int computeCaretMaxBound() {
|
||||||
return containerNumber.computeCaretMaxBound();
|
return containerNumber.computeCaretMaxBound();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Feature toFeature(MathContext context) throws Error {
|
||||||
|
final Function cont = getNumberContainer().toFunction(context);
|
||||||
|
return new FeatureParenthesis(cont);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,13 +1,16 @@
|
|||||||
package org.warp.picalculator.gui.expression.blocks;
|
package org.warp.picalculator.gui.expression.blocks;
|
||||||
|
|
||||||
|
import org.warp.picalculator.Error;
|
||||||
import org.warp.picalculator.gui.expression.Caret;
|
import org.warp.picalculator.gui.expression.Caret;
|
||||||
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.Function;
|
||||||
|
import org.warp.picalculator.math.MathContext;
|
||||||
|
import org.warp.picalculator.math.parser.features.FeaturePower;
|
||||||
|
import org.warp.picalculator.math.parser.features.interfaces.Feature;
|
||||||
|
|
||||||
public class BlockPower extends Block {
|
public class BlockPower extends Block {
|
||||||
|
|
||||||
public static final int CLASS_ID = 0x00000005;
|
|
||||||
|
|
||||||
private final BlockContainer containerExponent;
|
private final BlockContainer containerExponent;
|
||||||
|
|
||||||
public BlockPower() {
|
public BlockPower() {
|
||||||
@ -67,13 +70,14 @@ public class BlockPower extends Block {
|
|||||||
return containerExponent;
|
return containerExponent;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getClassID() {
|
|
||||||
return CLASS_ID;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int computeCaretMaxBound() {
|
public int computeCaretMaxBound() {
|
||||||
return containerExponent.computeCaretMaxBound();
|
return containerExponent.computeCaretMaxBound();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Feature toFeature(MathContext context) throws Error {
|
||||||
|
final Function exp = getExponentContainer().toFunction(context);
|
||||||
|
return new FeaturePower(exp);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,13 +1,16 @@
|
|||||||
package org.warp.picalculator.gui.expression.blocks;
|
package org.warp.picalculator.gui.expression.blocks;
|
||||||
|
|
||||||
|
import org.warp.picalculator.Error;
|
||||||
import org.warp.picalculator.gui.expression.Caret;
|
import org.warp.picalculator.gui.expression.Caret;
|
||||||
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.Function;
|
||||||
|
import org.warp.picalculator.math.MathContext;
|
||||||
|
import org.warp.picalculator.math.parser.features.FeatureSquareRoot;
|
||||||
|
import org.warp.picalculator.math.parser.features.interfaces.Feature;
|
||||||
|
|
||||||
public class BlockSquareRoot extends Block {
|
public class BlockSquareRoot extends Block {
|
||||||
|
|
||||||
public static final int CLASS_ID = 0x00000003;
|
|
||||||
|
|
||||||
private final BlockContainer containerNumber;
|
private final BlockContainer containerNumber;
|
||||||
|
|
||||||
private int h1;
|
private int h1;
|
||||||
@ -82,13 +85,14 @@ public class BlockSquareRoot extends Block {
|
|||||||
return containerNumber;
|
return containerNumber;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getClassID() {
|
|
||||||
return CLASS_ID;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int computeCaretMaxBound() {
|
public int computeCaretMaxBound() {
|
||||||
return containerNumber.computeCaretMaxBound();
|
return containerNumber.computeCaretMaxBound();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Feature toFeature(MathContext context) throws Error {
|
||||||
|
final Function contnt = getNumberContainer().toFunction(context);
|
||||||
|
return new FeatureSquareRoot(contnt);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package org.warp.picalculator.gui.expression.blocks;
|
package org.warp.picalculator.gui.expression.blocks;
|
||||||
|
|
||||||
|
import org.warp.picalculator.Error;
|
||||||
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.Caret;
|
import org.warp.picalculator.gui.expression.Caret;
|
||||||
@ -8,12 +9,12 @@ 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.MathContext;
|
||||||
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 BlockVariable extends Block {
|
public class BlockVariable extends Block {
|
||||||
|
|
||||||
public static final int CLASS_ID = 0x00000007;
|
|
||||||
|
|
||||||
private InputContext ic;
|
private InputContext ic;
|
||||||
private final char ch;
|
private final char ch;
|
||||||
private final VariableMenu menu;
|
private final VariableMenu menu;
|
||||||
@ -111,11 +112,6 @@ public class BlockVariable extends Block {
|
|||||||
return ch;
|
return ch;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getClassID() {
|
|
||||||
return CLASS_ID;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int computeCaretMaxBound() {
|
public int computeCaretMaxBound() {
|
||||||
return 0;
|
return 0;
|
||||||
@ -242,4 +238,10 @@ public class BlockVariable extends Block {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Feature toFeature(MathContext context) throws Error {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@ package org.warp.picalculator.gui.expression.containers;
|
|||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
import org.warp.picalculator.Error;
|
||||||
import org.warp.picalculator.device.KeyboardEventListener;
|
import org.warp.picalculator.device.KeyboardEventListener;
|
||||||
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;
|
||||||
@ -13,6 +14,10 @@ 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 org.warp.picalculator.math.Function;
|
||||||
|
import org.warp.picalculator.math.MathContext;
|
||||||
|
import org.warp.picalculator.math.parser.MathParser;
|
||||||
|
import org.warp.picalculator.math.parser.features.interfaces.Feature;
|
||||||
|
|
||||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||||
|
|
||||||
@ -246,5 +251,8 @@ public abstract class InputContainer implements GraphicalElement, InputLayout, S
|
|||||||
public KeyboardEventListener getExtraKeyboardEventListener() {
|
public KeyboardEventListener getExtraKeyboardEventListener() {
|
||||||
return extra;
|
return extra;
|
||||||
}
|
}
|
||||||
|
public Function toFunction(MathContext context) throws Error {
|
||||||
|
return root.toFunction(context);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,9 @@ package org.warp.picalculator.math;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.warp.picalculator.Error;
|
import org.warp.picalculator.Error;
|
||||||
|
import org.warp.picalculator.gui.expression.blocks.Block;
|
||||||
|
|
||||||
|
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||||
|
|
||||||
public interface Function {
|
public interface Function {
|
||||||
|
|
||||||
@ -62,4 +65,12 @@ public interface Function {
|
|||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public boolean isSimplified();
|
public boolean isSimplified();
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param context Mathematical Context
|
||||||
|
* @return An ArrayList of parsed Blocks
|
||||||
|
* @throws Error
|
||||||
|
*/
|
||||||
|
public ObjectArrayList<Block> toBlock(MathContext context) throws Error;
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,14 @@
|
|||||||
package org.warp.picalculator.math.functions;
|
package org.warp.picalculator.math.functions;
|
||||||
|
|
||||||
import org.warp.picalculator.Error;
|
import org.warp.picalculator.Error;
|
||||||
|
import org.warp.picalculator.gui.expression.blocks.Block;
|
||||||
|
import org.warp.picalculator.gui.expression.blocks.BlockChar;
|
||||||
|
import org.warp.picalculator.gui.expression.blocks.BlockContainer;
|
||||||
|
import org.warp.picalculator.gui.expression.blocks.BlockDivision;
|
||||||
import org.warp.picalculator.math.Function;
|
import org.warp.picalculator.math.Function;
|
||||||
import org.warp.picalculator.math.FunctionOperator;
|
import org.warp.picalculator.math.FunctionOperator;
|
||||||
import org.warp.picalculator.math.MathContext;
|
import org.warp.picalculator.math.MathContext;
|
||||||
|
import org.warp.picalculator.math.MathematicalSymbols;
|
||||||
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;
|
||||||
@ -96,4 +101,25 @@ public class Division extends FunctionOperator {
|
|||||||
public String toString() {
|
public String toString() {
|
||||||
return "(" + getParameter1() + ")/(" + getParameter2() + ")";
|
return "(" + getParameter1() + ")/(" + getParameter2() + ")";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ObjectArrayList<Block> toBlock(MathContext context) throws Error {
|
||||||
|
ObjectArrayList<Block> result = new ObjectArrayList<>();
|
||||||
|
ObjectArrayList<Block> sub1 = getParameter1().toBlock(context);
|
||||||
|
ObjectArrayList<Block> sub2 = getParameter2().toBlock(context);
|
||||||
|
BlockDivision bd = new BlockDivision();
|
||||||
|
BlockContainer uc = bd.getUpperContainer();
|
||||||
|
BlockContainer lc = bd.getLowerContainer();
|
||||||
|
for (Block b : sub1) {
|
||||||
|
uc.appendBlockUnsafe(b);
|
||||||
|
}
|
||||||
|
for (Block b : sub2) {
|
||||||
|
lc.appendBlockUnsafe(b);
|
||||||
|
}
|
||||||
|
uc.recomputeDimensions();
|
||||||
|
lc.recomputeDimensions();
|
||||||
|
bd.recomputeDimensions();
|
||||||
|
result.add(bd);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
}
|
}
|
@ -1,6 +1,7 @@
|
|||||||
package org.warp.picalculator.math.functions;
|
package org.warp.picalculator.math.functions;
|
||||||
|
|
||||||
import org.warp.picalculator.Error;
|
import org.warp.picalculator.Error;
|
||||||
|
import org.warp.picalculator.gui.expression.blocks.Block;
|
||||||
import org.warp.picalculator.math.Function;
|
import org.warp.picalculator.math.Function;
|
||||||
import org.warp.picalculator.math.MathContext;
|
import org.warp.picalculator.math.MathContext;
|
||||||
|
|
||||||
@ -50,4 +51,10 @@ public class EmptyNumber implements Function {
|
|||||||
throw new IndexOutOfBoundsException();
|
throw new IndexOutOfBoundsException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ObjectArrayList<Block> toBlock(MathContext context) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,9 @@ 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.gui.expression.blocks.Block;
|
||||||
|
import org.warp.picalculator.gui.expression.blocks.BlockContainer;
|
||||||
|
import org.warp.picalculator.gui.expression.blocks.BlockParenthesis;
|
||||||
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.FunctionOperator;
|
import org.warp.picalculator.math.FunctionOperator;
|
||||||
@ -624,6 +627,21 @@ public class Expression extends FunctionDynamic {
|
|||||||
return parenthesisneeded;
|
return parenthesisneeded;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ObjectArrayList<Block> toBlock(MathContext context) throws Error {
|
||||||
|
ObjectArrayList<Block> result = new ObjectArrayList<>();
|
||||||
|
ObjectArrayList<Block> sub = getParameter(0).toBlock(context);
|
||||||
|
BlockParenthesis bp = new BlockParenthesis();
|
||||||
|
BlockContainer bpc = bp.getNumberContainer();
|
||||||
|
for (Block b : sub) {
|
||||||
|
bpc.appendBlockUnsafe(b);
|
||||||
|
}
|
||||||
|
bpc.recomputeDimensions();
|
||||||
|
bp.recomputeDimensions();
|
||||||
|
result.add(bp);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
String s = "(";
|
String s = "(";
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
package org.warp.picalculator.math.functions;
|
package org.warp.picalculator.math.functions;
|
||||||
|
|
||||||
import org.warp.picalculator.Error;
|
import org.warp.picalculator.Error;
|
||||||
|
import org.warp.picalculator.Errors;
|
||||||
|
import org.warp.picalculator.gui.expression.blocks.Block;
|
||||||
import org.warp.picalculator.math.Function;
|
import org.warp.picalculator.math.Function;
|
||||||
import org.warp.picalculator.math.MathContext;
|
import org.warp.picalculator.math.MathContext;
|
||||||
|
|
||||||
@ -53,4 +55,10 @@ public class Joke implements Function {
|
|||||||
throw new IndexOutOfBoundsException();
|
throw new IndexOutOfBoundsException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ObjectArrayList<Block> toBlock(MathContext context) throws Error {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
throw new Error(Errors.NOT_IMPLEMENTED, "Unknown function " + getClass().getSimpleName());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,12 @@
|
|||||||
package org.warp.picalculator.math.functions;
|
package org.warp.picalculator.math.functions;
|
||||||
|
|
||||||
import org.warp.picalculator.Error;
|
import org.warp.picalculator.Error;
|
||||||
|
import org.warp.picalculator.gui.expression.blocks.Block;
|
||||||
|
import org.warp.picalculator.gui.expression.blocks.BlockChar;
|
||||||
import org.warp.picalculator.math.Function;
|
import org.warp.picalculator.math.Function;
|
||||||
import org.warp.picalculator.math.FunctionOperator;
|
import org.warp.picalculator.math.FunctionOperator;
|
||||||
import org.warp.picalculator.math.MathContext;
|
import org.warp.picalculator.math.MathContext;
|
||||||
|
import org.warp.picalculator.math.MathematicalSymbols;
|
||||||
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;
|
||||||
@ -106,4 +109,22 @@ public class Multiplication extends FunctionOperator {
|
|||||||
public String toString() {
|
public String toString() {
|
||||||
return "(" + parameter1.toString() + ")*(" + parameter2.toString() + ")";
|
return "(" + parameter1.toString() + ")*(" + parameter2.toString() + ")";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ObjectArrayList<Block> toBlock(MathContext context) throws Error {
|
||||||
|
ObjectArrayList<Block> result = new ObjectArrayList<>();
|
||||||
|
ObjectArrayList<Block> sub1 = getParameter1().toBlock(context);
|
||||||
|
ObjectArrayList<Block> sub2 = getParameter2().toBlock(context);
|
||||||
|
Block nearLeft = sub1.get(sub1.size()-1);
|
||||||
|
Block nearRight = sub2.get(0);
|
||||||
|
|
||||||
|
result.addAll(sub1);
|
||||||
|
if (nearLeft instanceof BlockChar && nearRight instanceof BlockChar) {
|
||||||
|
|
||||||
|
} else {
|
||||||
|
result.add(new BlockChar(MathematicalSymbols.MULTIPLICATION));
|
||||||
|
}
|
||||||
|
result.addAll(sub2);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
}
|
}
|
@ -2,6 +2,7 @@ package org.warp.picalculator.math.functions;
|
|||||||
|
|
||||||
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.math.Function;
|
import org.warp.picalculator.math.Function;
|
||||||
import org.warp.picalculator.math.FunctionSingle;
|
import org.warp.picalculator.math.FunctionSingle;
|
||||||
import org.warp.picalculator.math.MathContext;
|
import org.warp.picalculator.math.MathContext;
|
||||||
@ -78,4 +79,10 @@ public class Negative extends FunctionSingle {
|
|||||||
public Negative clone() {
|
public Negative clone() {
|
||||||
return new Negative(mathContext, parameter);
|
return new Negative(mathContext, parameter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ObjectArrayList<Block> toBlock(MathContext context) throws Error {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
throw new Error(Errors.NOT_IMPLEMENTED, "Unknown function " + getClass().getSimpleName());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,11 @@ 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.gui.expression.blocks.Block;
|
||||||
|
import org.warp.picalculator.gui.expression.blocks.BlockChar;
|
||||||
|
import org.warp.picalculator.gui.expression.blocks.BlockContainer;
|
||||||
|
import org.warp.picalculator.gui.expression.blocks.BlockExponentialNotation;
|
||||||
|
import org.warp.picalculator.gui.expression.blocks.BlockPower;
|
||||||
import org.warp.picalculator.math.Function;
|
import org.warp.picalculator.math.Function;
|
||||||
import org.warp.picalculator.math.MathContext;
|
import org.warp.picalculator.math.MathContext;
|
||||||
|
|
||||||
@ -220,6 +225,32 @@ public class Number implements Function {
|
|||||||
return fs;
|
return fs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ObjectArrayList<Block> toBlock(MathContext context) {
|
||||||
|
ObjectArrayList<Block> result = new ObjectArrayList<>();
|
||||||
|
String numberString = this.toString();
|
||||||
|
if (numberString.contains("ℯ℮")) {
|
||||||
|
String[] numberParts = numberString.split("ℯ℮", 2);
|
||||||
|
BlockPower bp = new BlockExponentialNotation();
|
||||||
|
BlockContainer bpec = bp.getExponentContainer();
|
||||||
|
for (char c : numberParts[0].toCharArray()) {
|
||||||
|
result.add(new BlockChar(c));
|
||||||
|
}
|
||||||
|
for (char c : numberParts[1].toCharArray()) {
|
||||||
|
bpec.appendBlockUnsafe(new BlockChar(c));
|
||||||
|
};
|
||||||
|
bpec.recomputeDimensions();
|
||||||
|
bp.recomputeDimensions();
|
||||||
|
result.add(bp);
|
||||||
|
return result;
|
||||||
|
} else {
|
||||||
|
for (char c : numberString.toCharArray()) {
|
||||||
|
result.add(new BlockChar(c));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Function setParameter(int index, Function var) throws IndexOutOfBoundsException {
|
public Function setParameter(int index, Function var) throws IndexOutOfBoundsException {
|
||||||
throw new IndexOutOfBoundsException();
|
throw new IndexOutOfBoundsException();
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
package org.warp.picalculator.math.functions;
|
package org.warp.picalculator.math.functions;
|
||||||
|
|
||||||
import org.warp.picalculator.Error;
|
import org.warp.picalculator.Error;
|
||||||
|
import org.warp.picalculator.gui.expression.blocks.Block;
|
||||||
|
import org.warp.picalculator.gui.expression.blocks.BlockContainer;
|
||||||
|
import org.warp.picalculator.gui.expression.blocks.BlockPower;
|
||||||
import org.warp.picalculator.math.Function;
|
import org.warp.picalculator.math.Function;
|
||||||
import org.warp.picalculator.math.FunctionOperator;
|
import org.warp.picalculator.math.FunctionOperator;
|
||||||
import org.warp.picalculator.math.MathContext;
|
import org.warp.picalculator.math.MathContext;
|
||||||
@ -91,4 +94,21 @@ public class Power extends FunctionOperator {
|
|||||||
public Power clone() {
|
public Power clone() {
|
||||||
return new Power(mathContext, parameter1, parameter2);
|
return new Power(mathContext, parameter1, parameter2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ObjectArrayList<Block> toBlock(MathContext context) throws Error {
|
||||||
|
ObjectArrayList<Block> result = new ObjectArrayList<>();
|
||||||
|
ObjectArrayList<Block> sub1 = getParameter1().toBlock(context);
|
||||||
|
ObjectArrayList<Block> sub2 = getParameter2().toBlock(context);
|
||||||
|
BlockPower bp = new BlockPower();
|
||||||
|
BlockContainer ec = bp.getExponentContainer();
|
||||||
|
result.addAll(sub1);
|
||||||
|
for (Block b : sub2) {
|
||||||
|
ec.appendBlockUnsafe(b);
|
||||||
|
}
|
||||||
|
ec.recomputeDimensions();
|
||||||
|
bp.recomputeDimensions();
|
||||||
|
result.add(bp);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,8 @@ import java.math.BigDecimal;
|
|||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
|
|
||||||
import org.warp.picalculator.Error;
|
import org.warp.picalculator.Error;
|
||||||
|
import org.warp.picalculator.Errors;
|
||||||
|
import org.warp.picalculator.gui.expression.blocks.Block;
|
||||||
import org.warp.picalculator.math.Function;
|
import org.warp.picalculator.math.Function;
|
||||||
import org.warp.picalculator.math.FunctionOperator;
|
import org.warp.picalculator.math.FunctionOperator;
|
||||||
import org.warp.picalculator.math.MathContext;
|
import org.warp.picalculator.math.MathContext;
|
||||||
@ -73,5 +75,11 @@ public class Root extends FunctionOperator {
|
|||||||
public Root clone() {
|
public Root clone() {
|
||||||
return new Root(mathContext, parameter1, parameter2);
|
return new Root(mathContext, parameter1, parameter2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ObjectArrayList<Block> toBlock(MathContext context) throws Error {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
throw new Error(Errors.NOT_IMPLEMENTED, "Unknown function " + getClass().getSimpleName());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,9 @@ package org.warp.picalculator.math.functions;
|
|||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
|
|
||||||
import org.warp.picalculator.Error;
|
import org.warp.picalculator.Error;
|
||||||
|
import org.warp.picalculator.gui.expression.blocks.Block;
|
||||||
|
import org.warp.picalculator.gui.expression.blocks.BlockContainer;
|
||||||
|
import org.warp.picalculator.gui.expression.blocks.BlockSquareRoot;
|
||||||
import org.warp.picalculator.math.Function;
|
import org.warp.picalculator.math.Function;
|
||||||
import org.warp.picalculator.math.FunctionSingle;
|
import org.warp.picalculator.math.FunctionSingle;
|
||||||
import org.warp.picalculator.math.MathContext;
|
import org.warp.picalculator.math.MathContext;
|
||||||
@ -64,4 +67,18 @@ public class RootSquare extends FunctionSingle {
|
|||||||
public RootSquare clone() {
|
public RootSquare clone() {
|
||||||
return new RootSquare(mathContext, parameter);
|
return new RootSquare(mathContext, parameter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ObjectArrayList<Block> toBlock(MathContext context) throws Error {
|
||||||
|
ObjectArrayList<Block> result = new ObjectArrayList<>();
|
||||||
|
BlockSquareRoot bsqr = new BlockSquareRoot();
|
||||||
|
BlockContainer bsqrc = bsqr.getNumberContainer();
|
||||||
|
for (Block b : getParameter().toBlock(context)) {
|
||||||
|
bsqrc.appendBlockUnsafe(b);
|
||||||
|
}
|
||||||
|
bsqrc.recomputeDimensions();
|
||||||
|
bsqr.recomputeDimensions();
|
||||||
|
result.add((bsqr));
|
||||||
|
return result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,12 @@
|
|||||||
package org.warp.picalculator.math.functions;
|
package org.warp.picalculator.math.functions;
|
||||||
|
|
||||||
import org.warp.picalculator.Error;
|
import org.warp.picalculator.Error;
|
||||||
|
import org.warp.picalculator.gui.expression.blocks.Block;
|
||||||
|
import org.warp.picalculator.gui.expression.blocks.BlockChar;
|
||||||
import org.warp.picalculator.math.Function;
|
import org.warp.picalculator.math.Function;
|
||||||
import org.warp.picalculator.math.FunctionOperator;
|
import org.warp.picalculator.math.FunctionOperator;
|
||||||
import org.warp.picalculator.math.MathContext;
|
import org.warp.picalculator.math.MathContext;
|
||||||
|
import org.warp.picalculator.math.MathematicalSymbols;
|
||||||
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;
|
||||||
@ -92,4 +95,13 @@ public class Subtraction extends FunctionOperator {
|
|||||||
return new Subtraction(mathContext, parameter1, parameter2);
|
return new Subtraction(mathContext, parameter1, parameter2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ObjectArrayList<Block> toBlock(MathContext context) throws Error {
|
||||||
|
ObjectArrayList<Block> result = new ObjectArrayList<>();
|
||||||
|
result.addAll(getParameter1().toBlock(context));
|
||||||
|
result.add(new BlockChar(MathematicalSymbols.SUBTRACTION));
|
||||||
|
result.addAll(getParameter2().toBlock(context));
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -4,9 +4,12 @@ import java.math.BigDecimal;
|
|||||||
|
|
||||||
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.BlockChar;
|
||||||
import org.warp.picalculator.math.Function;
|
import org.warp.picalculator.math.Function;
|
||||||
import org.warp.picalculator.math.FunctionOperator;
|
import org.warp.picalculator.math.FunctionOperator;
|
||||||
import org.warp.picalculator.math.MathContext;
|
import org.warp.picalculator.math.MathContext;
|
||||||
|
import org.warp.picalculator.math.MathematicalSymbols;
|
||||||
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;
|
||||||
@ -114,4 +117,13 @@ public class Sum extends FunctionOperator {
|
|||||||
return new Sum(mathContext, parameter1, parameter2);
|
return new Sum(mathContext, parameter1, parameter2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ObjectArrayList<Block> toBlock(MathContext context) throws Error {
|
||||||
|
ObjectArrayList<Block> result = new ObjectArrayList<>();
|
||||||
|
result.addAll(getParameter1().toBlock(context));
|
||||||
|
result.add(new BlockChar(MathematicalSymbols.SUM));
|
||||||
|
result.addAll(getParameter2().toBlock(context));
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -2,9 +2,12 @@ package org.warp.picalculator.math.functions;
|
|||||||
|
|
||||||
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.BlockChar;
|
||||||
import org.warp.picalculator.math.Function;
|
import org.warp.picalculator.math.Function;
|
||||||
import org.warp.picalculator.math.FunctionOperator;
|
import org.warp.picalculator.math.FunctionOperator;
|
||||||
import org.warp.picalculator.math.MathContext;
|
import org.warp.picalculator.math.MathContext;
|
||||||
|
import org.warp.picalculator.math.MathematicalSymbols;
|
||||||
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;
|
||||||
@ -73,4 +76,13 @@ public class SumSubtraction extends FunctionOperator {
|
|||||||
return new SumSubtraction(mathContext, parameter1, parameter2);
|
return new SumSubtraction(mathContext, parameter1, parameter2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ObjectArrayList<Block> toBlock(MathContext context) throws Error {
|
||||||
|
ObjectArrayList<Block> result = new ObjectArrayList<>();
|
||||||
|
result.addAll(getParameter1().toBlock(context));
|
||||||
|
result.add(new BlockChar(MathematicalSymbols.SUM_SUBTRACTION));
|
||||||
|
result.addAll(getParameter2().toBlock(context));
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -3,9 +3,13 @@ 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.Errors;
|
||||||
|
import org.warp.picalculator.gui.expression.blocks.Block;
|
||||||
import org.warp.picalculator.math.Function;
|
import org.warp.picalculator.math.Function;
|
||||||
import org.warp.picalculator.math.MathContext;
|
import org.warp.picalculator.math.MathContext;
|
||||||
|
|
||||||
|
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||||
|
|
||||||
public class Undefined implements Function {
|
public class Undefined implements Function {
|
||||||
|
|
||||||
protected final MathContext root;
|
protected final MathContext root;
|
||||||
@ -52,4 +56,10 @@ public class Undefined implements Function {
|
|||||||
throw new IndexOutOfBoundsException();
|
throw new IndexOutOfBoundsException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ObjectArrayList<Block> toBlock(MathContext context) throws Error {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
throw new Error(Errors.NOT_IMPLEMENTED, "Unknown function " + getClass().getSimpleName());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -3,6 +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.gui.expression.blocks.Block;
|
||||||
|
import org.warp.picalculator.gui.expression.blocks.BlockChar;
|
||||||
import org.warp.picalculator.math.Function;
|
import org.warp.picalculator.math.Function;
|
||||||
import org.warp.picalculator.math.MathContext;
|
import org.warp.picalculator.math.MathContext;
|
||||||
|
|
||||||
@ -103,4 +105,12 @@ public class Variable implements Function {
|
|||||||
public Function getParameter(int index) throws IndexOutOfBoundsException {
|
public Function getParameter(int index) throws IndexOutOfBoundsException {
|
||||||
throw new IndexOutOfBoundsException();
|
throw new IndexOutOfBoundsException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ObjectArrayList<Block> toBlock(MathContext context) {
|
||||||
|
ObjectArrayList<Block> result = new ObjectArrayList<>();
|
||||||
|
//TODO: Temporary solution. In near future Variables will be distint objects and they will have a color. So they will be no longer a BlockChar/FeatureChar
|
||||||
|
result.add(new BlockChar(getChar()));
|
||||||
|
return result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,7 @@ 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.gui.expression.blocks.Block;
|
||||||
import org.warp.picalculator.math.Function;
|
import org.warp.picalculator.math.Function;
|
||||||
import org.warp.picalculator.math.FunctionOperator;
|
import org.warp.picalculator.math.FunctionOperator;
|
||||||
import org.warp.picalculator.math.MathContext;
|
import org.warp.picalculator.math.MathContext;
|
||||||
@ -88,4 +89,10 @@ public class Equation extends FunctionOperator {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ObjectArrayList<Block> toBlock(MathContext context) throws Error {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -3,6 +3,7 @@ package org.warp.picalculator.math.functions.equations;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.warp.picalculator.Error;
|
import org.warp.picalculator.Error;
|
||||||
|
import org.warp.picalculator.gui.expression.blocks.Block;
|
||||||
import org.warp.picalculator.math.Function;
|
import org.warp.picalculator.math.Function;
|
||||||
import org.warp.picalculator.math.FunctionDynamic;
|
import org.warp.picalculator.math.FunctionDynamic;
|
||||||
import org.warp.picalculator.math.MathContext;
|
import org.warp.picalculator.math.MathContext;
|
||||||
@ -70,4 +71,10 @@ public class EquationsSystem extends FunctionDynamic {
|
|||||||
return new EquationsSystem(root, functions);
|
return new EquationsSystem(root, functions);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ObjectArrayList<Block> toBlock(MathContext context) throws Error {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package org.warp.picalculator.math.functions.equations;
|
package org.warp.picalculator.math.functions.equations;
|
||||||
|
|
||||||
import org.warp.picalculator.Error;
|
import org.warp.picalculator.Error;
|
||||||
|
import org.warp.picalculator.gui.expression.blocks.Block;
|
||||||
import org.warp.picalculator.math.Function;
|
import org.warp.picalculator.math.Function;
|
||||||
import org.warp.picalculator.math.FunctionSingle;
|
import org.warp.picalculator.math.FunctionSingle;
|
||||||
import org.warp.picalculator.math.MathContext;
|
import org.warp.picalculator.math.MathContext;
|
||||||
@ -36,4 +37,10 @@ public class EquationsSystemPart extends FunctionSingle {
|
|||||||
return new EquationsSystemPart(mathContext, (Equation) parameter);
|
return new EquationsSystemPart(mathContext, (Equation) parameter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ObjectArrayList<Block> toBlock(MathContext context) throws Error {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
package org.warp.picalculator.math.functions.trigonometry;
|
package org.warp.picalculator.math.functions.trigonometry;
|
||||||
|
|
||||||
import org.warp.picalculator.Error;
|
import org.warp.picalculator.Error;
|
||||||
|
import org.warp.picalculator.Errors;
|
||||||
|
import org.warp.picalculator.gui.expression.blocks.Block;
|
||||||
import org.warp.picalculator.math.Function;
|
import org.warp.picalculator.math.Function;
|
||||||
import org.warp.picalculator.math.FunctionSingle;
|
import org.warp.picalculator.math.FunctionSingle;
|
||||||
import org.warp.picalculator.math.MathContext;
|
import org.warp.picalculator.math.MathContext;
|
||||||
@ -37,4 +39,10 @@ public class ArcCosine extends FunctionSingle {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ObjectArrayList<Block> toBlock(MathContext context) throws Error {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
throw new Error(Errors.NOT_IMPLEMENTED, "Unknown function " + getClass().getSimpleName());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
package org.warp.picalculator.math.functions.trigonometry;
|
package org.warp.picalculator.math.functions.trigonometry;
|
||||||
|
|
||||||
import org.warp.picalculator.Error;
|
import org.warp.picalculator.Error;
|
||||||
|
import org.warp.picalculator.Errors;
|
||||||
|
import org.warp.picalculator.gui.expression.blocks.Block;
|
||||||
import org.warp.picalculator.math.Function;
|
import org.warp.picalculator.math.Function;
|
||||||
import org.warp.picalculator.math.FunctionSingle;
|
import org.warp.picalculator.math.FunctionSingle;
|
||||||
import org.warp.picalculator.math.MathContext;
|
import org.warp.picalculator.math.MathContext;
|
||||||
@ -37,4 +39,10 @@ public class ArcSine extends FunctionSingle {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ObjectArrayList<Block> toBlock(MathContext context) throws Error {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
throw new Error(Errors.NOT_IMPLEMENTED, "Unknown function " + getClass().getSimpleName());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
package org.warp.picalculator.math.functions.trigonometry;
|
package org.warp.picalculator.math.functions.trigonometry;
|
||||||
|
|
||||||
import org.warp.picalculator.Error;
|
import org.warp.picalculator.Error;
|
||||||
|
import org.warp.picalculator.Errors;
|
||||||
|
import org.warp.picalculator.gui.expression.blocks.Block;
|
||||||
import org.warp.picalculator.math.Function;
|
import org.warp.picalculator.math.Function;
|
||||||
import org.warp.picalculator.math.FunctionSingle;
|
import org.warp.picalculator.math.FunctionSingle;
|
||||||
import org.warp.picalculator.math.MathContext;
|
import org.warp.picalculator.math.MathContext;
|
||||||
@ -37,4 +39,10 @@ public class ArcTangent extends FunctionSingle {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ObjectArrayList<Block> toBlock(MathContext context) throws Error {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
throw new Error(Errors.NOT_IMPLEMENTED, "Unknown function " + getClass().getSimpleName());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
package org.warp.picalculator.math.functions.trigonometry;
|
package org.warp.picalculator.math.functions.trigonometry;
|
||||||
|
|
||||||
import org.warp.picalculator.Error;
|
import org.warp.picalculator.Error;
|
||||||
|
import org.warp.picalculator.Errors;
|
||||||
|
import org.warp.picalculator.gui.expression.blocks.Block;
|
||||||
import org.warp.picalculator.math.Function;
|
import org.warp.picalculator.math.Function;
|
||||||
import org.warp.picalculator.math.FunctionSingle;
|
import org.warp.picalculator.math.FunctionSingle;
|
||||||
import org.warp.picalculator.math.MathContext;
|
import org.warp.picalculator.math.MathContext;
|
||||||
@ -37,4 +39,10 @@ public class Cosine extends FunctionSingle {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ObjectArrayList<Block> toBlock(MathContext context) throws Error {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
throw new Error(Errors.NOT_IMPLEMENTED, "Unknown function " + getClass().getSimpleName());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@ package org.warp.picalculator.math.functions.trigonometry;
|
|||||||
|
|
||||||
import org.nevec.rjm.BigDecimalMath;
|
import org.nevec.rjm.BigDecimalMath;
|
||||||
import org.warp.picalculator.Error;
|
import org.warp.picalculator.Error;
|
||||||
|
import org.warp.picalculator.gui.expression.blocks.Block;
|
||||||
import org.warp.picalculator.math.AngleMode;
|
import org.warp.picalculator.math.AngleMode;
|
||||||
import org.warp.picalculator.math.Function;
|
import org.warp.picalculator.math.Function;
|
||||||
import org.warp.picalculator.math.FunctionSingle;
|
import org.warp.picalculator.math.FunctionSingle;
|
||||||
@ -57,4 +58,10 @@ public class Sine extends FunctionSingle {
|
|||||||
return new Sine(mathContext, parameter);
|
return new Sine(mathContext, parameter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ObjectArrayList<Block> toBlock(MathContext context) throws Error {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package org.warp.picalculator.math.functions.trigonometry;
|
package org.warp.picalculator.math.functions.trigonometry;
|
||||||
|
|
||||||
import org.warp.picalculator.Error;
|
import org.warp.picalculator.Error;
|
||||||
|
import org.warp.picalculator.gui.expression.blocks.Block;
|
||||||
import org.warp.picalculator.math.Function;
|
import org.warp.picalculator.math.Function;
|
||||||
import org.warp.picalculator.math.FunctionSingle;
|
import org.warp.picalculator.math.FunctionSingle;
|
||||||
import org.warp.picalculator.math.MathContext;
|
import org.warp.picalculator.math.MathContext;
|
||||||
@ -37,4 +38,10 @@ public class Tangent extends FunctionSingle {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ObjectArrayList<Block> toBlock(MathContext context) throws Error {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -49,7 +49,7 @@ public class MathParser {
|
|||||||
public static Expression parseInput(MathContext context, InputContainer c) throws Error {
|
public static Expression parseInput(MathContext context, InputContainer c) throws Error {
|
||||||
Expression result;
|
Expression result;
|
||||||
|
|
||||||
final Function resultFunction = parseContainer(context, c.getContent());
|
final Function resultFunction = c.toFunction(context);
|
||||||
|
|
||||||
result = new Expression(context, resultFunction);
|
result = new Expression(context, resultFunction);
|
||||||
return result;
|
return result;
|
||||||
@ -59,186 +59,15 @@ public class MathParser {
|
|||||||
final ObjectArrayList<Block> resultBlocks = new ObjectArrayList<>();
|
final ObjectArrayList<Block> resultBlocks = new ObjectArrayList<>();
|
||||||
|
|
||||||
for (Function f : expr) {
|
for (Function f : expr) {
|
||||||
resultBlocks.addAll(parseFunction(context, f));
|
ObjectArrayList<Block> resultPart = f.toBlock(context);
|
||||||
|
if (resultPart == null) throw new Error(Errors.NOT_IMPLEMENTED, "Unknown function " + f.getClass().getSimpleName());
|
||||||
|
resultBlocks.addAll(resultPart);
|
||||||
}
|
}
|
||||||
|
|
||||||
return resultBlocks;
|
return resultBlocks;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static ObjectArrayList<Block> parseFunction(MathContext context, Function func) throws Error {
|
|
||||||
ObjectArrayList<Block> result = new ObjectArrayList<>();
|
|
||||||
if (func instanceof FunctionOperator) {
|
|
||||||
ObjectArrayList<Block> sub1 = parseFunction(context, func.getParameter(0));
|
|
||||||
ObjectArrayList<Block> sub2 = parseFunction(context, func.getParameter(1));
|
|
||||||
if (func instanceof Sum) {
|
|
||||||
result.addAll(sub1);
|
|
||||||
result.add(new BlockChar(MathematicalSymbols.SUM));
|
|
||||||
result.addAll(sub2);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
if (func instanceof Subtraction) {
|
|
||||||
result.addAll(sub1);
|
|
||||||
result.add(new BlockChar(MathematicalSymbols.SUBTRACTION));
|
|
||||||
result.addAll(sub2);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
if (func instanceof SumSubtraction) {
|
|
||||||
result.addAll(sub1);
|
|
||||||
result.add(new BlockChar(MathematicalSymbols.SUM_SUBTRACTION));
|
|
||||||
result.addAll(sub2);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
if (func instanceof Multiplication) {
|
|
||||||
Block nearLeft = sub1.get(sub1.size()-1);
|
|
||||||
Block nearRight = sub2.get(0);
|
|
||||||
|
|
||||||
result.addAll(sub1);
|
|
||||||
if (nearLeft instanceof BlockChar && nearRight instanceof BlockChar) {
|
|
||||||
|
|
||||||
} else {
|
|
||||||
result.add(new BlockChar(MathematicalSymbols.MULTIPLICATION));
|
|
||||||
}
|
|
||||||
result.addAll(sub2);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
if (func instanceof Division) {
|
|
||||||
BlockDivision bd = new BlockDivision();
|
|
||||||
BlockContainer uc = bd.getUpperContainer();
|
|
||||||
BlockContainer lc = bd.getLowerContainer();
|
|
||||||
for (Block b : sub1) {
|
|
||||||
uc.appendBlockUnsafe(b);
|
|
||||||
}
|
|
||||||
for (Block b : sub2) {
|
|
||||||
lc.appendBlockUnsafe(b);
|
|
||||||
}
|
|
||||||
uc.recomputeDimensions();
|
|
||||||
lc.recomputeDimensions();
|
|
||||||
bd.recomputeDimensions();
|
|
||||||
result.add(bd);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
if (func instanceof Power) {
|
|
||||||
BlockPower bp = new BlockPower();
|
|
||||||
BlockContainer ec = bp.getExponentContainer();
|
|
||||||
result.addAll(sub1);
|
|
||||||
for (Block b : sub2) {
|
|
||||||
ec.appendBlockUnsafe(b);
|
|
||||||
}
|
|
||||||
ec.recomputeDimensions();
|
|
||||||
bp.recomputeDimensions();
|
|
||||||
result.add(bp);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (func instanceof FunctionSingle) {
|
|
||||||
ObjectArrayList<Block> sub = parseFunction(context, func.getParameter(0));
|
|
||||||
if (func instanceof RootSquare) {
|
|
||||||
BlockSquareRoot bsqr = new BlockSquareRoot();
|
|
||||||
BlockContainer bsqrc = bsqr.getNumberContainer();
|
|
||||||
for (Block b : sub) {
|
|
||||||
bsqrc.appendBlockUnsafe(b);
|
|
||||||
}
|
|
||||||
bsqrc.recomputeDimensions();
|
|
||||||
bsqr.recomputeDimensions();
|
|
||||||
result.add((bsqr));
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
if (func instanceof Expression) {
|
|
||||||
ObjectArrayList<Block> sub = parseFunction(context, ((Expression) func).getParameter(0));
|
|
||||||
BlockParenthesis bp = new BlockParenthesis();
|
|
||||||
BlockContainer bpc = bp.getNumberContainer();
|
|
||||||
for (Block b : sub) {
|
|
||||||
bpc.appendBlockUnsafe(b);
|
|
||||||
}
|
|
||||||
bpc.recomputeDimensions();
|
|
||||||
bp.recomputeDimensions();
|
|
||||||
result.add(bp);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
if (func instanceof Number) {
|
|
||||||
Number numb = (Number) func;
|
|
||||||
String numberString = numb.toString();
|
|
||||||
if (numberString.contains("ℯ℮")) {
|
|
||||||
String[] numberParts = numberString.split("ℯ℮", 2);
|
|
||||||
BlockPower bp = new BlockExponentialNotation();
|
|
||||||
BlockContainer bpec = bp.getExponentContainer();
|
|
||||||
for (char c : numberParts[0].toCharArray()) {
|
|
||||||
result.add(new BlockChar(c));
|
|
||||||
}
|
|
||||||
for (char c : numberParts[1].toCharArray()) {
|
|
||||||
bpec.appendBlockUnsafe(new BlockChar(c));
|
|
||||||
};
|
|
||||||
bpec.recomputeDimensions();
|
|
||||||
bp.recomputeDimensions();
|
|
||||||
result.add(bp);
|
|
||||||
return result;
|
|
||||||
} else {
|
|
||||||
for (char c : numberString.toCharArray()) {
|
|
||||||
result.add(new BlockChar(c));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
if (func instanceof Variable) {
|
|
||||||
//TODO: Temporary solution. In near future Variables will be distint objects and they will have a color. So they will be no longer a BlockChar/FeatureChar
|
|
||||||
result.add(new BlockChar(((Variable) func).getChar()));
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
throw new Error(Errors.NOT_IMPLEMENTED, "Unknown function " + func.getClass().getSimpleName());
|
|
||||||
}
|
|
||||||
|
|
||||||
private static Function parseContainer(final MathContext context, final Iterable<Block> blocks) throws Error {
|
public static Function joinFeatures(final MathContext context, ObjectArrayList<Feature> features) throws Error {
|
||||||
final ObjectArrayList<Feature> blockFeatures = new ObjectArrayList<>();
|
|
||||||
|
|
||||||
for (final Block block : blocks) {
|
|
||||||
final Feature blockFeature = parseBlock(context, block);
|
|
||||||
blockFeatures.add(blockFeature);
|
|
||||||
}
|
|
||||||
|
|
||||||
final Function result = joinFeatures(context, blockFeatures);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static Feature parseBlock(final MathContext context, final Block block) throws Error {
|
|
||||||
|
|
||||||
Feature result;
|
|
||||||
|
|
||||||
final int blockType = block.getClassID();
|
|
||||||
switch (blockType) {
|
|
||||||
case BlockChar.CLASS_ID:
|
|
||||||
result = new FeatureChar(((BlockChar) block).getChar());
|
|
||||||
break;
|
|
||||||
case BlockDivision.CLASS_ID:
|
|
||||||
final BlockDivision bd = (BlockDivision) block;
|
|
||||||
final Function upper = parseContainer(context, bd.getUpperContainer().getContent());
|
|
||||||
final Function lower = parseContainer(context, bd.getLowerContainer().getContent());
|
|
||||||
result = new FeatureDivision(upper, lower);
|
|
||||||
break;
|
|
||||||
case BlockSquareRoot.CLASS_ID:
|
|
||||||
final BlockSquareRoot bsqr = (BlockSquareRoot) block;
|
|
||||||
final Function contnt = parseContainer(context, bsqr.getNumberContainer().getContent());
|
|
||||||
result = new FeatureSquareRoot(contnt);
|
|
||||||
break;
|
|
||||||
case BlockParenthesis.CLASS_ID:
|
|
||||||
final BlockParenthesis bp = (BlockParenthesis) block;
|
|
||||||
final Function cont = parseContainer(context, bp.getNumberContainer().getContent());
|
|
||||||
result = new FeatureParenthesis(cont);
|
|
||||||
break;
|
|
||||||
case BlockPower.CLASS_ID:
|
|
||||||
final BlockPower blp = (BlockPower) block;
|
|
||||||
final Function exp = parseContainer(context, blp.getExponentContainer().getContent());
|
|
||||||
result = new FeaturePower(exp);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
throw new Error(Errors.NOT_IMPLEMENTED, "The block " + block.getClass().getSimpleName() + " isn't a known BLock");
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static Function joinFeatures(final MathContext context, ObjectArrayList<Feature> features) throws Error {
|
|
||||||
|
|
||||||
features = fixFeatures(context, features);
|
features = fixFeatures(context, features);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user