Ejemplo n.º 1
0
  /**
   * Method that copies the content of a TreeCell given as parameter to the current formula
   *
   * @param cellCopy the main operator or first input to copy
   * @throws SyntaxErrorException the formula is not syntactically correct
   */
  public void copyTreeCell(TreeCell cellCopy) throws SyntaxErrorException {
    if (cellCopy != null) {
      if (cellCopy.getleftSon() != null) copyTreeCell(cellCopy.getleftSon());

      String cellValue = cellCopy.getcellValue(); // holds the value of the current cell

      if (cellValue != null)
        if (cellValue.length() > 1) addToFormula(cellValue);
        else addToFormula(cellValue.charAt(0));
      if (cellCopy.getrightSon() != null) copyTreeCell(cellCopy.getrightSon());
    }
  }
Ejemplo n.º 2
0
 /**
  * method will set the current cell to all the values of the leftSon, causing the leftSon to
  * replace the currentCell
  */
 public void swapWithLeftSon() {
   setrightSon(leftSon.getrightSon());
   setcellValue(leftSon.getcellValue());
   setstatusCell(leftSon.getstatusCell());
   setleftSon(leftSon.getleftSon());
 }