Nice

From Arnout Engelen

Jump to: navigation, search

http://nice.sf.net - is nice.

[edit] Invoking the compiler

for class 'rbtree.tree', you make a rbtree/tree directory with a tree.nice in it, which might look like:

then 'nicec rbtree/tree' will compile the .nice files in that dir, it seems.

package rbtree.tree;

public <Comparable T,U> ?U getValue(?IntTreeNode<T,U> node, T key);
getValue(null, key) = null;

<Comparable T,U>
class IntTreeNode <T,U> {
  private !T m_key;
  private U m_value;
  private ?IntTreeNode<T,U> left = null;
  private ?IntTreeNode<T,U> right = null;

  public void add (!T key, U value) {
    if (key == m_key) 
    {
      m_value = value;
    } 
    else if (key < m_key) 
    {
      let theleft = left; 
      if (theleft == null) {
        left = new IntTreeNode (m_key: key, m_value: value);
      } else {
        theleft.add (key, value);
        left = theleft;
      }
    } 
    else 
    {
      let theright = right;
      if (theright == null) {
        right = new IntTreeNode (m_key: key, m_value: value);
      } else {
        theright.add (key, value);
        right = theright;
      }
    }
  }

etc

[edit] Starting the app

Invoke the compiler with '-a exec' to get an exec.jar which you can run with 'java -jar exec.jar'. -o doesn't work for me.

Personal tools