站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > JBoss RULES 3.0.6 API 英文版文档

NLGrammar - JBoss RULES 3.0.6 API 英文版文档


org.drools.lang.dsl.template
Class NLGrammar

java.lang.Object
  extended by org.drools.lang.dsl.template.NLGrammar
All Implemented Interfaces:
java.io.Serializable

public class NLGrammar
extends java.lang.Object
implements java.io.Serializable

This represents a simple grammar mapping. Order of operations is as stored in the list. Global expressions are processed first, followed by condition or consequence scoped ones.

See Also:
Serialized Form

Constructor Summary
NLGrammar()
           
 
Method Summary
 void addNLItem(NLMappingItem item)
           
 java.lang.String getDescription()
          Get the human readable description of this language definition.
 java.util.List getMappings()
           
 java.util.List getMappings(java.lang.String scope)
          Filter the items for the appropriate scope.
 void load(java.io.Reader reader)
          This will load from a reader to an appropriate text DSL config.
 NLMappingItem parseLine(java.lang.String line)
          This will parse a line into a NLMapping item.
 void removeMapping(NLMappingItem item)
          Will remove the mapping from the grammar.
 void save(java.io.Writer writer)
          Save out the grammar configuration
 void setDescription(java.lang.String description)
          Set the human readable description of this language definition.
 java.util.List validateMapping(NLMappingItem item)
          Validades the mapping returning a list of errors found or an empty list in case of no errors
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NLGrammar

public NLGrammar()
Method Detail

addNLItem

public void addNLItem(NLMappingItem item)

getMappings

public java.util.List getMappings()

getDescription

public java.lang.String getDescription()
Get the human readable description of this language definition. This should just be a comment.


setDescription

public void setDescription(java.lang.String description)
Set the human readable description of this language definition. This should just be a comment.


removeMapping

public void removeMapping(NLMappingItem item)
Will remove the mapping from the grammar.


load

public void load(java.io.Reader reader)
This will load from a reader to an appropriate text DSL config. It it roughly equivalent to a properties file. (you can use a properties file actually), But you can also prefix it with things like: [XXX]Expression=Target Where XXX is either "when" or "then" which indicates which part of the rule the item relates to. If the "XXX" part if left out, then it will apply to the whole rule when looking for a match to expand.


save

public void save(java.io.Writer writer)
Save out the grammar configuration


getMappings

public java.util.List getMappings(java.lang.String scope)
Filter the items for the appropriate scope. Will include global ones.


parseLine

public NLMappingItem parseLine(java.lang.String line)
This will parse a line into a NLMapping item.


validateMapping

public java.util.List validateMapping(NLMappingItem item)
Validades the mapping returning a list of errors found or an empty list in case of no errors

Returns:
a List of MappingError's found or an empty list in case no one was found