Package ket.math

Examples of ket.math.Argument


    Function commonFunction = args.firstElement().getFunction();
    if (commonFunction==null) {
      return null;
    }
    for (int i=1; i<args.size(); i++) {
      Argument next = args.get(i);
      Function function = next.getFunction();
      if (commonFunction!=function) {
        return null;
      }
    }
    return commonFunction;
View Full Code Here


   */
  public static int getCommonSize(Vector<Argument> args) {
    if (args.size()==0) {
      return -1;
    }
    Argument first = args.firstElement();
    if (first instanceof Token) {
      return -1;
    }
    int commonSize = first.asBranch().size();
    for (int i=1; i<args.size(); i++) {
      Argument next = args.get(i);
      if (next instanceof Token) {
        return -1;
      }
      int size = next.asBranch().size();
      if (size!=commonSize) {
        return -1;
      }
    }
    return commonSize;
View Full Code Here

    Argument[] pair = Like.equalPairLike(identity);
    if (pair==null) { // c
      return null;
    }
    // The identity is of the form "pair[0] = pair[1]".
    Argument pattern = pair[0];
    Argument expansion = pair[1];
    // In practice, an indentity may appear using different letters
    // and even numbers.  Find the cypher to map from 'pattern' to
    // 'target' and apply the cypher to 'expansion'.
    IdentityHashMap<Token, Token> cypher = pattern.cypherEquals(target);
    if (cypher==null) {
      return null;
    }
    for (Token t : cypher.keySet()) {
    }
    Argument result = Like.substitute(expansion, convertToArgumentMap(cypher));
    return result;
  }
View Full Code Here

    toolBar.add(symbolicFunctions);
  }

  private Argument cloneCurrentRoot() { // TODO: Use this here and in normal responder.
    Equation currentEquation = document.getCursor().getEquation();
    Argument root = currentEquation.getRoot();
    return Argument.cloneArgument(root);
  }
View Full Code Here

    // current -> {family}
    //- int count = 0;
    JPanel panel = null;
    //- for (Argument a : family) {
    for (int count=0; count<family.size(); count++) {
      Argument a = family.get(count);
      int i = count / columns;
      int j = count % columns;
      Box box = a.toBox(0L, document.getColourScheme());
      box.setup(Box.DEFAULT_BOX_FONT_SIZE, new Offset(20, 20)); // Use a fixed icon size?
      BufferedImage image = ImageTools.paintInnerBoxToImage(box, false, document.getColourScheme());
      JButton button = new JButton();
      button.setIcon(new ImageIcon(image));
      //> button.setRolloverIcon(new ImageIcon()); // Highlighted or bold version?
View Full Code Here

    boolean ctrl = (modifier&InputEvent.CTRL_MASK) == InputEvent.CTRL_MASK;
    if ((codeNumber==KeyEvent.VK_C && ctrl) || codeNumber==KeyEvent.VK_ESCAPE) {
      Ket.out.println("[cancel]");
      done();
    }
    Argument selected = button2Arg.get((JButton) getFocusOwner()); // selected -> arg.
    if (selected==null) {
      Ket.out.println("[unknown selection]");
      return;
    }
    Index index = argument2Index.get(selected);
View Full Code Here

    } else if (source==mUndo) {
      getMathCollection().undo();
    } else if (source==mOut) {
      getDeleteMode().deleteParent();
    } else if (source==mClone) {
      Argument clone = Argument.cloneArgument(getCurrent());
      getSelection().appendEquation(new Equation(clone));
    } else if (source==mCut) {
      getDeleteMode().remove();
    } else if (source==mCompositon) {
      getAddMode().appendPurpose(chord);
View Full Code Here

TOP

Related Classes of ket.math.Argument

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.