KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > innig > macker > example > conventions > FactorialTree


1 package net.innig.macker.example.conventions;
2
3 import java.util.*;
4 import java.io.*;
5
6 public class FactorialTree
7     extends StringTree
8     {
9     public FactorialTree()
10         {
11         super(null, "");
12         n = 1;
13         }
14     
15     public FactorialTree(FactorialTree parent, String JavaDoc word, int n)
16         {
17         super(parent, word);
18         this.n = n;
19         }
20
21     protected Set/*<String>*/ getChildSuffixes()
22         {
23         Set suffixes = new TreeSet();
24         for(int j = n; j > 0; j--)
25             suffixes.add('.' + String.valueOf(j));
26         return suffixes;
27         }
28     
29     protected StringTree makeChild(String JavaDoc childWord)
30         { return new FactorialTree(this, childWord, n+1); }
31     
32     private int n;
33     }
Popular Tags