KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ant > internal > ui > dtd > IDfm


1 /*******************************************************************************
2  * Copyright (c) 2002, 2005 Object Factory Inc.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * Object Factory Inc. - Initial implementation
10  *******************************************************************************/

11 package org.eclipse.ant.internal.ui.dtd;
12
13 /**
14  * A Dfm is an IModel converted to a form more appropriate for
15  * validation. The whole point of a Dfm is to run fast.
16  * @author Bob Foster
17  */

18 public interface IDfm {
19
20     /**
21      * Return true if no further symbols are required.
22      */

23     boolean isAccepting();
24     
25     /**
26      * If the symbol represented by name is acceptable,
27      * return the dfm to apply to the next (child) symbol.
28      * Otherwise, return null.
29      */

30     IDfm advance(String JavaDoc name);
31     
32     /**
33      * If the symbol represented by the namespace,name pair is acceptable,
34      * return the dfm to apply to the next (child) symbol. Otherwise, return
35      * null.
36      */

37     IDfm advance(String JavaDoc namespace, String JavaDoc localname);
38     
39     /**
40      * If the symbol represented by name is acceptable
41      * to <code>advance()</code>
42      * return the corresponding atom.
43      * Otherwise, return null.
44      */

45     IAtom getAtom(String JavaDoc name);
46     
47     /**
48      * Return the symbols for which <code>advance()</code>
49      * will return a next dfm. If no symbols will
50      * advance this dfm or if any symbol will, returns
51      * an empty array. Use <code>isAny()</code> and
52      * <code>isEmpty()</code> to disambiguate the
53      * cases.
54      */

55     String JavaDoc[] getAccepts();
56     
57     /**
58      * Return the symbols for which <code>advance()</code>
59      * will return a next dfm. If no symbols will
60      * advance this dfm or if any symbol will, returns
61      * null. Use <code>isAny()</code> and
62      * <code>isEmpty()</code> to disambiguate the
63      * cases.
64      */

65     Object JavaDoc[] getKeys();
66     
67     /**
68      * Return true if dfm will accept any symbol
69      * and return itself; false otherwise.
70      * This interface keeps the dfm from needing
71      * schema knowledge, but a better way to
72      * process an ANY dfm for elements is use the
73      * schema to look up the element and use its
74      * dfm instead of this one.
75      */

76     boolean isAny();
77     
78     /**
79      * Return true if dfm will reject every symbol
80      * (<code>advance()</code> returns null);
81      * false otherwise. Included for completeness,
82      * so every element can have a dfm, regardless
83      * of its type.
84      */

85     boolean isEmpty();
86 }
87
Popular Tags