Package ket.math.purpose

Examples of ket.math.purpose.SymbolicState


      return null;
    } else if (state instanceof Word) {
      String pattern = ((Word) state).getValue();
      return recordUniqueFunction(pattern);
    } else if (state instanceof SymbolicState) {
      SymbolicState prefixState = (SymbolicState) state;
      SymbolicFunction symbolicFunction = new SymbolicFunctionBuilder(
          prefixState.getName(),
          Children.ANY_NUMBER_OF_CHILDREN,
          Function.DEFAULT_PRECEDENCE)
        .setPrefix(prefixState)
        .setShowBrackets()
        .build();
View Full Code Here


          }
          boxes.add(boxArgs.lastElement());
          break;

        default:
          SymbolicState infixSymbol = isInfix() ? getInfix() : Symbol.COMMA;
          for (int i=0; i<boxArgs.size()-1; i++) {
            boxes.add(boxArgs.get(i));
            Box inf = infixSymbol.toBox(argument, Box.PLAIN_FONT, colourScheme);
            //- inf.setArgument(argument);
            boxes.add(inf);
          }
          boxes.add(boxArgs.lastElement());
      }
View Full Code Here

    if (function==Function.EQUALS  ||
        function==Function.ADD || function==Function.MINUS ||
        function==Function.TIMES || function==Function.FRACTION ||
        function==Function.LESS_EQUALS || function==Function.LESS_THAN ||
        function==Function.GREATER_EQUALS || function==Function.GREATER_THAN) {
      SymbolicState infix = ((SymbolicFunction) function).getInfix();
      notation += infix.getName(); //i.e. +, -, * or /. 
    } else if (function==null) {
      notation += Function.UNKNOWN.getName();
    } else {
      notation += function.getName();
    }
View Full Code Here

    if ( ! (object instanceof SymbolicFunction) ) {
      return false;
    }
    SymbolicFunction symbolicFunction = (SymbolicFunction) object;
    boolean namesAndPrecidenceMatch = super.equals(symbolicFunction);
    SymbolicState thatPrefix = symbolicFunction.getPrefix();
    boolean prefixesMatch = prefix==null ? thatPrefix==null: prefix.equals(thatPrefix);
    SymbolicState thatInfix = symbolicFunction.getInfix();
    boolean infixesMatch = infix==null ? thatInfix==null: infix.equals(thatInfix);
    SymbolicState thatPostfix = symbolicFunction.getPostfix();
    boolean postfixesMatch = postfix==null ? thatPostfix==null: postfix.equals(thatPostfix);
    return namesAndPrecidenceMatch & prefixesMatch & infixesMatch & postfixesMatch;
  }
View Full Code Here

  public SymbolicFunctionBuilder(String name, int[] numberOfChildren, int precedence) {
    this.name = name;
    this.numberOfChildren = numberOfChildren;
    this.precedence = precedence;
    SymbolicState prefix = null
    SymbolicState infix = null;
    SymbolicState postfix = null;
    boolean hasBranckets = false; // <--- This is only used for '?'; it could generalize, but may be simpler to remove for now.
    form = null; // Ensure this is not null before use.
  }
View Full Code Here

TOP

Related Classes of ket.math.purpose.SymbolicState

Copyright © 2018 www.massapicom. 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.