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

FactTemplateImpl (Drools 4.0.0.11754MR2 API) - JBoss RULES 4.0.0.11754MR2 API 英文版文档


org.drools.facttemplates
Class FactTemplateImpl

java.lang.Object
  extended by org.drools.facttemplates.FactTemplateImpl
All Implemented Interfaces:
Serializable, FactTemplate

public class FactTemplateImpl
extends Object
implements FactTemplate

Author:
Peter Lin Deftemplate is equivalent to CLIPS deftemplate
Some general design notes about the current implementation. In the case where a class is declared to create the deftemplate, the order of the slots are based on java Introspection. In the case where an user declares the deftemplate from console or directly, the order is the same as the string equivalent. The current implementation does not address redeclaring a deftemplate for a couple of reasons. The primary one is how does it affect the existing RETE nodes. One possible approach is to always add new slots to the end of the deftemplate and ignore the explicit order. Another is to recompute the deftemplate, binds and all nodes. The second approach is very costly and would make redeclaring a deftemplate undesirable.
See Also:
Serialized Form

Constructor Summary
FactTemplateImpl(Package pkg, String name, FieldTemplate[] fields)
           
 
Method Summary
 Fact createFact(long id)
          Method takes a list of Slots and creates a deffact from it.
 boolean equals(Object object)
           
 FieldTemplate[] getAllFieldTemplates()
          Return all the slots
 FieldTemplate getFieldTemplate(int index)
          get the Slot at the given pattern id
 FieldTemplate getFieldTemplate(String name)
          A convienance method for finding the slot matching the String name.
 int getFieldTemplateIndex(String name)
          Look up the pattern index of the slot
 String getName()
          the template name is an alias for an object
 int getNumberOfFields()
          Return the number of slots in the deftemplate
 Package getPackage()
           
 int hashCode()
           
 String toString()
          Method will return a string format with the int type code for the slot type
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FactTemplateImpl

public FactTemplateImpl(Package pkg,
                        String name,
                        FieldTemplate[] fields)
Method Detail

getPackage

public Package getPackage()
Specified by:
getPackage in interface FactTemplate

getName

public String getName()
the template name is an alias for an object

Specified by:
getName in interface FactTemplate
Parameters:
name -
Returns:

getNumberOfFields

public int getNumberOfFields()
Return the number of slots in the deftemplate

Specified by:
getNumberOfFields in interface FactTemplate
Returns:

getAllFieldTemplates

public FieldTemplate[] getAllFieldTemplates()
Return all the slots

Specified by:
getAllFieldTemplates in interface FactTemplate
Returns:

getFieldTemplate

public FieldTemplate getFieldTemplate(String name)
A convienance method for finding the slot matching the String name.

Specified by:
getFieldTemplate in interface FactTemplate
Parameters:
name -
Returns:

getFieldTemplate

public FieldTemplate getFieldTemplate(int index)
get the Slot at the given pattern id

Specified by:
getFieldTemplate in interface FactTemplate
Parameters:
id -
Returns:

getFieldTemplateIndex

public int getFieldTemplateIndex(String name)
Look up the pattern index of the slot

Specified by:
getFieldTemplateIndex in interface FactTemplate
Parameters:
name -
Returns:

createFact

public Fact createFact(long id)
Method takes a list of Slots and creates a deffact from it.

Specified by:
createFact in interface FactTemplate
Parameters:
data -
id -
Returns:

toString

public String toString()
Method will return a string format with the int type code for the slot type

Overrides:
toString in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object object)
Overrides:
equals in class Object


Copyright © 2001-2007 JBoss Inc.. All Rights Reserved.