## org.opencyc.templateparser
Class TemplateFactory

    java.lang.Object
      |
      +--org.opencyc.templateparser.TemplateFactory

public class TemplateFactory
extends java.lang.Object

Makes templates which are used by the TemplateParser to parser user input.

All methods are static.

Author:
  Stephen L. Reed

  Copyright 2001 Cycorp, Inc., license is open source GNU LGPL.

  the license

  www.opencyc.org

  OpenCyc at SourceForge

  THIS SOFTWARE AND KNOWLEDGE BASE CONTENT ARE PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OPENCYC ORGANIZATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE AND KNOWLEDGE BASE CONTENT, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Field Summary
`protected static java.util.HashMap` `templateCache` Caches template objects to keep from making them twice.

Constructor Summary
`TemplateFactory()`

Method Summary
`static Template` `getTemplate(CycList templateElements)` Returns a Template object from the cache given the template elements.
`static java.util.Collection` `getTemplates()` Returns the templates.
`static void` `makeAllTemplates()` Makes all templates.
`static Template` `makeChoiceIsNumberTemplate(java.lang.Integer positiveInteger, CycFort term)` Make the choiceIsNumber template.
`static Template` `makeChoiceIsPhraseTemplate(java.lang.String phrase, CycFort term)` Make the choiceIsPhrase template.
`static Template` `makeDisambiguateTermQueryTemplate()` Make the term query template
`static Template` `makeDoneTemplate()` Make the done template
`static Template` `makeMoreTemplate()` Make the more template
`static Template` `makeQuitTemplate()` Make the quit template
`static Template` `makeTemplate(CycFort mt, CycList templateElements, Performative performative)` Makes a new Template object given the template elements and performative.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### templateCache

    protected static java.util.HashMap templateCache

  Caches template objects to keep from making them twice. templateExpression --> Template

Constructor Detail

### TemplateFactory

    public TemplateFactory()

Method Detail

### getTemplates

    public static java.util.Collection getTemplates()

  Returns the templates.
  Returns:
    the templates

### makeTemplate

    public static Template makeTemplate(CycFort mt,
                                        CycList templateElements,
                                        Performative performative)

  Makes a new Template object given the template elements and performative.
  Parameters:
    `mt` - the microtheory in which this template applies
    `templateElements` - the template elements
    `performative` - the performative

### getTemplate

    public static Template getTemplate(CycList templateElements)

  Returns a Template object from the cache given the template elements.
  Parameters:
    `templateElements` - the template elements

### makeAllTemplates

    public static void makeAllTemplates()

  Makes all templates.

### makeQuitTemplate

    public static Template makeQuitTemplate()

  Make the quit template

### makeMoreTemplate

    public static Template makeMoreTemplate()

  Make the more template

### makeDoneTemplate

    public static Template makeDoneTemplate()

  Make the done template

### makeDisambiguateTermQueryTemplate

    public static Template makeDisambiguateTermQueryTemplate()

  Make the term query template

### makeChoiceIsNumberTemplate

    public static Template makeChoiceIsNumberTemplate(java.lang.Integer positiveInteger,
                                                      CycFort term)

  Make the choiceIsNumber template. Not cached because the performative may vary for otherwise identical integer templates.
  Parameters:
    `number` - the integer to parse
    `term` - the term that corresponds to the given integer
  Returns:
    the template that matches the given positive integer

### makeChoiceIsPhraseTemplate

    public static Template makeChoiceIsPhraseTemplate(java.lang.String phrase,
                                                      CycFort term)

  Make the choiceIsPhrase template. Not cached because the performative may vary for otherwise identical phrase templates.
  Parameters:
    `number` - the phrase to parse
    `term` - the term that corresponds to the given phrase
  Returns:
    the template that matches the given phrase