|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectMapper.Grammar
Mapper.ContextFreeGrammar
Mapper.GEGrammar
public class GEGrammar
Class for GEGrammar. GEGrammar uses a GEChromosome to map out a Phenotype
Constructor Summary | |
---|---|
GEGrammar()
Creates a new instance of GEGrammar |
|
GEGrammar(GEGrammar copy)
Copy constructor. |
|
GEGrammar(java.util.Properties p)
New instance |
|
GEGrammar(java.lang.String file)
New instance |
Method Summary | |
---|---|
void |
clear()
Clear the grammar |
boolean |
equals(java.lang.Object obj)
|
void |
generatePRC()
Replaces constants in the grammar with an array of randomly generated constants |
boolean |
genotype2Phenotype()
Map input to output |
boolean |
genotype2Phenotype(boolean b)
Instanciates a derivation tree and calls buildDerivationTree() if b is true else sets valid map to true |
java.lang.String |
getDerivationString()
|
DerivationTree |
getDerivationTree()
|
int |
getDTNodeCount()
|
GEChromosome |
getGenotype()
Returns the mappers input (genotype) |
static GEGrammar |
getGrammar(GEGrammar g)
Get a grammar of the right type |
int |
getMaxChromosomeLengthByDepth()
This method calculates an upper bound for the number of inputs needed to build a derivation tree according to the specified maxDerivationTreeDepth and the max number of non terminals in a production of the grammars rules. |
int |
getMaxCurrentTreeDepth()
Get the max depth of the derivation tree built by the grammar |
int |
getMaxDerivationTreeDepth()
|
int |
getMaxWraps()
Get max wraps allowed |
java.lang.String |
getName()
|
Phenotype |
getPhenotype()
Returns the mappers output (phenotype) |
int |
getUsedCodons()
Get used inputs (codons in the genotype) |
int |
getUsedWraps()
Get used wraps (Number of times the input was reread from the start) |
int |
hashCode()
|
boolean |
phenotype2Genotype()
Map output to input |
void |
setDerivationTree(DerivationTree dT)
Set the derivation tree |
void |
setDerivationTreeType(java.lang.String derivationTreeType)
|
void |
setGenotype(GEChromosome genotype)
Set input |
void |
setGenotype(java.lang.Object g)
Sets the input (genotype) |
void |
setMaxCurrentTreeDepth(int maxCurrentTreeDepth)
Set the max depth of the derriation tree that was built by this grammar |
void |
setMaxDerivationTreeDepth(int maxDerivationTreeDepth)
|
void |
setMaxWraps(int i)
Set max wraps |
void |
setPhenotype(java.lang.Object p)
Sets the output(phenotype) |
void |
setPhenotype(Phenotype phenotype)
Set output |
void |
setProperties(java.util.Properties p)
Set properties |
Methods inherited from class Mapper.ContextFreeGrammar |
---|
findRule, findRule, getNonTerminalRules, getTerminalRules, readBNFFile |
Methods inherited from class Mapper.Grammar |
---|
getProductionCount, getRules, getStartRule, getStartSymbol, getTerminals, getTerminalStrings, setRules, setStartSymbol, setStartSymbol |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public GEGrammar()
public GEGrammar(java.lang.String file)
file
- file to read grammar frompublic GEGrammar(java.util.Properties p)
p
- propertiespublic GEGrammar(GEGrammar copy)
copy
- grammar to copyMethod Detail |
---|
public void setProperties(java.util.Properties p)
setProperties
in interface ParameterI
p
- object containing propertiespublic boolean genotype2Phenotype()
genotype2Phenotype
in interface Mapper
genotype2Phenotype
in class ContextFreeGrammar
public boolean phenotype2Genotype()
phenotype2Genotype
in interface Mapper
phenotype2Genotype
in class ContextFreeGrammar
public void generatePRC()
public void clear()
clear
in interface Mapper
clear
in class Grammar
public boolean genotype2Phenotype(boolean b)
b
- if tree should be built
public static GEGrammar getGrammar(GEGrammar g)
g
- grammar to create new instance of;
public int getMaxCurrentTreeDepth()
public void setMaxCurrentTreeDepth(int maxCurrentTreeDepth)
maxCurrentTreeDepth
- public int getMaxWraps()
public void setMaxWraps(int i)
i
- max wrapspublic void setGenotype(GEChromosome genotype)
genotype
- inputpublic void setPhenotype(Phenotype phenotype)
phenotype
- outputpublic Phenotype getPhenotype()
Mapper
getPhenotype
in interface Mapper
public GEChromosome getGenotype()
Mapper
getGenotype
in interface Mapper
public void setPhenotype(java.lang.Object p)
Mapper
setPhenotype
in interface Mapper
p
- output to setpublic void setGenotype(java.lang.Object g)
Mapper
setGenotype
in interface Mapper
g
- input to setpublic int getUsedCodons()
getUsedCodons
in class ContextFreeGrammar
public int getUsedWraps()
getUsedWraps
in class ContextFreeGrammar
public int getMaxDerivationTreeDepth()
public void setMaxDerivationTreeDepth(int maxDerivationTreeDepth)
public void setDerivationTree(DerivationTree dT)
dT
- Derivation Treepublic DerivationTree getDerivationTree()
public int getMaxChromosomeLengthByDepth()
public java.lang.String getName()
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public int getDTNodeCount()
public void setDerivationTreeType(java.lang.String derivationTreeType)
public java.lang.String getDerivationString()
getDerivationString
in class Grammar
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |