Package ket.math.purpose

Examples of ket.math.purpose.Word


        if (string==null) {
          Token unknown = readNextSymbol(equation, knownArguments);
          tokenList.append(unknown);
          continue;
        }
        Word word = new Word(string);
        Token variable = new VariableToken(word);
        tokenList.append(variable);
      } else {
        Token unknown = readNextSymbol(equation, knownArguments);
        tokenList.append(unknown);
View Full Code Here


   */
  public static Argument parseAs(String argumentString, Argument x) { // "sin(x)", token(q) -> sin(q)
    Argument a = ArgumentParser.parseArgument(argumentString, Ket.KNOWN_ARGUMENTS, null, null);
    if (a==null) return null;
    Edit e = new Edit(a);
    e.substitute(new Token(new Word("x")), x);
    return e.getCurrent();
  }
View Full Code Here

    charToFunctionMap = new HashMap<Character,Function>(defaultCharToFunctionMap);
  }

  public void recordVariable(State state) {
    if (state instanceof Word) {
      Word word = (Word) state;
      String name = word.getValue();
      recordUniqueVariable(name);
    } else {
      recordUniqueVariable(state);
    }
  }
View Full Code Here

      }
      return state;
    } else {
      String name = function.getName();
      recordUniqueVariable(name);
      return new Word(name);
    }
  }
View Full Code Here

  Vector<State> options;
  public OperandMenuFrame(Document document, JButton source) {
    super(document);
    options = new Vector<State>(Arrays.asList(
          new IntegerValue(0), new IntegerValue(1), new IntegerValue(2), new IntegerValue(10),
          new Word("a"), new Word("x"), new Word("y"), new Word("z")));
    options.addAll(Symbol.DEFAULT_OPERAND_SYMBOLS);
    setupUserInterface(source, 4, 4, 200, 100, "Replace selection with a symbol."); // column x row
    setHold(true);
  }
View Full Code Here

  public VariableToken asVariableToken(KnownArguments knownArguments) {
    Function function = this.getFunction();
    VariableState state = knownArguments.functionToState(function);
    if (state==null) {
      state = new Word(function.getName());
    }
    return new VariableToken(state);
  }
View Full Code Here

    } else if (Character.isLetter(character)) {
      if (getCurrent().isBranch()) { // abc...
        Function f = getKnownArguments().recordUniqueFunction(letter);
        getCurrent().asBranch().setFunction(f);
      } else {
        getSelection().replace(new Token(new Word(letter)));
      }
    // other cases
    } else {
      System.out.println("[error]");
    }
View Full Code Here

    return document.getEquationList().getEquations();
  }

  public void calc() {
    lines.clear();
    Word horizontal = new Word("x");
    Word time = new Word("t");
    for (Equation e : getEquations()) {
      Argument root = e.getRoot();
      Set<Token> variables = root.getVariables();
      if (hasOnly(variables, horizontal)) {
        // i.e. A simple plot, f(x).
View Full Code Here

    setHold(true);
  }

  @Override
  public void buttonSetup() {
    Branch one = new Branch(Function.UNKNOWN, new Token(new Word("a")));
    Branch two = new Branch(Function.UNKNOWN, new Token(new Word("x")), new Token(new Word("y")));
    /*
      * / =
      + - '
      ^ Q I
    */
 
View Full Code Here

   * Access a clipboard register using 'percentage letter' notation;
   * either by a letter or a digit depending on the type of purpose.
   */
  public Argument getArgument(Purpose purpose) {
    if (purpose instanceof Word) {
      Word word = (Word) purpose;
      String value = word.getValue();
      if (value.length()==1) {
        return getArgument(value);
      } else {
        return null;
      }
View Full Code Here

TOP

Related Classes of ket.math.purpose.Word

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.