public void calculate() { if (c != null && !c.isRazlomak()) { parent.b = c.getA(); a = (a.multiply(c.getA())).add(b); b = BigInteger.valueOf(0); } else if (c != null) { c.calculate(); parent.b = c.getA(); a = (a.multiply(c.getA())).add(b); b = BigInteger.valueOf(0); } else { parent.b = a.add(b); } }
public BigInteger getValue() { if (c != null) { if (c.isRazlomak()) c.calculate(); BigInteger c1 = c.getA(); BigInteger result = (a.multiply(c1)).add(b); return result; } else { return a.add(b); } }