1 /*
2  * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
3  */
4 /*
5  * Licensed to the Apache Software Foundation (ASF) under one or more
6  * contributor license agreements.  See the NOTICE file distributed with
7  * this work for additional information regarding copyright ownership.
8  * The ASF licenses this file to You under the Apache License, Version 2.0
9  * (the "License"); you may not use this file except in compliance with
10  * the License.  You may obtain a copy of the License at
11  *
12  *     http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  */
20 
21 package com.sun.xml.internal.stream.dtd.nonvalidating;
22 /**
23  */
24 public class XMLSimpleType {
25 
26     //
27     // Constants
28     //
29 
30     /** TYPE_CDATA */
31     public static final short TYPE_CDATA = 0;
32 
33     /** TYPE_ENTITY */
34     public static final short TYPE_ENTITY = 1;
35 
36     /** TYPE_ENUMERATION */
37     public static final short TYPE_ENUMERATION = 2;
38 
39     /** TYPE_ID */
40     public static final short TYPE_ID = 3;
41 
42     /** TYPE_IDREF */
43     public static final short TYPE_IDREF = 4;
44 
45     /** TYPE_NMTOKEN */
46     public static final short TYPE_NMTOKEN = 5;
47 
48     /** TYPE_NOTATION */
49     public static final short TYPE_NOTATION = 6;
50 
51     /** TYPE_NAMED */
52     public static final short TYPE_NAMED = 7;
53 
54     /** DEFAULT_TYPE_DEFAULT */
55     public static final short DEFAULT_TYPE_DEFAULT = 3;
56 
57     /** DEFAULT_TYPE_FIXED */
58     public static final short DEFAULT_TYPE_FIXED = 1;
59 
60     /** DEFAULT_TYPE_IMPLIED */
61     public static final short DEFAULT_TYPE_IMPLIED = 0;
62 
63     /** DEFAULT_TYPE_REQUIRED */
64     public static final short DEFAULT_TYPE_REQUIRED = 2;
65 
66     //
67     // Data
68     //
69 
70     /** type */
71     public short type;
72 
73     /** name */
74     public String name;
75 
76     /** enumeration */
77     public String[] enumeration;
78 
79     /** list */
80     public boolean list;
81 
82     /** defaultType */
83     public short defaultType;
84 
85     /** defaultValue */
86     public String defaultValue;
87 
88     /** non-normalized defaultValue */
89     public String nonNormalizedDefaultValue;
90 
91 
92     //
93     // Methods
94     //
95 
96     /**
97      * setValues
98      *
99      * @param type
100      * @param name
101      * @param enumeration
102      * @param list
103      * @param defaultType
104      * @param defaultValue
105      * @param nonNormalizedDefaultValue
106      * @param datatypeValidator
107      */
setValues(short type, String name, String[] enumeration, boolean list, short defaultType, String defaultValue, String nonNormalizedDefaultValue)108     public void setValues(short type, String name, String[] enumeration,
109     boolean list, short defaultType,
110     String defaultValue, String nonNormalizedDefaultValue){
111 
112         this.type              = type;
113         this.name              = name;
114         // REVISIT: Should this be a copy? -Ac
115         if (enumeration != null && enumeration.length > 0) {
116             this.enumeration = new String[enumeration.length];
117             System.arraycopy(enumeration, 0, this.enumeration, 0, this.enumeration.length);
118         }
119         else {
120             this.enumeration = null;
121         }
122         this.list              = list;
123         this.defaultType       = defaultType;
124         this.defaultValue      = defaultValue;
125         this.nonNormalizedDefaultValue      = nonNormalizedDefaultValue;
126 
127     } // setValues(short,String,String[],boolean,short,String,String,DatatypeValidator)
128 
129     /** Set values. */
setValues(XMLSimpleType simpleType)130     public void setValues(XMLSimpleType simpleType) {
131 
132         type = simpleType.type;
133         name = simpleType.name;
134         // REVISIT: Should this be a copy? -Ac
135         if (simpleType.enumeration != null && simpleType.enumeration.length > 0) {
136             enumeration = new String[simpleType.enumeration.length];
137             System.arraycopy(simpleType.enumeration, 0, enumeration, 0, enumeration.length);
138         }
139         else {
140             enumeration = null;
141         }
142         list = simpleType.list;
143         defaultType = simpleType.defaultType;
144         defaultValue = simpleType.defaultValue;
145         nonNormalizedDefaultValue = simpleType.nonNormalizedDefaultValue;
146 
147     } // setValues(XMLSimpleType)
148 
149     /**
150      * clear
151      */
clear()152     public void clear() {
153         this.type              = -1;
154         this.name              = null;
155         this.enumeration       = null;
156         this.list              = false;
157         this.defaultType       = -1;
158         this.defaultValue      = null;
159         this.nonNormalizedDefaultValue = null;
160     }
161 
162 } // class XMLSimpleType
163