Mapper
Class ContextFreeGrammar

java.lang.Object
  extended by Mapper.Grammar
      extended by Mapper.ContextFreeGrammar
All Implemented Interfaces:
Mapper
Direct Known Subclasses:
GEGrammar

public abstract class ContextFreeGrammar
extends Grammar

Abstract ContextFreeGrammar

Author:
EHemberg

Method Summary
 Rule findRule(java.lang.String s)
          Find a rule given a string.
 Rule findRule(Symbol s)
          Find a rule given a symbol.
abstract  boolean genotype2Phenotype()
          Maps from a input(genotype) to an output (phenotype)
 java.util.ArrayList getNonTerminalRules()
          This method returns a vector of the rules with exclusively terminal productions
 java.util.ArrayList getTerminalRules()
          This method returns a vector of the rules with exclusively terminal productions
abstract  int getUsedCodons()
           
abstract  int getUsedWraps()
           
abstract  boolean phenotype2Genotype()
          Not yet implemented!
 boolean readBNFFile(java.lang.String file_name)
          Read a BNF file to a string and call readBNFString to parse the grammar string.
 
Methods inherited from class Mapper.Grammar
clear, getDerivationString, getProductionCount, getRules, getStartRule, getStartSymbol, getTerminals, getTerminalStrings, setRules, setStartSymbol, setStartSymbol
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface Mapper.Mapper
getGenotype, getPhenotype, setGenotype, setPhenotype
 

Method Detail

genotype2Phenotype

public abstract boolean genotype2Phenotype()
Description copied from interface: Mapper
Maps from a input(genotype) to an output (phenotype)

Specified by:
genotype2Phenotype in interface Mapper
Specified by:
genotype2Phenotype in class Grammar
Returns:
Boolean denoting a successful (True) or failed (false) mapping.

phenotype2Genotype

public abstract boolean phenotype2Genotype()
Description copied from interface: Mapper
Not yet implemented!

Specified by:
phenotype2Genotype in interface Mapper
Specified by:
phenotype2Genotype in class Grammar
Returns:
Boolean denoting a successful (True) or failed (false) mapping.

getUsedCodons

public abstract int getUsedCodons()

getUsedWraps

public abstract int getUsedWraps()

readBNFFile

public boolean readBNFFile(java.lang.String file_name)
Read a BNF file to a string and call readBNFString to parse the grammar string. Find file from the class loader

Parameters:
file_name - name of file
Returns:
parse success

findRule

public Rule findRule(Symbol s)
Find a rule given a symbol. Null return indicates no rule found

Parameters:
s - symbol of left hand side of rule
Returns:
found rule or null if no rule found

findRule

public Rule findRule(java.lang.String s)
Find a rule given a string. Null return indicates no rule found

Parameters:
s - string of left hand side of rule
Returns:
found rule or null if no rule found

getTerminalRules

public java.util.ArrayList getTerminalRules()
This method returns a vector of the rules with exclusively terminal productions

Returns:
Vector

getNonTerminalRules

public java.util.ArrayList getNonTerminalRules()
This method returns a vector of the rules with exclusively terminal productions

Returns:
Vector