Package org.moeaframework.util.grammar
Class Rule
java.lang.Object
org.moeaframework.util.grammar.Rule
A context-free grammar rule.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(Production production) Adds a production to this rule.get(int index) Returns the production at the specified index.Returns the non-terminal symbol of this rule.voidremove(Production production) Removes a production from this rule.intsize()Returns the number of productions contained in this rule.
-
Constructor Details
-
Rule
Constructs a rule with the specified symbol. At least one production must be provided through theadd(Production)method.- Parameters:
symbol- the non-terminal symbol of this rule
-
-
Method Details
-
getSymbol
Returns the non-terminal symbol of this rule.- Returns:
- the non-terminal symbol of this rule
-
add
Adds a production to this rule.- Parameters:
production- the production to be added
-
remove
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
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())
-