/** * Construct <i>Options</i> used in evaluation of function symbols (i.e. <code>Modulus->n</code> is an option * which could be used for an integer <code>n</code> in a function like * <code>Factor(polynomial, Modulus->2)</code>. * * @param symbol * the options symbol for determining "default option values" * @param optionExpr * the value which should be defined for the option */ public Options(final ISymbol symbol, final IExpr optionExpr, final EvalEngine engine) { fEngine = engine; // get the List of pre-defined options: final IExpr temp = fEngine.evaluate(Options(symbol)); if ((temp != null) && (temp instanceof IAST) && temp.isList()) { fDefaultOptionsList = (IAST) temp; } else { fDefaultOptionsList = null; } this.fCurrentOptionsList = F.ListAlloc(); this.fCurrentOptionsList.append(optionExpr); }
/** * * @param symbol * the options symbol for determining "default option * values" * @param currentOptionsList * the AST where the option could be defined starting at position * <code>startIndex</code> * @param startIndex * the index from which tolook for options defined in * <code>currentOptionsList</code> */ public Options(final ISymbol symbol, final IAST currentOptionsList, final int startIndex) { // get the List of pre-defined options: final IExpr temp = F.eval(Options(symbol)); if ((temp != null) && (temp instanceof IAST) && temp.isList()) { fDefaultOptionsList = (IAST) temp; } else { fDefaultOptionsList = null; } this.fCurrentOptionsList = null; if (currentOptionsList != null && startIndex < currentOptionsList.size()) { this.fCurrentOptionsList = List(); for (int i = startIndex; i < currentOptionsList.size(); i++) { this.fCurrentOptionsList.add(1, currentOptionsList.get(i)); } } }
/** * Construct special <i>Options</i> used in evaluation of function symbols (i.e. <code>Modulus->n</code> is an * option which could be used for an integer <code>n</code> in a function like * <code>Factor(polynomial, Modulus->2)</code>. * * @param symbol * the options symbol for determining "default option values" * @param currentOptionsList * the AST where the option could be defined starting at position <code>startIndex</code> * @param startIndex * the index from which to look for options defined in <code>currentOptionsList</code> */ public Options(final ISymbol symbol, final IAST currentOptionsList, final int startIndex, final EvalEngine engine) { fEngine = engine; // get the List of pre-defined options: final IExpr temp = fEngine.evaluate(Options(symbol)); if ((temp != null) && (temp instanceof IAST) && temp.isList()) { fDefaultOptionsList = (IAST) temp; } else { fDefaultOptionsList = null; } this.fCurrentOptionsList = null; if (currentOptionsList != null && startIndex < currentOptionsList.size()) { int size = currentOptionsList.size(); this.fCurrentOptionsList = F.ListAlloc(size); for (int i = startIndex; i < size; i++) { this.fCurrentOptionsList.append(1, currentOptionsList.get(i)); } } }
fEngine = engine; final IExpr temp = fEngine.evaluate(Options(symbol)); if ((temp != null) && (temp instanceof IAST) && temp.isList()) { fDefaultOptionsList = (IAST) temp;