Ejemplo n.º 1
0
  public void updateFonts() {
    Font font = ((AppD) kernel.getApplication()).getPlainFont();

    label.setFont(font);
    tfAnimStep.setFont(font);
  }
Ejemplo n.º 2
0
 public void setLabels() {
   label.setText(kernel.getApplication().getPlain("AnimationStep") + ": ");
 }
Ejemplo n.º 3
0
  private static GeoElement prepareNewValue(Kernel kernel, String name, String inputText)
      throws Exception {
    String text = inputText;
    if (text == null) {
      return null;
    }

    // remove leading equal sign, e.g. "= A1 + A2"
    if (text.length() > 0 && text.charAt(0) == '=') {
      text = text.substring(1);
    }
    text = text.trim();

    // no equal sign in input
    GeoElement[] newValues = null;
    try {
      // check if input is same as name: circular definition
      if (text.equals(name)) {
        // circular definition
        throw new CircularDefinitionException();
      }

      // evaluate input text without an error dialog in case of unquoted
      // text
      newValues =
          kernel
              .getAlgebraProcessor()
              .processAlgebraCommandNoExceptionHandling(text, false, false, false);

      // check if text was the label of an existing geo
      // toUpperCase() added to fix bug A1=1, enter just 'a1' or 'A1' into
      // cell B1 -> A1 disappears
      if (StringUtil.toLowerCase(text).equals(newValues[0].getLabel(StringTemplate.defaultTemplate))
          // also need eg =a to work
          || text.equals(newValues[0].getLabel(StringTemplate.defaultTemplate))) {
        // make sure we create a copy of this existing or auto-created
        // geo
        // by providing the new cell name in the beginning
        text = name + " = " + text;
        newValues = kernel.getAlgebraProcessor().processAlgebraCommandNoExceptions(text, false);
      }

      // check if name was auto-created: if yes we could have a circular
      // definition
      GeoElement autoCreateGeo = kernel.lookupLabel(name);
      if (autoCreateGeo != null) {
        // check for circular definition: if newValue depends on
        // autoCreateGeo
        boolean circularDefinition = false;
        for (int i = 0; i < newValues.length; i++) {
          if (newValues[i].isChildOf(autoCreateGeo)) {
            circularDefinition = true;
            break;
          }
        }

        if (circularDefinition) {
          // remove the auto-created object and the result
          autoCreateGeo.remove();
          newValues[0].remove();

          // circular definition
          throw new CircularDefinitionException();
        }
      }

      for (int i = 0; i < newValues.length; i++) {
        newValues[i].setAuxiliaryObject(true);
        if (newValues[i].isGeoText()) {
          newValues[i].setEuclidianVisible(false);
        }
      }

      GeoElement.setLabels(name, newValues); // set names to be D1,
      // E1,
      // F1, etc for multiple
      // objects
    } catch (CircularDefinitionException ce) {
      // circular definition
      kernel.getApplication().showError("CircularDefinition");
      return null;
    } catch (Exception e) {
      // create text if something went wrong
      if (text.startsWith("\"")) text = text.substring(1, text.length() - 2);
      text = "\"" + (text.replace("\"", "\"+UnicodeToLetter[34]+\"")) + "\"";
      newValues = kernel.getAlgebraProcessor().processAlgebraCommandNoExceptions(text, false);
      newValues[0].setLabel(name);
      newValues[0].setEuclidianVisible(false);
      newValues[0].update();
    }
    return newValues[0];
  }
Ejemplo n.º 4
0
  private static GeoElement updateOldValue(
      Kernel kernel, GeoElement oldValue, String name, String text) throws Exception {
    String text0 = text;
    if (text.charAt(0) == '=') {
      text = text.substring(1);
    }
    GeoElement newValue = null;
    try {
      // always redefine objects in spreadsheet, don't store undo info
      // here
      newValue =
          kernel
              .getAlgebraProcessor()
              .changeGeoElementNoExceptionHandling(oldValue, text, true, false);

      // newValue.setConstructionDefaults();
      newValue.setAllVisualProperties(oldValue, true);
      if (oldValue.isAuxiliaryObject()) {
        newValue.setAuxiliaryObject(true);
      }

      // Application.debug("GeoClassType = " +
      // newValue.getGeoClassType()+" " + newValue.getGeoClassType());
      if (newValue.getGeoClassType() == oldValue.getGeoClassType()) {
        // newValue.setVisualStyle(oldValue);
      } else {
        kernel.getApplication().refreshViews();
      }
    } catch (CircularDefinitionException cde) {
      kernel.getApplication().showError("CircularDefinition");
      return null;
    } catch (Throwable e) {
      // if exception is thrown treat the input as text and try to update
      // the cell as a GeoText
      {
        // reset the text string if old value is GeoText
        if (oldValue.isGeoText()) {
          ((GeoText) oldValue).setTextString(text0);
          oldValue.updateCascade();
        }

        // if not currently a GeoText and no children, redefine the cell
        // as new GeoText
        else if (!oldValue.hasChildren()) {
          oldValue.remove();

          // add input as text
          try {
            newValue = prepareNewValue(kernel, name, "\"" + text0 + "\"");
          } catch (Throwable t) {
            newValue = prepareNewValue(kernel, name, "");
          }
          newValue.setEuclidianVisible(false);
          newValue.update();
        }

        // otherwise throw an exception and let the cell revert to the
        // old value
        else {
          throw new Exception(e);
        }
      }
    }
    return newValue;
  }
Ejemplo n.º 5
0
 public RelativeCopy(Kernel kernel0) {
   kernel = kernel0;
   app = kernel.getApplication();
 }
  public void onMouseUp(MouseUpEvent e) {

    GPoint p = table.getIndexFromPixel(e.getClientX(), e.getClientY());
    if (p.getY() == 0 && p.getX() > 0) {
      if (table.isEditing()) editor.cancelCellEditing();
      table.scc.onMouseUp(e);
      return;
    } else if (p.getX() == 0 && p.getY() > 0) {
      if (table.isEditing()) editor.cancelCellEditing();
      table.srh.onMouseUp(e);
      return;
    }

    mouseIsDown = false;
    e.preventDefault();
    boolean eConsumed = false;

    boolean rightClick = (e.getNativeButton() == NativeEvent.BUTTON_RIGHT);

    if (table.getTableMode() == MyTable.TABLE_MODE_AUTOFUNCTION) {
      table.stopAutoFunction();
      return;
    }

    if (!rightClick) {
      if (editor.isEditing()) {
        String text = editor.getEditingValue();
        if (text.startsWith("=")) {
          GPoint point = table.getIndexFromPixel(e.getClientX(), e.getClientY());
          if (point != null) {
            int column = point.getX();
            int row = point.getY();
            if (column != editor.column || row != editor.row) {
              eConsumed = true;
            }
          }
        }
        selectedCellName = null;
        prefix0 = null;
        postfix0 = null;
        table.isDragging2 = false;
        table.repaint();
      }

      if (table.isOverDot) {
        // prevent UI manager from changing selection when mouse
        // is in a neighbor cell but is still over the dot region
        eConsumed = true;
      }

      if (table.isDragingDot) {
        if (table.dragingToColumn == -1 || table.dragingToRow == -1) return;
        int x1 = -1;
        int y1 = -1;
        int x2 = -1;
        int y2 = -1;
        // -|1|-
        // 2|-|3
        // -|4|-
        if (table.dragingToColumn < table.minSelectionColumn) { // 2
          x1 = table.dragingToColumn;
          y1 = table.minSelectionRow;
          x2 = table.minSelectionColumn - 1;
          y2 = table.maxSelectionRow;
        } else if (table.dragingToRow > table.maxSelectionRow) { // 4
          x1 = table.minSelectionColumn;
          y1 = table.maxSelectionRow + 1;
          x2 = table.maxSelectionColumn;
          y2 = table.dragingToRow;
        } else if (table.dragingToRow < table.minSelectionRow) { // 1
          x1 = table.minSelectionColumn;
          y1 = table.dragingToRow;
          x2 = table.maxSelectionColumn;
          y2 = table.minSelectionRow - 1;
        } else if (table.dragingToColumn > table.maxSelectionColumn) { // 3
          x1 = table.maxSelectionColumn + 1;
          y1 = table.minSelectionRow;
          x2 = table.dragingToColumn;
          y2 = table.maxSelectionRow;
        }

        // copy the cells
        boolean succ =
            relativeCopy.doDragCopy(
                table.minSelectionColumn - 1,
                table.minSelectionRow - 1,
                table.maxSelectionColumn - 1,
                table.maxSelectionRow - 1,
                x1 - 1,
                y1 - 1,
                x2 - 1,
                y2 - 1);
        if (succ) {
          app.storeUndoInfo();
        }

        // extend the selection to include the drag copy selection
        table.setSelection(
            Math.min(x1, table.minSelectionColumn) - 1,
            Math.min(y1, table.minSelectionRow) - 1,
            Math.max(x2, table.maxSelectionColumn) - 1,
            Math.max(y2, table.maxSelectionRow) - 1);

        // reset flags and cursor
        table.isOverDot = false;
        table.isDragingDot = false;
        table.dragingToRow = -1;
        table.dragingToColumn = -1;
        // TODO//setTableCursor();

        // prevent UI manager from changing selection
        eConsumed = true;

        table.repaint();
      }
    }

    // Alt click: copy definition to input field
    if (!table.isEditing() && e.isAltKeyDown() && app.showAlgebraInput()) {
      int row = p.getY(); // table.rowAtPoint(e.getPoint());
      int col = p.getX(); // table.columnAtPoint(e.getPoint());
      GeoElement geo = (GeoElement) model.getValueAt(row - 1, col - 1);

      if (geo != null) {
        // F3 key: copy definition to input bar
        app.getGlobalKeyDispatcher().handleFunctionKeyForAlgebraInput(3, geo);
        return;
      }
    }

    // handle right click
    if (rightClick) {
      if (!((AppW) kernel.getApplication()).letShowPopupMenu()) return;

      // change selection if right click is outside current selection
      if (p.getY() < table.minSelectionRow
          || p.getY() > table.maxSelectionRow
          || p.getX() < table.minSelectionColumn
          || p.getX() > table.maxSelectionColumn) {
        // switch to cell selection mode

        if (table.getSelectionType() != MyTable.CELL_SELECT) {
          table.setSelectionType(MyTable.CELL_SELECT);
        }

        // now change the selection
        if (p.getX() > 0 && p.getY() > 0)
          table.changeSelection(p.getY() - 1, p.getX() - 1, false, false);
      }

      // create and show context menu
      /*TODO SpreadsheetContextMenu popupMenu = new SpreadsheetContextMenu(
      		table, e.isShiftDown());
      popupMenu.show(e.getComponent(), e.getX(), e.getY());*/
    }

    if (eConsumed) return;

    // MyTable's default listeners follow, they should be simulated in Web e.g. here

    // change selection if right click is outside current selection
    if (p.getY() != table.leadSelectionRow + 1 || p.getX() != table.leadSelectionColumn + 1) {
      // switch to cell selection mode

      if (p.getY() > 0 && p.getX() > 0) {

        if (table.getSelectionType() != MyTable.CELL_SELECT) {
          table.setSelectionType(MyTable.CELL_SELECT);
        }

        // now change the selection
        table.changeSelection(p.getY() - 1, p.getX() - 1, false, true);
        table.repaint();
      }
    }
  }
Ejemplo n.º 7
0
 /**
  * This method returns a CommandProcessor Object for a corresponding command name. This should be
  * called only if that CommandProcessor object is not there already in the command table.
  *
  * @param cmdName String command name
  * @return Processor for given command
  */
 public CommandProcessor commandTableSwitch(String cmdName) {
   try {
     // This enum switch is Markus's idea.
     // Arpad Fekete, 2011-09-28
     switch (Commands.valueOf(cmdName)) {
       case Mod:
         return new CmdMod(kernel);
       case Div:
         return new CmdDiv(kernel);
       case Min:
         return new CmdMin(kernel);
       case Max:
         return new CmdMax(kernel);
       case LCM:
         return new CmdLCM(kernel);
       case GCD:
         return new CmdGCD(kernel);
       case Expand:
         return new CmdExpand(kernel);
       case Factor:
         return new CmdFactor(kernel);
       case Simplify:
         return new CmdSimplify(kernel);
       case PrimeFactors:
         return new CmdPrimeFactors(kernel);
       case CompleteSquare:
         return new CmdCompleteSquare(kernel);
       case Line:
         return new CmdLine(kernel);
       case Ray:
         return new CmdRay(kernel);
       case AngularBisector:
         return new CmdAngularBisector(kernel);
       case OrthogonalLine:
         return new CmdOrthogonalLine(kernel);
       case Tangent:
         return new CmdTangent(kernel);
       case Segment:
         return new CmdSegment(kernel);
       case Slope:
         return new CmdSlope(kernel);
       case Angle:
         return new CmdAngle(kernel);
       case Direction:
         return new CmdDirection(kernel);
       case Point:
         return new CmdPoint(kernel);
       case Midpoint:
         return new CmdMidpoint(kernel);
       case LineBisector:
         return new CmdLineBisector(kernel);
       case Intersect:
         return new CmdIntersect(kernel);
       case IntersectRegion:
         return new CmdIntersectRegion(kernel);
       case Distance:
         return new CmdDistance(kernel);
       case Length:
         return new CmdLength(kernel);
       case Radius:
         return new CmdRadius(kernel);
       case CircleArc:
         return new CmdCircleArc(kernel);
       case Arc:
         return new CmdArc(kernel);
       case Sector:
         return new CmdSector(kernel);
       case CircleSector:
         return new CmdCircleSector(kernel);
       case CircumcircleSector:
         return new CmdCircumcircleSector(kernel);
       case CircumcircleArc:
         return new CmdCircumcircleArc(kernel);
       case Polygon:
         return new CmdPolygon(kernel);
       case RigidPolygon:
         return new CmdRigidPolygon(kernel);
       case Area:
         return new CmdArea(kernel);
       case Union:
         return new CmdUnion(kernel);
       case Circumference:
         return new CmdCircumference(kernel);
       case Perimeter:
         return new CmdPerimeter(kernel);
       case Locus:
         return new CmdLocus(kernel);
       case Centroid:
         return new CmdCentroid(kernel);
       case TriangleCenter:
         return new CmdKimberling(kernel);
       case Barycenter:
         return new CmdBarycenter(kernel);
       case Trilinear:
         return new CmdTrilinear(kernel);
       case TriangleCubic:
         return new CmdTriangleCubic(kernel);
       case TriangleCurve:
         return new CmdTriangleCurve(kernel);
       case Vertex:
         return new CmdVertex(kernel);
       case PolyLine:
         return new CmdPolyLine(kernel);
       case PointIn:
         return new CmdPointIn(kernel);
       case AffineRatio:
         return new CmdAffineRatio(kernel);
       case CrossRatio:
         return new CmdCrossRatio(kernel);
       case ClosestPoint:
         return new CmdClosestPoint(kernel);
       case Text:
         return new CmdText(kernel);
       case LaTeX:
         return new CmdLaTeX(kernel);
       case LetterToUnicode:
         return new CmdLetterToUnicode(kernel);
       case TextToUnicode:
         return new CmdTextToUnicode(kernel);
       case UnicodeToText:
         return new CmdUnicodeToText(kernel);
       case UnicodeToLetter:
         return new CmdUnicodeToLetter(kernel);
       case FractionText:
         return new CmdFractionText(kernel);
       case SurdText:
         return new CmdSurdText(kernel);
       case TableText:
         return new CmdTableText(kernel);
       case VerticalText:
         return new CmdVerticalText(kernel);
       case RotateText:
         return new CmdRotateText(kernel);
       case Ordinal:
         return new CmdOrdinal(kernel);
       case If:
         return new CmdIf(kernel);
       case CountIf:
         return new CmdCountIf(kernel);
       case IsInteger:
         return new CmdIsInteger(kernel);
       case KeepIf:
         return new CmdKeepIf(kernel);
       case Relation:
         return new CmdRelation(kernel);
       case Defined:
         return new CmdDefined(kernel);
       case IsInRegion:
         return new CmdIsInRegion(kernel);
       case Root:
         return new CmdRoot(kernel);
       case Roots:
         return new CmdRoots(kernel);
       case TurningPoint:
         return new CmdTurningPoint(kernel);
       case Polynomial:
         return new CmdPolynomial(kernel);
       case Function:
         return new CmdFunction(kernel);
       case Extremum:
         return new CmdExtremum(kernel);
       case CurveCartesian:
         return new CmdCurveCartesian(kernel);
       case Derivative:
         return new CmdDerivative(kernel);
       case Integral:
         return new CmdIntegral(kernel, false);
       case IntegralBetween:
         return new CmdIntegral(kernel, true);
       case LowerSum:
         return new CmdLowerSum(kernel);
       case LeftSum:
         return new CmdLeftSum(kernel);
       case RectangleSum:
         return new CmdRectangleSum(kernel);
       case TaylorSeries:
         return new CmdTaylorSeries(kernel);
       case UpperSum:
         return new CmdUpperSum(kernel);
       case TrapezoidalSum:
         return new CmdTrapezoidalSum(kernel);
       case Limit:
         return new CmdLimit(kernel);
       case LimitBelow:
         return new CmdLimitBelow(kernel);
       case LimitAbove:
         return new CmdLimitAbove(kernel);
       case Factors:
         return new CmdFactors(kernel);
       case Degree:
         return new CmdDegree(kernel);
       case Coefficients:
         return new CmdCoefficients(kernel);
       case PartialFractions:
         return new CmdPartialFractions(kernel);
       case Numerator:
         return new CmdNumerator(kernel);
       case Denominator:
         return new CmdDenominator(kernel);
       case ComplexRoot:
         return new CmdComplexRoot(kernel);
       case SolveODE:
         return new CmdSolveODE(kernel);
       case Iteration:
         return new CmdIteration(kernel);
       case PathParameter:
         return new CmdPathParameter(kernel);
       case Asymptote:
         return new CmdAsymptote(kernel);
       case CurvatureVector:
         return new CmdCurvatureVector(kernel);
       case Curvature:
         return new CmdCurvature(kernel);
       case OsculatingCircle:
         return new CmdOsculatingCircle(kernel);
       case IterationList:
         return new CmdIterationList(kernel);
       case RootList:
         return new CmdRootList(kernel);
       case ImplicitCurve:
         return new CmdImplicitPoly(kernel);
       case Ellipse:
         return new CmdEllipse(kernel);
       case Hyperbola:
         return new CmdHyperbola(kernel);
       case SecondAxisLength:
         return new CmdSecondAxisLength(kernel);
       case SecondAxis:
         return new CmdSecondAxis(kernel);
       case Directrix:
         return new CmdDirectrix(kernel);
       case Diameter:
         return new CmdDiameter(kernel);
       case Conic:
         return new CmdConic(kernel);
       case FirstAxis:
         return new CmdFirstAxis(kernel);
       case Circle:
         return new CmdCircle(kernel);
       case Incircle:
         return new CmdIncircle(kernel);
       case Semicircle:
         return new CmdSemicircle(kernel);
       case FirstAxisLength:
         return new CmdFirstAxisLength(kernel);
       case Parabola:
         return new CmdParabola(kernel);
       case Focus:
         return new CmdFocus(kernel);
       case Parameter:
         return new CmdParameter(kernel);
       case Center:
         return new CmdCenter(kernel);
       case Polar:
         return new CmdPolar(kernel);
       case Excentricity:
         return new CmdExcentricity(kernel);
       case Eccentricity:
         return new CmdEccentricity(kernel);
       case Axes:
         return new CmdAxes(kernel);
       case Sort:
         return new CmdSort(kernel);
       case First:
         return new CmdFirst(kernel);
       case Last:
         return new CmdLast(kernel);
       case Take:
         return new CmdTake(kernel);
       case RemoveUndefined:
         return new CmdRemoveUndefined(kernel);
       case Reverse:
         return new CmdReverse(kernel);
       case Element:
         return new CmdElement(kernel);
       case IndexOf:
         return new CmdIndexOf(kernel);
       case Append:
         return new CmdAppend(kernel);
       case Join:
         return new CmdJoin(kernel);
       case Flatten:
         return new CmdFlatten(kernel);
       case Insert:
         return new CmdInsert(kernel);
       case Sequence:
         return new CmdSequence(kernel);
       case SelectedElement:
         return new CmdSelectedElement(kernel);
       case SelectedIndex:
         return new CmdSelectedIndex(kernel);
       case RandomElement:
         return new CmdRandomElement(kernel);
       case Product:
         return new CmdProduct(kernel);
       case Frequency:
         return new CmdFrequency(kernel);
       case Unique:
         return new CmdUnique(kernel);
       case Classes:
         return new CmdClasses(kernel);
       case Zip:
         return new CmdZip(kernel);
       case Intersection:
         return new CmdIntersection(kernel);
       case PointList:
         return new CmdPointList(kernel);
       case OrdinalRank:
         return new CmdOrdinalRank(kernel);
       case TiedRank:
         return new CmdTiedRank(kernel);
       case BarChart:
         return new CmdBarChart(kernel);
       case BoxPlot:
         return new CmdBoxPlot(kernel);
       case Histogram:
         return new CmdHistogram(kernel);
       case HistogramRight:
         return new CmdHistogramRight(kernel);
       case DotPlot:
         return new CmdDotPlot(kernel);
       case StemPlot:
         return new CmdStemPlot(kernel);
       case ResidualPlot:
         return new CmdResidualPlot(kernel);
       case FrequencyPolygon:
         return new CmdFrequencyPolygon(kernel);
       case NormalQuantilePlot:
         return new CmdNormalQuantilePlot(kernel);
       case FrequencyTable:
         return new CmdFrequencyTable(kernel);
       case Sum:
         return new CmdSum(kernel);
       case Mean:
         return new CmdMean(kernel);
       case Variance:
         return new CmdVariance(kernel);
       case SD:
         return new CmdSD(kernel);
       case SampleVariance:
         return new CmdSampleVariance(kernel);
       case SampleSD:
         return new CmdSampleSD(kernel);
       case Median:
         return new CmdMedian(kernel);
       case Q1:
         return new CmdQ1(kernel);
       case Q3:
         return new CmdQ3(kernel);
       case Mode:
         return new CmdMode(kernel);
       case SigmaXX:
         return new CmdSigmaXX(kernel);
       case SigmaXY:
         return new CmdSigmaXY(kernel);
       case SigmaYY:
         return new CmdSigmaYY(kernel);
       case Covariance:
         return new CmdCovariance(kernel);
       case SXY:
         return new CmdSXY(kernel);
       case SXX:
         return new CmdSXX(kernel);
       case SYY:
         return new CmdSYY(kernel);
       case MeanX:
         return new CmdMeanX(kernel);
       case MeanY:
         return new CmdMeanY(kernel);
       case PMCC:
         return new CmdPMCC(kernel);
       case SampleSDX:
         return new CmdSampleSDX(kernel);
       case SampleSDY:
         return new CmdSampleSDY(kernel);
       case SDX:
         return new CmdSDX(kernel);
       case SDY:
         return new CmdSDY(kernel);
       case FitLineY:
         return new CmdFitLineY(kernel);
       case FitLineX:
         return new CmdFitLineX(kernel);
       case FitPoly:
         return new CmdFitPoly(kernel);
       case FitExp:
         return new CmdFitExp(kernel);
       case FitLog:
         return new CmdFitLog(kernel);
       case FitPow:
         return new CmdFitPow(kernel);
       case Fit:
         return new CmdFit(kernel);
       case FitGrowth:
         return new CmdFitGrowth(kernel);
       case FitSin:
         return new CmdFitSin(kernel);
       case FitLogistic:
         return new CmdFitLogistic(kernel);
       case SumSquaredErrors:
         return new CmdSumSquaredErrors(kernel);
       case RSquare:
         return new CmdRSquare(kernel);
       case Sample:
         return new CmdSample(kernel);
       case Shuffle:
         return new CmdShuffle(kernel);
       case Spearman:
         return new CmdSpearman(kernel);
       case TTest:
         return new CmdTTest(kernel);
       case TTestPaired:
         return new CmdTTestPaired(kernel);
       case TTest2:
         return new CmdTTest2(kernel);
       case TMeanEstimate:
         return new CmdTMeanEstimate(kernel);
       case TMean2Estimate:
         return new CmdTMean2Estimate(kernel);
       case ANOVA:
         return new CmdANOVA(kernel);
       case Percentile:
         return new CmdPercentile(kernel);
       case GeometricMean:
         return new CmdGeometricMean(kernel);
       case HarmonicMean:
         return new CmdHarmonicMean(kernel);
       case RootMeanSquare:
         return new CmdRootMeanSquare(kernel);
       case Random:
         return new CmdRandom(kernel);
       case RandomNormal:
         return new CmdRandomNormal(kernel);
       case RandomUniform:
         return new CmdRandomUniform(kernel);
       case RandomBinomial:
         return new CmdRandomBinomial(kernel);
       case RandomPoisson:
         return new CmdRandomPoisson(kernel);
       case Normal:
         return new CmdNormal(kernel);
       case LogNormal:
         return new CmdLogNormal(kernel);
       case Logistic:
         return new CmdLogistic(kernel);
       case InverseNormal:
         return new CmdInverseNormal(kernel);
       case Binomial:
         return new CmdBinomial(kernel);
       case BinomialDist:
         return new CmdBinomialDist(kernel);
       case Bernoulli:
         return new CmdBernoulli(kernel);
       case InverseBinomial:
         return new CmdInverseBinomial(kernel);
       case TDistribution:
         return new CmdTDistribution(kernel);
       case InverseTDistribution:
         return new CmdInverseTDistribution(kernel);
       case FDistribution:
         return new CmdFDistribution(kernel);
       case InverseFDistribution:
         return new CmdInverseFDistribution(kernel);
       case Gamma:
         return new CmdGamma(kernel);
       case InverseGamma:
         return new CmdInverseGamma(kernel);
       case Cauchy:
         return new CmdCauchy(kernel);
       case InverseCauchy:
         return new CmdInverseCauchy(kernel);
       case ChiSquared:
         return new CmdChiSquared(kernel);
       case InverseChiSquared:
         return new CmdInverseChiSquared(kernel);
       case Exponential:
         return new CmdExponential(kernel);
       case InverseExponential:
         return new CmdInverseExponential(kernel);
       case HyperGeometric:
         return new CmdHyperGeometric(kernel);
       case InverseHyperGeometric:
         return new CmdInverseHyperGeometric(kernel);
       case Pascal:
         return new CmdPascal(kernel);
       case InversePascal:
         return new CmdInversePascal(kernel);
       case Poisson:
         return new CmdPoisson(kernel);
       case InversePoisson:
         return new CmdInversePoisson(kernel);
       case Weibull:
         return new CmdWeibull(kernel);
       case InverseWeibull:
         return new CmdInverseWeibull(kernel);
       case Zipf:
         return new CmdZipf(kernel);
       case InverseZipf:
         return new CmdInverseZipf(kernel);
       case Triangular:
         return new CmdTriangular(kernel);
       case Uniform:
         return new CmdUniform(kernel);
       case Erlang:
         return new CmdErlang(kernel);
       case ApplyMatrix:
         return new CmdApplyMatrix(kernel);
       case UnitVector:
         return new CmdUnitVector(kernel);
       case Vector:
         return new CmdVector(kernel);
       case UnitOrthogonalVector:
         return new CmdUnitOrthogonalVector(kernel);
       case OrthogonalVector:
         return new CmdOrthogonalVector(kernel);
       case Invert:
         return new CmdInvert(kernel);
       case Transpose:
         return new CmdTranspose(kernel);
       case ReducedRowEchelonForm:
         return new CmdReducedRowEchelonForm(kernel);
       case Determinant:
         return new CmdDeterminant(kernel);
       case Identity:
         return new CmdIdentity(kernel);
       case Mirror:
         return new CmdMirror(kernel);
       case Dilate:
         return new CmdDilate(kernel);
       case Rotate:
         return new CmdRotate(kernel);
       case Translate:
         return new CmdTranslate(kernel);
       case Shear:
         return new CmdShear(kernel);
       case Stretch:
         return new CmdStretch(kernel);
       case CellRange:
         return new CmdCellRange(kernel); // cell range for spreadsheet like A1:A5
       case Row:
         return new CmdRow(kernel);
       case Column:
         return new CmdColumn(kernel);
       case ColumnName:
         return new CmdColumnName(kernel);
       case FillRow:
         return new CmdFillRow(kernel);
       case FillColumn:
         return new CmdFillColumn(kernel);
       case FillCells:
         return new CmdFillCells(kernel);
       case Cell:
         return new CmdCell(kernel);
       case CopyFreeObject:
         return new CmdCopyFreeObject(kernel);
       case SetColor:
         return new CmdSetColor(kernel);
       case SetBackgroundColor:
         return new CmdSetBackgroundColor(kernel);
       case SetDynamicColor:
         return new CmdSetDynamicColor(kernel);
       case SetConditionToShowObject:
         return new CmdSetConditionToShowObject(kernel);
       case SetFilling:
         return new CmdSetFilling(kernel);
       case SetLineThickness:
         return new CmdSetLineThickness(kernel);
       case SetLineStyle:
         return new CmdLineStyle(kernel);
       case SetPointStyle:
         return new CmdSetPointStyle(kernel);
       case SetPointSize:
         return new CmdSetPointSize(kernel);
       case SetFixed:
         return new CmdSetFixed(kernel);
       case Rename:
         return new CmdRename(kernel);
       case HideLayer:
         return new CmdHideLayer(kernel);
       case ShowLayer:
         return new CmdShowLayer(kernel);
       case SetCoords:
         return new CmdSetCoords(kernel);
       case Pan:
         return new CmdPan(kernel);
       case ZoomIn:
         return new CmdZoomIn(kernel);
       case ZoomOut:
         return new CmdZoomOut(kernel);
       case SetActiveView:
         return new CmdSetActiveView(kernel);
       case SelectObjects:
         return new CmdSelectObjects(kernel);
       case SetLayer:
         return new CmdSetLayer(kernel);
       case SetCaption:
         return new CmdSetCaption(kernel);
       case SetLabelMode:
         return new CmdSetLabelMode(kernel);
       case SetTooltipMode:
         return new CmdSetTooltipMode(kernel);
       case UpdateConstruction:
         return new CmdUpdateConstruction(kernel);
       case SetValue:
         return new CmdSetValue(kernel);
       case PlaySound:
         return new CmdPlaySound(kernel);
       case ParseToNumber:
         return new CmdParseToNumber(kernel);
       case ParseToFunction:
         return new CmdParseToFunction(kernel);
       case StartAnimation:
         return new CmdStartAnimation(kernel);
       case Delete:
         return new CmdDelete(kernel);
       case Slider:
         return new CmdSlider(kernel);
       case Checkbox:
         return new CmdCheckbox(kernel);
       case Textfield:
         return new CmdTextfield(kernel);
       case Button:
         return new CmdButton(kernel);
       case Execute:
         return new CmdExecute(kernel);
       case GetTime:
         return new CmdGetTime(kernel);
       case ShowLabel:
         return new CmdShowLabel(kernel);
       case SetAxesRatio:
         return new CmdSetAxesRatio(kernel);
       case SetVisibleInView:
         return new CmdSetVisibleInView(kernel);
       case Voronoi:
         return new CmdVoronoi(kernel);
       case Hull:
         return new CmdHull(kernel);
       case ConvexHull:
         return new CmdConvexHull(kernel);
       case MinimumSpanningTree:
         return new CmdMinimumSpanningTree(kernel);
       case DelauneyTriangulation:
         return new CmdDelauneyTriangulation(kernel);
       case TravelingSalesman:
         return new CmdTravelingSalesman(kernel);
       case ShortestDistance:
         return new CmdShortestDistance(kernel);
       case Corner:
         return new CmdCorner(kernel);
       case AxisStepX:
         return new CmdAxisStepX(kernel);
       case AxisStepY:
         return new CmdAxisStepY(kernel);
       case ConstructionStep:
         return new CmdConstructionStep(kernel);
       case Object:
         return new CmdObject(kernel);
       case Name:
         return new CmdName(kernel);
       case SlowPlot:
         return new CmdSlowPlot(kernel);
       case ToolImage:
         return new CmdToolImage(kernel);
       case BarCode:
         return kernel.getApplication().newCmdBarCode();
       case DynamicCoordinates:
         return new CmdDynamicCoordinates(kernel);
       case Maximize:
         return new CmdMaximize(kernel);
       case Minimize:
         return new CmdMinimize(kernel);
       case Curve:
         return new CmdCurveCartesian(kernel);
       case FormulaText:
         return new CmdLaTeX(kernel);
       case IsDefined:
         return new CmdDefined(kernel);
       case ConjugateDiameter:
         return new CmdDiameter(kernel);
       case LinearEccentricity:
         return new CmdExcentricity(kernel);
       case MajorAxis:
         return new CmdFirstAxis(kernel);
       case SemiMajorAxisLength:
         return new CmdFirstAxisLength(kernel);
       case PerpendicularBisector:
         return new CmdLineBisector(kernel);
       case PerpendicularLine:
         return new CmdOrthogonalLine(kernel);
       case PerpendicularVector:
         return new CmdOrthogonalVector(kernel);
       case MinorAxis:
         return new CmdSecondAxis(kernel);
       case SemiMinorAxisLength:
         return new CmdSecondAxisLength(kernel);
       case UnitPerpendicularVector:
         return new CmdUnitOrthogonalVector(kernel);
       case CorrelationCoefficient:
         return new CmdPMCC(kernel);
       case FitLine:
         return new CmdFitLineY(kernel);
       case BinomialCoefficient:
         return new CmdBinomial(kernel);
       case RandomBetween:
         return new CmdRandom(kernel);
       default:
         AbstractApplication.debug("missing case in CommandDispatcher");
         return null;
     }
   } catch (Exception e) {
     AbstractApplication.debug("Warning: command not found / CAS command called:" + cmdName);
   }
   return null;
 }
Ejemplo n.º 8
0
 /**
  * Creates new command dispatcher
  *
  * @param kernel2 Kernel of current application
  */
 public CommandDispatcher(Kernel kernel2) {
   this.kernel = kernel2;
   cons = kernel2.getConstruction();
   app = kernel2.getApplication();
 }
Ejemplo n.º 9
0
  public MyCellEditorBoolean(Kernel kernel) {

    super(new JCheckBox());
    checkBox = (JCheckBox) editorComponent;
    app = (AppD) kernel.getApplication();
  }