I\'m trying to make a non-binary learning tree that\'s a simplified version of the ID3 algorithm. To do this, I tried to use enums, because there are several references teachin
I had a similar problem, building an hierarchy of enums. But in my case, an hierarchy of classes could also do the trick. In case you are interested here is my post: How to build an hierarchy tree of categories in java using enums or any other way?
Now, concerning only enum hierarchy, as you can see on my post, I found this that may work for you:
http://alexradzin.blogspot.hk/2010/10/hierarchical-structures-with-java-enums_05.html
In particular:
public enum OsType {
OS(null),
Windows(OS),
WindowsNT(Windows),
WindowsNTWorkstation(WindowsNT),
WindowsNTServer(WindowsNT),
Windows2000(Windows),
Windows2000Server(Windows2000),
Windows2000Workstation(Windows2000),
WindowsXp(Windows),
WindowsVista(Windows),
Windows7(Windows),
Windows95(Windows),
Windows98(Windows),
Unix(OS) {
@Override
public boolean supportsXWindows() {
return true;
}
},
Linux(Unix),
AIX(Unix),
HpUx(Unix),
SunOs(Unix),
;
private OsType parent = null;
private OsType(OsType parent) {
this.parent = parent;
}
I hope it helps!