Examples of replaceCar()


Examples of lipstone.joshua.parser.util.ConsCell.replaceCar()

 
  public ConsCell seekOperations(ConsCell input) throws ParserException {
    ConsCell current = input;
    do {
      if (current.getCarType() == ConsType.CONS_CELL)
        current.replaceCar(seekOperations((ConsCell) current.getCar()));
      if (current.getCarType() == ConsType.IDENTIFIER && operations.containsKey(current.getCar()))
        current.replaceCar(runOperation(current, false));
    } while (!((current = current.getNextConsCell()).isNull())); //This steps current forward while checking for nulls
    return input;
  }
View Full Code Here

Examples of lipstone.joshua.parser.util.ConsCell.replaceCar()

    ConsCell current = input;
    do {
      if (current.getCarType() == ConsType.CONS_CELL)
        current.replaceCar(seekOperations((ConsCell) current.getCar()));
      if (current.getCarType() == ConsType.IDENTIFIER && operations.containsKey(current.getCar()))
        current.replaceCar(runOperation(current, false));
    } while (!((current = current.getNextConsCell()).isNull())); //This steps current forward while checking for nulls
    return input;
  }
 
  private ConsCell processEquation(ConsCell input) throws ParserException {
View Full Code Here

Examples of lipstone.joshua.parser.util.ConsCell.replaceCar()

      return output;
    ConsCell current = output;
    do {
      if (current.getCarType() == ConsType.OBJECT && ((String) current.getCar()).startsWith("{FIN")) {
        int finalSub = Integer.parseInt(((String) current.getCar()).substring(4, ((String) current.getCar()).length() - 1));
        current.replaceCar(finalSubstitutions.get(finalSub));
      }
    } while (!((current = current.getNextConsCell()).isNull())); //This steps output forward while checking for nulls
    return output;
  }
 
View Full Code Here

Examples of lipstone.joshua.parser.util.ConsCell.replaceCar()

      return input;
    boolean step = true;
    do {
      step = true;
      if (current.getCarType() == ConsType.CONS_CELL) {
        current.replaceCar(removeDoubles((ConsCell) current.getCar()));
        continue;
      }
      if (current.getCarType() != ConsType.OPERATOR || next.getCarType() != ConsType.OPERATOR)
        continue;
      char currentCar = (Character) current.getCar(), nextCar = (Character) next.getCar();
View Full Code Here

Examples of lipstone.joshua.parser.util.ConsCell.replaceCar()

      if (current.getCarType() != ConsType.OPERATOR || next.getCarType() != ConsType.OPERATOR)
        continue;
      char currentCar = (Character) current.getCar(), nextCar = (Character) next.getCar();
      if ((currentCar == '*' && nextCar == '/') || (currentCar == '/' && nextCar == '*')) {
        next.remove();
        current.replaceCar(new ConsCell('/', ConsType.OPERATOR));
        step = false;
      }
      if ((currentCar == '-' && nextCar == '-') || (currentCar == '+' && nextCar == '+')) {
        next.remove();
        current.replaceCar(new ConsCell('+', ConsType.OPERATOR));
View Full Code Here

Examples of lipstone.joshua.parser.util.ConsCell.replaceCar()

        current.replaceCar(new ConsCell('/', ConsType.OPERATOR));
        step = false;
      }
      if ((currentCar == '-' && nextCar == '-') || (currentCar == '+' && nextCar == '+')) {
        next.remove();
        current.replaceCar(new ConsCell('+', ConsType.OPERATOR));
        step = false;
      }
      if ((currentCar == '-' && nextCar == '+') || (currentCar == '+' && nextCar == '-')) {
        next.remove();
        current.replaceCar(new ConsCell('-', ConsType.OPERATOR));
View Full Code Here

Examples of lipstone.joshua.parser.util.ConsCell.replaceCar()

        current.replaceCar(new ConsCell('+', ConsType.OPERATOR));
        step = false;
      }
      if ((currentCar == '-' && nextCar == '+') || (currentCar == '+' && nextCar == '-')) {
        next.remove();
        current.replaceCar(new ConsCell('-', ConsType.OPERATOR));
        step = false;
      }
      if (nextCar == '^')
        current.insert(new ConsCell(BigDec.ZERO, ConsType.NUMBER));
      next = current.getNextConsCell();
View Full Code Here

Examples of lipstone.joshua.parser.util.ConsCell.replaceCar()

  public ConsCell replaceKeywords(ConsCell input) throws SyntaxException, UnbalancedParenthesesException, ParserException {
    ConsCell current = input;
    do {
      if (current.getCarType() == ConsType.IDENTIFIER) {
        if (keywords.containsKey(current.getCar()))
          current.replaceCar(Tokenizer.tokenizeString(((KeywordPlugin) this.keywords.get(current.getCar()).getPlugin()).getKeywordData((String) current.getCar())));
      }
      if (current.getCarType() == ConsType.CONS_CELL)
        current.replaceCar(replaceKeywords((ConsCell) current.getCar()));
    } while (!((current = current.getNextConsCell()).isNull())); //This steps current forward while checking for nulls
    return input;
View Full Code Here

Examples of lipstone.joshua.parser.util.ConsCell.replaceCar()

      if (current.getCarType() == ConsType.IDENTIFIER) {
        if (keywords.containsKey(current.getCar()))
          current.replaceCar(Tokenizer.tokenizeString(((KeywordPlugin) this.keywords.get(current.getCar()).getPlugin()).getKeywordData((String) current.getCar())));
      }
      if (current.getCarType() == ConsType.CONS_CELL)
        current.replaceCar(replaceKeywords((ConsCell) current.getCar()));
    } while (!((current = current.getNextConsCell()).isNull())); //This steps current forward while checking for nulls
    return input;
  }
 
  /**
 
View Full Code Here

Examples of lipstone.joshua.parser.util.ConsCell.replaceCar()

    ConsCell output = new ConsCell();
    input = removeExcessParentheses(input);
    ConsCell current = input;
    do { //Recursion
      if (current.getCarType() == ConsType.CONS_CELL)
        current.replaceCar(simplifyTerms((ConsCell) current.getCar()));
    } while (!((current = current.getNextConsCell()).isNull()));
   
    ArrayList<ConsCell> terms = foldSigns(getTerms(input));
    ArrayList<PairedList<ConsCell, ConsCell>> orders = new ArrayList<PairedList<ConsCell, ConsCell>>();
    ArrayList<String> vars = parser.getVars();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.