KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > apache > xerces > validators > common > InsertableElementsInfo


1 /*
2  * The Apache Software License, Version 1.1
3  *
4  *
5  * Copyright (c) 1999 The Apache Software Foundation. All rights
6  * reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  *
12  * 1. Redistributions of source code must retain the above copyright
13  * notice, this list of conditions and the following disclaimer.
14  *
15  * 2. Redistributions in binary form must reproduce the above copyright
16  * notice, this list of conditions and the following disclaimer in
17  * the documentation and/or other materials provided with the
18  * distribution.
19  *
20  * 3. The end-user documentation included with the redistribution,
21  * if any, must include the following acknowledgment:
22  * "This product includes software developed by the
23  * Apache Software Foundation (http://www.apache.org/)."
24  * Alternately, this acknowledgment may appear in the software itself,
25  * if and wherever such third-party acknowledgments normally appear.
26  *
27  * 4. The names "Xerces" and "Apache Software Foundation" must
28  * not be used to endorse or promote products derived from this
29  * software without prior written permission. For written
30  * permission, please contact apache@apache.org.
31  *
32  * 5. Products derived from this software may not be called "Apache",
33  * nor may "Apache" appear in their name, without prior written
34  * permission of the Apache Software Foundation.
35  *
36  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
37  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
38  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
39  * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
40  * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
41  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
42  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
43  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
44  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
45  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
46  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
47  * SUCH DAMAGE.
48  * ====================================================================
49  *
50  * This software consists of voluntary contributions made by many
51  * individuals on behalf of the Apache Software Foundation and was
52  * originally based on software copyright (c) 1999, International
53  * Business Machines, Inc., http://www.apache.org. For more
54  * information on the Apache Software Foundation, please see
55  * <http://www.apache.org/>.
56  */

57
58 package org.enhydra.apache.xerces.validators.common;
59
60 import org.enhydra.apache.xerces.utils.QName;
61
62 /**
63  * ---------------------------------------------------------------------------
64  * InsertableElementsInfo is a simple 'data packet' class that is used to
65  * get information into and out of the validator APIs that allow you to ask
66  * what kind of elements can be inserted into a particular place in an
67  * element's content model.
68  *
69  * The parent element is not explicitly stored here, since it is a separate
70  * parameter to the methods that do the query.
71  *
72  * Since it exists purely to exchange data, it just uses simple public
73  * data members.
74  * ---------------------------------------------------------------------------
75  * InsertableElementsInfo is a simple 'data packet' class that is used to
76  * get information into and out of the validator APIs that allow you to ask
77  * what kind of elements can be inserted into a particular place in an
78  * element's content model.
79  * <p>
80  * The parent element is not explicitly stored here, since it is a separate
81  * parameter to the methods that do the query.
82  * <p>
83  * Since it exists purely to exchange data, it just uses simple public
84  * data members.
85  *
86  * @version $Id: InsertableElementsInfo.java,v 1.1.1.1 2003/03/10 16:34:44 taweili Exp $
87  */

88 public class InsertableElementsInfo
89 {
90     /**
91      * One of the things that could be inserted here is a PCDATA node,
92      * in addition to the element type nodes reported.
93      */

94     public boolean canHoldPCData;
95
96     /**
97      * The count of elements in the curChildren array. The array can be
98      * larger than this (for reuse purposes), so this value indicates
99      * how many elements are valid.
100      * <p>
101      * Note that, since the curChildren array must have an empty slot at
102      * the insertion index, this value can never be zero.
103      * <p>
104      * Note also that this value can be changed during processing, though
105      * its value on return is meaningless to the caller.
106      */

107     public int childCount;
108     
109     /**
110      * The current list of children of the parent element. This may or
111      * may not be the <em>real</em> list of children, since the caller can lie
112      * but that's of no concern to the validator. These query APIs are
113      * intended to be for 'what if' kind of work, so any list of children
114      * could be passed in.
115      * <p>
116      * There must be an empy slot in the array at the requested insertion
117      * point. That slot does not have to have any particular value, but
118      * it will be used by the validator to do brute force validation in
119      * some cases when a 'fully valid' check is done for valid insertable
120      * elements.
121      * <p>
122      * Note that this array can be modified by the call, so do not expect
123      * its contents to remain the same as on input.
124      */

125     public QName curChildren[];
126
127     /**
128      * Indicates that one of the valid things after the insert point is
129      * 'end of content', which means that the element being inserted
130      * after can legally be the last element.
131      */

132     public boolean isValidEOC;
133     
134     /**
135      * The insertion point. The question is 'what can go here' and this
136      * indicates where 'where' is. It is an offset into curChildren.
137      */

138     public int insertAt;
139     
140     /**
141      * This array is filled with flags that indicate what the possible
142      * insertable elements are (i.e. the list of unique elements that
143      * could possibly be inserted somewhere in this type of element.)
144      * Effectively this is the list of unique children in the content
145      * model of the parent element.
146      * <p>
147      * If this array is not big enough to hold the results, or is null,
148      * then it will be replaced with a new array of the correct size.
149      */

150     public QName possibleChildren[];
151     
152     /**
153      * The number of elements that are valid in the possibleChildren
154      * and resultsCount arrays. They can be larger than that, so there
155      * must be a way to indicate how many elements are filled in with
156      * value results. If they were not at least this large on input,
157      * then they will be reallocated up to this size.
158      */

159     public int resultsCount;
160     
161     /**
162      * This array must be at least as large as possibleChildren since
163      * a flag is set in the same indexes in this array to indicate that
164      * the possible child at that index in possibleChildren can be
165      * inserted at the requested insertion point.
166      * <p>
167      * If this array is not big enough to hold the results, or is null,
168      * then it will be replaced with a new array of the correct size.
169      */

170     public boolean results[];
171     
172 } // class InsertableElementsInfo
173
Popular Tags