Entwurfsmuster Compositum

interface Node<K> { K key() ; List<Node<K>> children () }

class Branch<K> implements Node<K> { 
  K key;  K key() { return this.key; }
  Node<K> left ; Node<K> right;
  List<Node<K>> children() { 
    return new Arrays.asList (new Node<K>[left, right]); }
}
class Leaf<K>   implements Node<K> { .. }



2009-11-20