xylia.sax.contentmodelparser
Class DefaultContentModel

java.lang.Object
  |
  +--xylia.sax.contentmodelparser.DefaultContentModel
All Implemented Interfaces:
ContentModelKinds

public class DefaultContentModel
extends java.lang.Object
implements ContentModelKinds

A content model able to check validity of a sequence of children. Title: Xylia Description: Copyright: Copyright (c) 2001 Company: Memorial

Version:
1.0
Author:
Theodore Norvell, Dennis Peters and others.

Fields inherited from interface xylia.sax.contentmodelparser.ContentModelKinds
ANY, CHILDREN, EMPTY, MIXED
 
Constructor Summary
DefaultContentModel(int kind)
          Construct an ANY or EMPTY content model.
DefaultContentModel(int kind, RegExp re)
          Construct a CHILDREN or MIXED content model
 
Method Summary
 FiniteStateAutomaton getFSA()
          Return a finite state automaton for the content model
 int getKind()
          Returns one of EMPTY, ANY, CHILDREN, or MIXED.
 RegExp getRegExp()
          Return a regular expression for the content model.
 boolean match(java.util.List content)
          Determine whether a sequence of content elements is matched by the automaton.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultContentModel

public DefaultContentModel(int kind)
Construct an ANY or EMPTY content model.

DefaultContentModel

public DefaultContentModel(int kind,
                           RegExp re)
Construct a CHILDREN or MIXED content model
Method Detail

getKind

public int getKind()
Returns one of EMPTY, ANY, CHILDREN, or MIXED.

getRegExp

public RegExp getRegExp()
Return a regular expression for the content model.

Precondition: kind must be CHILREN or MIXED.


getFSA

public FiniteStateAutomaton getFSA()
Return a finite state automaton for the content model

Precondition: kind must be CHILREN or MIXED.

The alphabet of the automaton is the element names (Strings) and the String "#PCDATA"

Note that if the content model is (#PCDATA) then it is first converted to (#PCDATA)*, so the automaton will match any number of "#PCDATA".


match

public boolean match(java.util.List content)
Determine whether a sequence of content elements is matched by the automaton.
Parameters:
content. - A List of Strings. The Strings can be element names or "#PCDATA".