Exemplo n.º 1
0
  @Override
  public final void compute() {
    if (!f.toGeoElement().isDefined()) {
      g.toGeoElement().setUndefined();
      return;
    }

    applyCasCommand(StringTemplate.prefixedDefault);
  }
Exemplo n.º 2
0
  // for AlgoElement
  @Override
  protected void setInputOutput() {
    input = new GeoElement[1];
    input[0] = f.toGeoElement();

    setOutputLength(1);
    setOutput(0, g.toGeoElement());
    setDependencies(); // done by AlgoElement
  }
Exemplo n.º 3
0
 /**
  * Creates CAS algo, doesn't set any input, output or label
  *
  * @param cons construction
  * @param f input function
  */
 protected AlgoCasBase(Construction cons, CasEvaluableFunction f, Commands cmd) {
   super(cons);
   this.f = f;
   this.cmd = cmd;
   cons.addCASAlgo(this);
   g = (CasEvaluableFunction) f.toGeoElement().copyInternal(cons);
 }
Exemplo n.º 4
0
  /**
   * Creates CAS algo and sets input, output and label. Do not use if compute() or setInputOutput()
   * are overriden.
   *
   * @param cons construction
   * @param label label for output
   * @param f input function
   */
  protected AlgoCasBase(Construction cons, String label, CasEvaluableFunction f, Commands cmd) {
    this(cons, f, cmd);

    setInputOutput(); // for AlgoElement
    compute();
    g.toGeoElement().setLabel(label);
  }
Exemplo n.º 5
0
 /** @return resulting function */
 public GeoElement getResult() {
   return g.toGeoElement();
 }
Exemplo n.º 6
0
 /**
  * Clears the cache (needed in Web when the CAS loads)
  *
  * @param label not used
  */
 public final void clearCasEvalMap(String label) {
   f.clearCasEvalMap(label);
 }