Examples of replaceCar()


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

  public ConsCell findUnitConversion(ConsCell input) throws ParserException {
    ArrayList<String> oldVars = parser.getVars(); //Save the variables for later
    ConsCell current = input;
    do {
      if (current.getCarType() == ConsType.CONS_CELL)
        current.replaceCar(findUnitConversion((ConsCell) current.getCar()));
      if (current.getCarType() == ConsType.IDENTIFIER && ((String) current.getCar()).equals("in")) {
        ConsCell leftUnits = new ConsCell(), rightUnits = new ConsCell();
        ConsCell head = current.getPreviousConsCell();
        boolean power = true;
        do {
View Full Code Here

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

        if ((Character) current.getCar() == '*' && priority == 0)
          return multiplicationRule(current, vars);
        else if ((Character) current.getCar() == '/' && priority == 0)
          return divisionRule(current, vars);
        else if ((Character) current.getCar() == '^' && priority == 1) {
          current.replaceCar(powerRule(current, vars));
          term = current.getFirstConsCell();
        }
      }
    }
    return term;
View Full Code Here

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

    output = reverseFinalOperationSubstitutions(output);
    ConsCell current = output;
    do {
      if (current.getCarType() == ConsType.OBJECT && ((String) current.getCar()).startsWith("{M")) {
        int matrixNum = Integer.parseInt(((String) current.getCar()).substring(2, ((String) current.getCar()).length() - 1));
        current.replaceCar(new ConsCell(currentEqn.matrices.get(matrixNum).toString(), ConsType.OBJECT));
      }
    } while (!((current = current.getNextConsCell()).isNull())); //This steps output forward while checking for nulls
    finalSubstitutions.clear();
    output = ns.removeExcessParentheses(output);
    for (OutputFilterPlugin plugin : postProcessFilters)
View Full Code Here

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

   */
  public ConsCell replaceSymbolPair(ConsCell input, String startSymbol, String endSymbol, String newStart, String newEnd) throws ParserException {
    ConsCell current = input;
    do {
      if (current.getCarType() == ConsType.CONS_CELL)
        current.replaceCar(replaceSymbolPair((ConsCell) current.getCar(), startSymbol, endSymbol, newStart, newEnd));
      if (current.getCarType() == ConsType.IDENTIFIER && ((String) current.getCar()).equals(startSymbol)) {
        ConsCell inner = new ConsCell(), head = inner;
        int count = 1;
        boolean reset = current == input;
        while (!(current = current.remove()).isNull()) {
View Full Code Here

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

    if (current.length() == 0 || (current.length() == 1 && current.getCarType() == ConsType.EMPTY))
      return current;
   
    do {
      if (current.getCarType() == ConsType.CONS_CELL)
        current.replaceCar(preProcess((ConsCell) current.getCar()));
      if (current.getCarType() == ConsType.OBJECT && ((String) current.getCar()).startsWith("{[")) {
        currentEqn.matrices.add(new Matrix((String) current.getCar()));
        current.replaceCar(new ConsCell("{M" + (currentEqn.matrices.size() - 1) + "}", ConsType.OBJECT));
      }
    } while (!((current = current.getNextConsCell()).isNull())); //This steps current forward while checking for nulls
View Full Code Here

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

    do {
      if (current.getCarType() == ConsType.CONS_CELL)
        current.replaceCar(preProcess((ConsCell) current.getCar()));
      if (current.getCarType() == ConsType.OBJECT && ((String) current.getCar()).startsWith("{[")) {
        currentEqn.matrices.add(new Matrix((String) current.getCar()));
        current.replaceCar(new ConsCell("{M" + (currentEqn.matrices.size() - 1) + "}", ConsType.OBJECT));
      }
    } while (!((current = current.getNextConsCell()).isNull())); //This steps current forward while checking for nulls
    current = input;
   
    for (InputFilterPlugin plugin : preProcessFilters)
View Full Code Here

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

      current = plugin.preProcess(current).getFirstConsCell();
    input = current;
   
    do {
      if (current.getCarType() == ConsType.IDENTIFIER && abbreviations.containsKey(current.getCar()))
        current.replaceCar(new ConsCell(abbreviations.get(current.getCar()), ConsType.IDENTIFIER));
      if (!current.getNextConsCell().isNull() && (current.getCarType() == ConsType.NUMBER || current.getCarType() == ConsType.CONS_CELL ||
          current.getCarType() == ConsType.OBJECT || current.getCarType() == ConsType.STRING)) {
        ConsCell cdr = current.getNextConsCell();
        if (cdr.getCarType() == ConsType.NUMBER || cdr.getCarType() == ConsType.CONS_CELL || cdr.getCarType() == ConsType.OBJECT ||
            (cdr.getCarType() == ConsType.IDENTIFIER && !cdr.getCar().equals("="))) //If there is an implied multiplication sign
View Full Code Here

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

  private ConsCell tokenizedEvaluation(ConsCell input) throws 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())));
        else if (isOperation((String) current.getCar()))
          current.replaceCar(runOperation(current));
      }
      if (current.getCarType() == ConsType.CONS_CELL)
        current.replaceCar(tokenizedEvaluation((ConsCell) current.getCar()));
View Full Code Here

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

    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())));
        else if (isOperation((String) current.getCar()))
          current.replaceCar(runOperation(current));
      }
      if (current.getCarType() == ConsType.CONS_CELL)
        current.replaceCar(tokenizedEvaluation((ConsCell) current.getCar()));
    } while (!((current = current.getNextConsCell()).isNull())); //This steps current forward while checking for nulls
   
View Full Code Here

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

          current.replaceCar(Tokenizer.tokenizeString(((KeywordPlugin) this.keywords.get(current.getCar()).getPlugin()).getKeywordData((String) current.getCar())));
        else if (isOperation((String) current.getCar()))
          current.replaceCar(runOperation(current));
      }
      if (current.getCarType() == ConsType.CONS_CELL)
        current.replaceCar(tokenizedEvaluation((ConsCell) current.getCar()));
    } while (!((current = current.getNextConsCell()).isNull())); //This steps current forward while checking for nulls
   
    return processEquation(input);
  }
 
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.