wood burning stoves 2.0*
The moose likes OO, Patterns, UML and Refactoring and the fly likes Interpretor Pattern: Need Help Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Engineering » OO, Patterns, UML and Refactoring
Bookmark "Interpretor Pattern: Need Help" Watch "Interpretor Pattern: Need Help" New topic
Author

Interpretor Pattern: Need Help

Deepak Lal
Ranch Hand

Joined: Jul 01, 2008
Posts: 507

Hi,
I'm writing a Java sample program for demonstrating interpretor design Pattern.





Can you please tell me how should i go about writing the "Note class and the Frequency class" for the above example.

How should i invoke the above class from my main method.I'm finding it difficult to proceed.
Need your help ??

Help provided will be appreciated.

--
Deepak Lal



When The Going Gets Tougher,The Tougher gets Going
Ilja Preuss
author
Sheriff

Joined: Jul 11, 2001
Posts: 14112
Where do you see the Interpreter design pattern in this example?


The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Deepak Lal
Ranch Hand

Joined: Jul 01, 2008
Posts: 507

This is an example of Interpretor design pattern.
The musical notes along with their frequencies is stored in the properties file.
By passing a Note,a corresponding frequency is retrieved and based on the frequency a corresponding sound is produced.

Please see the below link for reference.
http://www.allapplabs.com/java_design_patterns/interpreter_pattern.htm.

Can you tell me how should my Note class and Frequency class Look like and how should i write a main method such that it invokes the class. ?

--
Deepak Lal

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Interpretor Pattern: Need Help