/** * @param app * the script's application * @param scriptText * the script's source code */ public GgbScript(App app, String scriptText) { super(app, scriptText); this.proc = app.getKernel().getAlgebraProcessor(); }
/** * @param info * context for evaluation * @return array of resulting geos */ public GeoElementND[] evaluateMultiple(EvalInfo info) { GeoElementND[] geos = null; geos = kernel.getAlgebraProcessor().processCommand(this, info); return geos; }
@Override public Equation getEquation() { return kernel.getAlgebraProcessor().parseEquation(this); }
protected double parseDouble(String text) { if (text == null || "".equals(text)) { return Double.NaN; } return app.getKernel().getAlgebraProcessor().evaluateToDouble(text); }
private GeoNumberValue getNumberValue(String value) { return kernel.getAlgebraProcessor() .evaluateToNumeric(value.trim(), ErrorHelper.silent()); }
public void applyGridTickAngle(String text) { if (!"".equals(text)) { double[] ticks = view.getGridDistances(); // val = 4 gives 5*PI/12, skip this and go to 6*Pi/2 = Pi/2 double value = app.getKernel().getAlgebraProcessor() .evaluateToDouble(text); value = Math.PI / Math.min(360, Math.round(Math.abs(Math.PI / value))); ticks[2] = value; view.setGridDistances(ticks); } }
@Override protected void runCommands(GeoElementND geo) { geo.getKernel().getAlgebraProcessor().processAlgebraCommand( "Solve[" + getLabels(geo) + "]", false); }
/** * Disables the exam command filter by setting the nonExamCommandFilter to the CommandDispatcher */ public void disableExamCommandFilter() { app .getKernel() .getAlgebraProcessor() .getCommandDispatcher() .setCommandFilter(nonExamCommandFilter); }
/** * @param app * application */ public TableValuesDialogValidator(App app) { numberValidator = new NumberValidator(app.getKernel().getAlgebraProcessor()); localization = app.getLocalization(); }
@Override public void compute() { if (!equation.isDefined()) { side.setUndefined(); return; } String str = equation.toValueString(StringTemplate.maxPrecision); String[] sides = str.split("="); String sideStr = left ? sides[0] : sides[1]; GeoFunctionNVar processed = kernel.getAlgebraProcessor() .evaluateToFunctionNVar(sideStr, true, false); side.set(processed); }
@Override public void handleCASoutput(String output, int requestID) { NumberValue nv = kernel.getAlgebraProcessor().evaluateToNumeric(output, ErrorHelper.silent()); outNum.setValue(nv.getDouble()); if (USE_ASYNCHRONOUS) { outNum.updateCascade(); } }
/** * Create a GeoLine. * * @return line */ public GeoLine createGeoLine() { AlgebraProcessor processor = unitTest.getKernel().getAlgebraProcessor(); return (GeoLine) processor.processAlgebraCommand("x=y", false)[0]; }
private FunctionNVar getFactor(int factor) { if (factorExpression[factor] == null) { Log.error("Undefined factor " + factor + " in " + toString(StringTemplate.editTemplate)); factorExpression[factor] = kernel.getAlgebraProcessor() .evaluateToFunctionNVar("0x+0y", true, false).getFunction(); setUndefined(); } return this.factorExpression[factor]; }
/** * Create a GeoFunction based on function definition. * * @param definition function definition * @return function */ public GeoFunction createFunction(String definition) { Kernel kernel = unitTest.getKernel(); AlgebraProcessor processor = kernel.getAlgebraProcessor(); return (GeoFunction) processor.processAlgebraCommand(definition, false)[0]; }
/** * enable/disable CAS and re-init command table * * @param enable * whether to enable CAS */ public void enableCAS(boolean enable) { getSettings().getCasSettings().setEnabled(enable); getKernel().getAlgebraProcessor().reinitCommands(); }
private void setCustomDistance() { double[] axesDistances = euclidianView.getAxesNumberingDistances(); for (int i = 0; i < euclidianSettings.getDimension(); i++) { euclidianSettings.setAxisNumberingDistance(i, kernel.getAlgebraProcessor() .evaluateToNumeric("" + axesDistances[i] / 2, ErrorHelper.silent())); } }
/** * Saves the current command filter into the nonExamCommandFilter field and sets the exam * command filter for the duration of the exam mode. */ public void enableExamCommandFilter() { CommandDispatcher commandDispatcher = app.getKernel().getAlgebraProcessor().getCommandDispatcher(); nonExamCommandFilter = commandDispatcher.getCommandFilter(); commandDispatcher.setCommandFilter(new ExamCommandFilter()); }
public void myReInit(String parseString) throws ParseException { if(!kernel.getConstruction().isFileLoading() && StringUtil.checkBracketsBackward(StringUtil.ignoreIndices(parseString))>=0){ throw new BracketsError(loc,parseString); } ReInit(new StringProvider(StringUtil.fixVerticalBars(parseString))); GeoGebraCASParsing = false; ExternalCASParsing = false; GiacParsing = false; enableVectors = kernel.getAlgebraProcessor().enableStructures(); undecided.clear(); }
private GeoElementND[] evalValidExpression(ValidExpression ve, EvalInfo info) { return kernel.getAlgebraProcessor().processAlgebraCommandNoExceptionHandling(ve, false, validation, null, info.withSliders( kernel.getApplication().isHTML5Applet() && kernel.getApplication().getConfig() .hasSlidersInAV())); }
@Override public GeoElement evaluate(StringTemplate tpl) { boolean oldFlag = kernel.getConstruction().isSuppressLabelsActive(); kernel.getConstruction().setSuppressLabelCreation(true); GeoElement ge = kernel.getAlgebraProcessor().processEquation(this, this.wrap(), new EvalInfo(false))[0]; kernel.getConstruction().setSuppressLabelCreation(oldFlag); return ge; }