Examples of singular()


Examples of games.stendhal.common.parser.WordList.singular()

   */
  @Test
  public final void testSingular() {
    final WordList wl = WordList.getInstance();

    assertEquals("house", wl.singular("houses"));
    assertEquals("cookie", wl.singular("cookies"));
  }

  /**
   * Tests for trimWords.
View Full Code Here

Examples of games.stendhal.common.parser.WordList.singular()

  @Test
  public final void testSingular() {
    final WordList wl = WordList.getInstance();

    assertEquals("house", wl.singular("houses"));
    assertEquals("cookie", wl.singular("cookies"));
  }

  /**
   * Tests for trimWords.
   */
 
View Full Code Here

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

      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 {
          head.singular().append(leftUnits);
          leftUnits = leftUnits.getPreviousConsCell();
          ConsCell previous = head.getPreviousConsCell();
          power = head.getCarType() != ConsType.NUMBER || (!previous.isNull() && (previous.getCarType() == ConsType.OPERATOR && ((char) previous.getCar() == '^' ||
              ((char) previous.getCar() == '+' || (char) previous.getCar() == '-' && previous.getPreviousConsCell().getCarType() == ConsType.OPERATOR &&
                  (char) previous.getPreviousConsCell().getCar() == '^'))));
View Full Code Here

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

    }
    return term;
  }
 
  private ConsCell multiplicationRule(ConsCell current, ArrayList<String> vars) throws ParserException {
    ConsCell head = current.getPreviousConsCell(), left = head.singular(), right = current.getNextConsCell().clone();
    while (!(head = head.getPreviousConsCell()).isNull() && !(head.getCarType() == ConsType.OPERATOR && ((Character) head.getCar() == '*' || (Character) head.getCar() == '/')))
      left = head.singular().append(left.getFirstConsCell());
    left = left.getFirstConsCell();
    for (int i = 0; i < left.length(); i++)
      current.getPreviousConsCell().remove();
View Full Code Here

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

  }
 
  private ConsCell multiplicationRule(ConsCell current, ArrayList<String> vars) throws ParserException {
    ConsCell head = current.getPreviousConsCell(), left = head.singular(), right = current.getNextConsCell().clone();
    while (!(head = head.getPreviousConsCell()).isNull() && !(head.getCarType() == ConsType.OPERATOR && ((Character) head.getCar() == '*' || (Character) head.getCar() == '/')))
      left = head.singular().append(left.getFirstConsCell());
    left = left.getFirstConsCell();
    for (int i = 0; i < left.length(); i++)
      current.getPreviousConsCell().remove();
   
    ConsCell derivative = new ConsCell();
View Full Code Here

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

    current = current.replace(derivative.getFirstConsCell()).getFirstConsCell();
    return current;
  }
 
  private ConsCell divisionRule(ConsCell current, ArrayList<String> vars) throws ParserException {
    ConsCell head = current.getPreviousConsCell(), left = head.singular(), right = current.getNextConsCell().clone();
    while (!(head = head.getPreviousConsCell()).isNull() && !(head.getCarType() == ConsType.OPERATOR && ((Character) head.getCar() == '*' || (Character) head.getCar() == '/')))
      left = head.singular().append(left.getFirstConsCell());
    left = left.getFirstConsCell();
    for (int i = 0; i < left.length(); i++)
      current.getPreviousConsCell().remove();
View Full Code Here

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

  }
 
  private ConsCell divisionRule(ConsCell current, ArrayList<String> vars) throws ParserException {
    ConsCell head = current.getPreviousConsCell(), left = head.singular(), right = current.getNextConsCell().clone();
    while (!(head = head.getPreviousConsCell()).isNull() && !(head.getCarType() == ConsType.OPERATOR && ((Character) head.getCar() == '*' || (Character) head.getCar() == '/')))
      left = head.singular().append(left.getFirstConsCell());
    left = left.getFirstConsCell();
    for (int i = 0; i < left.length(); i++)
      current.getPreviousConsCell().remove();
   
    ConsCell derivative = new ConsCell();
View Full Code Here

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

    ConsCell left = current.getPreviousConsCell().singular(), right = current.getNextConsCell().singular();
    current.getPreviousConsCell().remove();
    current.getNextConsCell().remove();
    ConsCell temp = current;
    while (!(temp = temp.getPreviousConsCell()).isNull() && temp.getCarType() != ConsType.OPERATOR) {
      left = temp.singular().append(left).getFirstConsCell();
      temp = temp.remove();
    }
    temp = current;
    while (!(temp = temp.getNextConsCell()).isNull() && temp.getCarType() != ConsType.OPERATOR) {
      right = right.append(temp.singular());
View Full Code Here

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

      left = temp.singular().append(left).getFirstConsCell();
      temp = temp.remove();
    }
    temp = current;
    while (!(temp = temp.getNextConsCell()).isNull() && temp.getCarType() != ConsType.OPERATOR) {
      right = right.append(temp.singular());
      temp = temp.remove();
    }
    right = right.getFirstConsCell();
    if (parser.containsVariables(right, vars)) {
      derivative = derivative.append(new ConsCell(symbolicDerivative(right, vars), ConsType.CONS_CELL, new ConsCell('*', ConsType.OPERATOR), ConsType.CONS_CELL));
View Full Code Here

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

      subID = subID(substitution);
    do {
      ConsCell previous = current.getPreviousConsCell();
      if (substitution.isNull()) {
        if (parser.containsVariables(current.singular()) && current.getCarType() == ConsType.CONS_CELL &&
            (current.isFirstConsCell() || !isSubstitution(previous.singular().toString()))) { //If the thing before this isn't a substitution operation
          substitution = ((ConsCell) current.singular().getCar()).clone();
          if (!isOneTerm(substitution))
            substitution = new ConsCell(substitution, ConsType.CONS_CELL);
          subID = subID(substitution);
        }
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.