From 3efb8f6c26ec4d2cbf1411e55a395991bda24c2a Mon Sep 17 00:00:00 2001 From: XDrake99 Date: Sun, 23 Apr 2017 14:11:37 +0200 Subject: [PATCH] updated --- res/algebra_input.gif | Bin 0 -> 30765 bytes res/font_ex.rft | Bin 1735 -> 1735 bytes src/org/warp/picalculator/Utils.java | 1 + .../warp/picalculator/device/Keyboard.java | 2 +- .../gui/expression/blocks/Block.java | 2 +- .../blocks/BlockExponentialNotation.java | 22 ++++++++++-- .../gui/expression/blocks/BlockPower.java | 34 ++++-------------- .../gui/graphicengine/gpu/GPUEngine.java | 2 +- .../gui/graphicengine/gpu/NEWTWindow.java | 6 ++-- .../picalculator/gui/screens/MarioScreen.java | 1 + .../picalculator/math/parser/MathParser.java | 25 ++++++------- .../math/parser/features/FeaturePower.java | 8 ++--- 12 files changed, 49 insertions(+), 54 deletions(-) create mode 100644 res/algebra_input.gif diff --git a/res/algebra_input.gif b/res/algebra_input.gif new file mode 100644 index 0000000000000000000000000000000000000000..6aaebdfb84b8aac603bf95660c5c2730077b43da GIT binary patch literal 30765 zcmeHQ2|Seh*MDXVGuG_;GM4OH_EZ{6mYPH*D#?;HiBguf!Pq4`Aq^5*ED@4>Gl-F; zg=|SANp_K~Jnw_*cHj5D_r0I{zxVBSduBc#+h?BV`Tf4X-#OoN&hMPVz(`+Xy-hb_ zBVrZ+?pNgl01y{LjE^C<2YNSOiF@whfIt8M0(wI)1oT?|vijTdU*H#vz`q9pVUXT< z%kEve+9q3+;ipH!L8L12AmTmXw0@>R@Kkt*M5E z8TZ4vm0h|ig_(6hNE8ERz0ws5f@aIL-FtUd)+H+1JxDbwy4sY&f53%dKIRo68g~x4 zRfy3R8_Cp4J3_Cm?~{dup&Xelu+zyU)ZmToLd{|3E{@&1a>q ze#vo3>{1V}Tdcb!wxM9a(9d93o@`1cZO+<=YcN9P<1I?6mlKc#`W=U ztO4!C4Ae-x;+`TOzUx*^?$kSY-=K3jUvto2a0*?NvPr!R_|=L z>>h{P&m}J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0L|ov)h=efeK5!hYdsTH8hq(rRQ!CC8Ltgb-Va?5rh()9y&ynDhvW?6A^X zZM@SW))=V~Kqoh(+>Z~`iR}_AkG3`?ZOsg;kt~va;J>rTpXh9MRr{v3)J_iI_>Ed9 zvco&w*?OoJitNM6#b;PeciQLv0W&0?jJI-6~KFXA_Ik3Q=H zrX$B}2mt+l<$P8xu{;RtLch~IJz$L%d%72oixW0TK*T(aDD0~t61+x!&g2yG zs>3rkv|vZNckz)oR-uh#2fOgnk0t#?`L5S5j%~cQNBE=!rw?z0=8}VO)V4@2{#bhI zRSmUbtvEsPBz7ogYB^&Hb^-qRf&`E7Z$bbQ1yEs7ics^>02*qHhNL2ayxfxEG={}i z4`Aa{^7LNUr*ocfgD=X+R7@YzP{&4c6z#PG>DOkQUf*KZ7_H*mvyt}JT7x9anWY;( z#~in%tg|tWTkn~>GgCSEEdwt{_V#O=LXq~#MN)ghciqX`?YvV`C!D1zh&{JN?AbN9 zy=QM|sEt}iI_2*4Ofr8>Cak12uC!M={*{nI(}(5sZ`uR!ZU5m2tQ6Oxu(-;~03;O( zr%`~d_M;PGRgqjLq8rS?rByTcNJJ-+VUr*#)Wk+ROx!dKFNL#tK$M|MC5Ap8&`wY> zb7{=I<#-D;vGEri! zd91-!?E7OzYKlb~Zf#ohkZ<`^V6fU9@a$I!S^seS;Nigt{Cx=g&m$SAAp}%`^F=`Z rzDL7%h7tJZBk makeFunctions(MathContext context, ObjectArrayList features) throws Error { final ObjectArrayList process = new ObjectArrayList<>(); - + for (final Feature f : features) { if (f instanceof FeatureDivision) { process.add(new Division(context, (Function) ((FeatureDouble) f).getChild1(), (Function) ((FeatureDouble) f).getChild2())); @@ -396,7 +388,12 @@ public class MathParser { } else if (f instanceof FeatureSum) { process.add(new Sum(context, (Function) ((FeatureDouble) f).getChild1(), (Function) ((FeatureDouble) f).getChild2())); } else if (f instanceof FeaturePower) { - process.add(new Power(context, (Function) ((FeatureDouble) f).getChild1(), (Function) ((FeatureDouble) f).getChild2())); + if (process.isEmpty()) { + throw new Error(Errors.SYNTAX_ERROR, "There is a power at the beginning of the expression!"); + } else { + Function prec = process.remove(process.size()-1); + process.add(new Power(context, prec, (Function) ((FeatureSingle) f).getChild())); + } } else if (f instanceof FeatureSquareRoot) { process.add(new RootSquare(context, (Function) ((FeatureSingle) f).getChild())); } else if (f instanceof FeatureParenthesis) { diff --git a/src/org/warp/picalculator/math/parser/features/FeaturePower.java b/src/org/warp/picalculator/math/parser/features/FeaturePower.java index 5de97e33..3eba66fb 100644 --- a/src/org/warp/picalculator/math/parser/features/FeaturePower.java +++ b/src/org/warp/picalculator/math/parser/features/FeaturePower.java @@ -1,11 +1,9 @@ package org.warp.picalculator.math.parser.features; -import org.warp.picalculator.math.parser.features.interfaces.Feature; +public class FeaturePower extends FeatureSingleImpl { -public class FeaturePower extends FeatureDoubleImpl { - - public FeaturePower(Object child1, Object child2) { - super(child1, child2); + public FeaturePower(Object child) { + super(child); } }