MOEA Framework 2.12
API Specification

org.moeaframework.util.grammar
Class Rule

java.lang.Object
  extended by org.moeaframework.util.grammar.Rule

public class Rule
extends Object

A context-free grammar rule.

See Also:
ContextFreeGrammar, Production, Symbol

Constructor Summary
Rule(Symbol symbol)
          Constructs a rule with the specified symbol.
 
Method Summary
 void add(Production production)
          Adds a production to this rule.
 Production get(int index)
          Returns the production at the specified index.
 Symbol getSymbol()
          Returns the non-terminal symbol of this rule.
 void remove(Production production)
          Removes a production from this rule.
 int size()
          Returns the number of productions contained in this rule.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Rule

public Rule(Symbol symbol)
Constructs a rule with the specified symbol. At least one production must be provided through the add(Production) method.

Parameters:
symbol - the non-terminal symbol of this rule
Method Detail

getSymbol

public Symbol getSymbol()
Returns the non-terminal symbol of this rule.

Returns:
the non-terminal symbol of this rule

add

public void add(Production production)
Adds a production to this rule.

Parameters:
production - the production to be added

remove

public void remove(Production production)
Removes a production from this rule.

Parameters:
production - the production to be removed

size

public int size()
Returns the number of productions contained in this rule.

Returns:
the number of productions contained in this rule

get

public Production get(int index)
Returns the production at the specified index.

Parameters:
index - the index of the production to be returned
Returns:
the production at the specified index
Throws:
IndexOutOfBoundsException - if index is out of range ((index < 0) || (index >= size())

MOEA Framework 2.12
API Specification

Copyright 2009-2016 MOEA Framework. All rights reserved.
Licensed under the GNU Lesser General Public License.
Return to the MOEA Framework homepage. Visit us on Github!