/** * Creates a power {@link ASTNode}. * * @param basis the basis * @param exponent the exponent * @return a power {@link ASTNode}. */ public static ASTNode pow(ASTNode basis, double exponent) { basis.raiseByThePowerOf(exponent); return basis; }
/** * Creates a power {@link ASTNode}. * * @param basis the basis * @param exponent the exponent * @return a power {@link ASTNode}. */ public static ASTNode pow(ASTNode basis, int exponent) { basis.raiseByThePowerOf(exponent); return basis; }
/** * Raises this ASTNode by the power of the value of this named SBase object. * * @param nsb * an SBML element that can be represented by a value. * @return the current node for convenience. */ public ASTNode raiseByThePowerOf(CallableSBase nsb) { return raiseByThePowerOf(new ASTNode(nsb, getParentSBMLObject())); }
/** * Returns a new {@link ASTNode} that represents Euler's constant raised by the * power of the given exponent. * * @param exponent the exponent * @return a new {@link ASTNode} that represents Euler's constant raised by the * power of the given exponent. */ public static ASTNode exp(ASTNode exponent) { ASTNode e = new ASTNode(Type.CONSTANT_E, exponent.getParentSBMLObject()); return e.raiseByThePowerOf(exponent); }
return raiseByThePowerOf(exp);
/** * Creates a power {@link ASTNode}. * * @param basis the basis * @param exponent the exponent * @return a power {@link ASTNode}. */ public static ASTNode pow(ASTNode basis, ASTNode exponent) { if (!(exponent.isInteger() && exponent.getInteger() == 1) && !(exponent.getType() == Type.REAL && exponent.getReal() == 1d)) { if ((exponent.isInteger() && exponent.getInteger() == 0) || (exponent.getType() == Type.REAL && exponent.getReal() == 0d)) { basis = new ASTNode(1, basis.getParentSBMLObject()); } else { setParentSBMLObject(exponent, basis.getParentSBMLObject(), 0); basis.raiseByThePowerOf(exponent); } } return basis; }