Building Parsers with Java

sjm.examples.query
Class ChipSource

java.lang.Object
  |
  +--sjm.examples.query.ChipSource

public class ChipSource
extends java.lang.Object
implements AxiomSource

This class draws on data from the class ChipBase in sjm.examples.chips, to supplies facts about chips, customers, and orders.


Field Summary
protected static java.util.Dictionary queries
           
static ChipSpeller speller
           
 
Constructor Summary
ChipSource()
           
 
Method Summary
 AxiomEnumeration axioms()
          Returns all the data in the chip database.
 AxiomEnumeration axioms(Structure s)
          Returns all the data in the chip database.
static Fact fact(Chip c)
          Create a chip fact from a chip object.
static Fact fact(Customer c)
          Create a customer fact from a customer object.
static Fact fact(Order o)
          Create an order fact from an order object.
static Program program()
          Returns all the data in the chip database.
static java.util.Dictionary queries()
           
static Structure queryChip()
           
static Structure queryCustomer()
           
static Structure queryOrder()
           
static Structure queryStructure(java.lang.String className)
          Given the name of a class, return a query that will match against facts that represent objects of the class.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

queries

protected static java.util.Dictionary queries

speller

public static ChipSpeller speller
Constructor Detail

ChipSource

public ChipSource()
Method Detail

axioms

public AxiomEnumeration axioms()
Returns all the data in the chip database.
Specified by:
axioms in interface AxiomSource
Returns:
all the data in the chip database.

axioms

public AxiomEnumeration axioms(Structure s)
Returns all the data in the chip database. If there were thousands of chip facts, this method could use the querying structure to limit the number of facts it returns.
Specified by:
axioms in interface AxiomSource
Returns:
all the data in the chip database.

fact

public static Fact fact(Chip c)
Create a chip fact from a chip object.
Returns:
a chip fact, given a chip object.

fact

public static Fact fact(Customer c)
Create a customer fact from a customer object.
Returns:
a customer fact, given a customer object

fact

public static Fact fact(Order o)
Create an order fact from an order object.
Returns:
an order fact, given an order object

program

public static Program program()
Returns all the data in the chip database.
Returns:
all the data in the chip database.

queries

public static java.util.Dictionary queries()

queryChip

public static Structure queryChip()

queryCustomer

public static Structure queryCustomer()

queryOrder

public static Structure queryOrder()

queryStructure

public static Structure queryStructure(java.lang.String className)
Given the name of a class, return a query that will match against facts that represent objects of the class.
Parameters:
className - the class name (from the chip object model) for which to return a query
Returns:
a query structure
Throws:
UnrecognizedClassException - if the class name is not part of the chip object model

by Steve Metsker