001: /*
002: * Copyright 2005 Sun Microsystems, Inc. All Rights Reserved.
003: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
004: *
005: * This code is free software; you can redistribute it and/or modify it
006: * under the terms of the GNU General Public License version 2 only, as
007: * published by the Free Software Foundation. Sun designates this
008: * particular file as subject to the "Classpath" exception as provided
009: * by Sun in the LICENSE file that accompanied this code.
010: *
011: * This code is distributed in the hope that it will be useful, but WITHOUT
012: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
013: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
014: * version 2 for more details (a copy is included in the LICENSE file that
015: * accompanied this code).
016: *
017: * You should have received a copy of the GNU General Public License version
018: * 2 along with this work; if not, write to the Free Software Foundation,
019: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
020: *
021: * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
022: * CA 95054 USA or visit www.sun.com if you need additional information or
023: * have any questions.
024: *
025: * THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC.
026: */
027:
028: /*
029: * Copyright 2005 The Apache Software Foundation.
030: */
031:
032: package com.sun.xml.internal.stream.dtd.nonvalidating;
033:
034: /**
035: * @version $Id: XMLSimpleType.java,v 1.2 2005/11/03 17:16:39 jeffsuttor Exp $
036: */
037: public class XMLSimpleType {
038:
039: //
040: // Constants
041: //
042:
043: /** TYPE_CDATA */
044: public static final short TYPE_CDATA = 0;
045:
046: /** TYPE_ENTITY */
047: public static final short TYPE_ENTITY = 1;
048:
049: /** TYPE_ENUMERATION */
050: public static final short TYPE_ENUMERATION = 2;
051:
052: /** TYPE_ID */
053: public static final short TYPE_ID = 3;
054:
055: /** TYPE_IDREF */
056: public static final short TYPE_IDREF = 4;
057:
058: /** TYPE_NMTOKEN */
059: public static final short TYPE_NMTOKEN = 5;
060:
061: /** TYPE_NOTATION */
062: public static final short TYPE_NOTATION = 6;
063:
064: /** TYPE_NAMED */
065: public static final short TYPE_NAMED = 7;
066:
067: /** DEFAULT_TYPE_DEFAULT */
068: public static final short DEFAULT_TYPE_DEFAULT = 3;
069:
070: /** DEFAULT_TYPE_FIXED */
071: public static final short DEFAULT_TYPE_FIXED = 1;
072:
073: /** DEFAULT_TYPE_IMPLIED */
074: public static final short DEFAULT_TYPE_IMPLIED = 0;
075:
076: /** DEFAULT_TYPE_REQUIRED */
077: public static final short DEFAULT_TYPE_REQUIRED = 2;
078:
079: //
080: // Data
081: //
082:
083: /** type */
084: public short type;
085:
086: /** name */
087: public String name;
088:
089: /** enumeration */
090: public String[] enumeration;
091:
092: /** list */
093: public boolean list;
094:
095: /** defaultType */
096: public short defaultType;
097:
098: /** defaultValue */
099: public String defaultValue;
100:
101: /** non-normalized defaultValue */
102: public String nonNormalizedDefaultValue;
103:
104: //
105: // Methods
106: //
107:
108: /**
109: * setValues
110: *
111: * @param type
112: * @param name
113: * @param enumeration
114: * @param list
115: * @param defaultType
116: * @param defaultValue
117: * @param nonNormalizedDefaultValue
118: * @param datatypeValidator
119: */
120: public void setValues(short type, String name,
121: String[] enumeration, boolean list, short defaultType,
122: String defaultValue, String nonNormalizedDefaultValue) {
123:
124: this .type = type;
125: this .name = name;
126: // REVISIT: Should this be a copy? -Ac
127: if (enumeration != null && enumeration.length > 0) {
128: this .enumeration = new String[enumeration.length];
129: System.arraycopy(enumeration, 0, this .enumeration, 0,
130: this .enumeration.length);
131: } else {
132: this .enumeration = null;
133: }
134: this .list = list;
135: this .defaultType = defaultType;
136: this .defaultValue = defaultValue;
137: this .nonNormalizedDefaultValue = nonNormalizedDefaultValue;
138:
139: } // setValues(short,String,String[],boolean,short,String,String,DatatypeValidator)
140:
141: /** Set values. */
142: public void setValues(XMLSimpleType simpleType) {
143:
144: type = simpleType.type;
145: name = simpleType.name;
146: // REVISIT: Should this be a copy? -Ac
147: if (simpleType.enumeration != null
148: && simpleType.enumeration.length > 0) {
149: enumeration = new String[simpleType.enumeration.length];
150: System.arraycopy(simpleType.enumeration, 0, enumeration, 0,
151: enumeration.length);
152: } else {
153: enumeration = null;
154: }
155: list = simpleType.list;
156: defaultType = simpleType.defaultType;
157: defaultValue = simpleType.defaultValue;
158: nonNormalizedDefaultValue = simpleType.nonNormalizedDefaultValue;
159:
160: } // setValues(XMLSimpleType)
161:
162: /**
163: * clear
164: */
165: public void clear() {
166: this .type = -1;
167: this .name = null;
168: this .enumeration = null;
169: this .list = false;
170: this .defaultType = -1;
171: this .defaultValue = null;
172: this .nonNormalizedDefaultValue = null;
173: }
174:
175: } // class XMLSimpleType
|