Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## Mapper
Class Grammar

    java.lang.Object
      Mapper.Grammar

All Implemented Interfaces:
  Mapper

Direct Known Subclasses:
  ContextFreeGrammar

    public abstract class Grammar

extends java.lang.Object
implements Mapper

Abstract class for mapping using a Grammar

Author:
  EHemberg

Method Summary
`abstract void` | `clear()` Clears the mapper by dereferencing the genotype and phenotype.
`abstract boolean` | `genotype2Phenotype()` Maps from a input(genotype) to an output (phenotype)
`abstract java.lang.String` | `getDerivationString()`
`int` | `getProductionCount()` Get the number of productions in the grammar
`java.util.ArrayList<Rule>` | `getRules()` Get the rules in the grammar
`Rule` | `getStartRule()` Return pointer to current start rule.
`Symbol` | `getStartSymbol()` Get the start symbol of the grammar If there are no rules null is returned
`java.util.ArrayList<Symbol>` | `getTerminals()` Get a list of all the symbols which are terminals, ie the alphabet over which this grammar's language is defined.
`java.util.ArrayList<java.lang.String>` | `getTerminalStrings()` Get a list of all the terminal strings for this grammar.
`abstract boolean` | `phenotype2Genotype()` Not yet implemented!
`void` | `setRules(java.util.ArrayList<Rule> newRules)` Set rules in grammar
`boolean` | `setStartSymbol(java.lang.String newStartSymbol)` Change start symbol by string.
`boolean` | `setStartSymbol(Symbol newStartSymbol)` Change start symbol by symbol.

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`
  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`
  Returns:
    Boolean denoting a successful (True) or failed (false) mapping.

### getDerivationString

    public abstract java.lang.String getDerivationString()

### clear

    public abstract void clear()

  Description copied from interface: `Mapper`
  Clears the mapper by dereferencing the genotype and phenotype. After this operation a mapper should be able to perform another mapping. The mapper may also need to reinitialse its internal state: eg clear derivation tree clear string buffers if they are used.

  Specified by:
    `clear` in interface `Mapper`

### getStartSymbol

    public Symbol getStartSymbol()

  Get the start symbol of the grammar If there are no rules null is returned

  Returns:
    start symbol

### setStartSymbol

    public boolean setStartSymbol(Symbol newStartSymbol)

  Change start symbol by symbol.

  Parameters:
    `newStartSymbol` - new start symbol
  Returns:
    success of replacement

### setStartSymbol

    public boolean setStartSymbol(java.lang.String newStartSymbol)

  Change start symbol by string.

  Parameters:
    `newStartSymbol` - new start symbol
  Returns:
    success of replacement

### getStartRule

    public Rule getStartRule()

  Return pointer to current start rule.

  Returns:
    start rule

### getRules

    public java.util.ArrayList<Rule> getRules()

  Get the rules in the grammar

  Returns:
    rules in the grammar

### getProductionCount

    public int getProductionCount()

  Get the number of productions in the grammar

  Returns:
    number of productions

### setRules

    public void setRules(java.util.ArrayList<Rule> newRules)

  Set rules in grammar

  Parameters:
    `newRules` - rules to set

### getTerminals

    public java.util.ArrayList<Symbol> getTerminals()

  Get a list of all the symbols which are terminals, ie the alphabet over which this grammar's language is defined. Warning: this won't include any terminals defined via GECodonValue.

  Returns:
    ArrayList of terminal Symbols.

### getTerminalStrings

    public java.util.ArrayList<java.lang.String> getTerminalStrings()

  Get a list of all the terminal strings for this grammar. Warning: this won't include any terminals defined via GECodonValue.

  Returns:
    list of terminal Strings.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD