public class ProductionRule extends Object implements IProductionRule
| Constructor and Description |
|---|
ProductionRule(String name,
String regularExpression)
Constructs the ProductionRule
|
ProductionRule(String name,
String approachableRegex,
String allowedRegex)
Constructs the ProductionRule
|
| Modifier and Type | Method and Description |
|---|---|
String |
getName()
Returns the name of production rule.
|
boolean |
isAllowed(String token)
Checks whether the token is allowed or not.
|
boolean |
isApproaching(String pattern)
Checks whether the given token is approachable using any of the pattern
or not.
|
public ProductionRule(String name, String regularExpression)
name - name of the production ruleregularExpression - regular expression, will be used as approachable
and allowed regular expressionIllegalArgumentException - if the parameters are not validpublic ProductionRule(String name, String approachableRegex, String allowedRegex)
name - name of the production ruleapproachableRegex - Regular Expression for checking the
approachable tokenallowedRegex - Expression for checking the
approachable tokenIllegalArgumentException - if the parameters are not validpublic String getName()
IProductionRulegetName in interface IProductionRuleIProductionRule.getName()public boolean isApproaching(String pattern)
IProductionRuleisApproaching in interface IProductionRuletrue if the token pattern is approachable false otherwise.IProductionRule.isApproaching(java.lang.String)public boolean isAllowed(String token)
IProductionRuleisAllowed in interface IProductionRuletoken - the token which is to be checked for its validitytrue if the token is allowed false otherwise.IProductionRule.isAllowed(java.lang.String)