Nope, that's not what I'm talking about. What I am talking about is ... say I read in a line of input from a file, and that line said "PrintInOrder" for example .. then that would trigger something in the java program that would print out a tree that I had created ... and it would print it out using the print in order method of binary search trees ... but i have no clue how to do this .. so that's my question ... how would i do that?
just use a FileInputStream to read in the lines, then compare them to the method names in a giant if-elseif statement, and call the proper methods inside this. I don't think there's an easy "magic" way of doing it, you have to do one if per method... well perhaps if you look through the reflection api (java.reflect), you may find something... the stuff there sure is magic.
How about implementing an XML Document. The DTD could have a tag called "MethodCaller" and then another tag with a bunch of text. You can then use reflection (as mentioned in previous mail), or some sort of custom XML parser, to analyze the DTD/XML doc and run the methods you need. The problem is that you now have to make sure that the person creating the DTD/XML documents MUST know all about your classes. I suggest XML here because if you DTD doesn't change and everyone writing these 'text/dat' files follows the dtd (which they have to) then you can be assured that the text/dat files can be correctly read by your program.