hcrypto.analyzer
Class CryptogramAnalyzer
java.lang.Object
|
+--hcrypto.analyzer.CryptogramAnalyzer
- All Implemented Interfaces:
- Analyzer
- public class CryptogramAnalyzer
- extends java.lang.Object
- implements Analyzer
Method Summary |
void |
doAnalysis()
This method performs an analysis of the text. |
java.lang.String |
getReport()
This method is part of the Analyzer interface. |
void |
run()
This method is part of the Analyzer interface. |
void |
setup(java.lang.String text)
This method initializes the Analyzer. |
java.lang.String |
toString()
This method returns the report generated by the analysis. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
CryptogramAnalyzer
public CryptogramAnalyzer()
CryptogramAnalyzer
public CryptogramAnalyzer(TextStatistics ts)
throws java.lang.NullPointerException
- This constructor takes a reference to a TextStatistics object that
stores frequency and other data about the text being analyzed. It
creates instances of various tools used by the analyzer.
- Parameters:
ts
- a TextStatistics object
setup
public void setup(java.lang.String text)
- This method initializes the Analyzer. The text is broken into tokens
that are stored in an array. Each token is associated with a pattern
-- 'that' has the pattern '1231'. The tokens are sorted with those
having the smallest (non empty) pattern set given preference.
- Specified by:
setup
in interface Analyzer
- Parameters:
text
- a String pointing to the text being analyzed
run
public void run()
- This method is part of the Analyzer interface. It runs the analysis.
- Specified by:
run
in interface Analyzer
getReport
public java.lang.String getReport()
- This method is part of the Analyzer interface. It returns the report
generated by the analysis.
- Specified by:
getReport
in interface Analyzer
toString
public java.lang.String toString()
- This method returns the report generated by the analysis.
- Overrides:
toString
in class java.lang.Object
doAnalysis
public void doAnalysis()
- This method performs an analysis of the text. It assumes the text
is a word-delimited cryptogram created using a simple substitution cipher.
The anlysis is performed by a recursive backtracking search of the key space.