edu.mit.sketch.system
Class TemplateIndex

java.lang.Object
  |
  +--edu.mit.sketch.system.TemplateIndex

public class TemplateIndex
extends Object

This class indexes Templates by the types of their slots. This allows us to find all the templates that need a particular item type very efficiently.

Created: Sun Jan 6 15:17:02 2002
Copyright: Copyright (C) 2001 by MIT. All rights reserved.


Constructor Summary
TemplateIndex()
           
 
Method Summary
 void addTemplate(Template t)
          Add mappings from each unfilled slot to the given template.
 Set getTemplates(BBItemType type)
          Get the templates that apply to the given item.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TemplateIndex

public TemplateIndex()
Method Detail

addTemplate

public void addTemplate(Template t)
Add mappings from each unfilled slot to the given template. The key used in the mapping is the slots type.

getTemplates

public Set getTemplates(BBItemType type)
Get the templates that apply to the given item. This includes all templates that require a supertype of the given item.
Parameters:
item - a BBItem
Returns:
a Set of Template objects that have slots of the same type as the given item.