hcrypto.analyzer
Class GaIndividual

java.lang.Object
  |
  +--hcrypto.analyzer.GaIndividual
All Implemented Interfaces:
java.lang.Comparable
Direct Known Subclasses:
FreqGaIndividual, WordBasedGaIndividual

public abstract class GaIndividual
extends java.lang.Object
implements java.lang.Comparable


Field Summary
protected  Cipher cipher
           
protected  java.lang.String ciphertext
           
protected  java.lang.String decrypt
           
protected  double fitness
           
protected  java.lang.StringBuffer key
           
protected  SubstitutionKey sKey
           
 
Constructor Summary
GaIndividual(GaIndividual i)
          Copy constructor
GaIndividual(java.lang.String text, java.lang.String initKey)
          This constructor takes an initial distribution for the key as a parameter.
 
Method Summary
abstract  void calcFitness()
          This method should be implemented in the subclass.
 int compareTo(java.lang.Object o)
          From the Comparable interface.
abstract  void cross(GaIndividual i2)
          This abstract method should be implemented in the subclass.
 java.lang.String displayCrossData()
           
 double getFitness()
           
 java.lang.String getKey()
           
abstract  int mutate(double rate)
          This method should be implemented in the subclass.
protected  void swap(char ch1, char ch2)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

key

protected java.lang.StringBuffer key

fitness

protected double fitness

ciphertext

protected java.lang.String ciphertext

decrypt

protected java.lang.String decrypt

cipher

protected Cipher cipher

sKey

protected SubstitutionKey sKey
Constructor Detail

GaIndividual

public GaIndividual(java.lang.String text,
                    java.lang.String initKey)
This constructor takes an initial distribution for the key as a parameter.
Parameters:
text - -- A string giving the text to be decrypted.
initKey - -- A string giving the initial values for the key.

GaIndividual

public GaIndividual(GaIndividual i)
Copy constructor
Method Detail

cross

public abstract void cross(GaIndividual i2)
This abstract method should be implemented in the subclass.
Parameters:
i1 - an Individual parent
i2 - an Individual parent

mutate

public abstract int mutate(double rate)
This method should be implemented in the subclass.
Parameters:
rate - is the mutation rate

calcFitness

public abstract void calcFitness()
This method should be implemented in the subclass.

swap

protected void swap(char ch1,
                    char ch2)

getFitness

public double getFitness()

getKey

public java.lang.String getKey()

compareTo

public int compareTo(java.lang.Object o)
From the Comparable interface.
Specified by:
compareTo in interface java.lang.Comparable

displayCrossData

public java.lang.String displayCrossData()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object