1 /**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements.  See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership.  The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License.  You may obtain a copy of the License at
10 *
11 *   http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied.  See the License for the
17 * specific language governing permissions and limitations
18 * under the License.
19 *
20 *************************************************************/
21 
22 package org.apache.openoffice.ooxml.parser;
23 
24 import java.util.HashSet;
25 import java.util.Set;
26 
27 /** Table of all skip states.
28  *
29  *  A skip state corresponds to the 'any' element in the schemas.
30  *  It means that the content of the element is specified by an extension of the
31  *  schema which may or may not be known at parse time.
32  *  At the moment the whole element is skipped, i.e. ignored.
33  *
34  */
35 public class SkipStateTable
36 {
SkipStateTable(final Iterable<String[]> aData)37     public SkipStateTable (final Iterable<String[]> aData)
38     {
39         maSkipStates = new HashSet<>();
40 
41         for (final String[] aLine : aData)
42         {
43             // Create new transition.
44             final int nStateId = Integer.parseInt(aLine[1]);
45 
46             maSkipStates.add(nStateId);
47         }
48     }
49 
50 
51 
52 
Contains(final int nStateId)53     public boolean Contains (final int nStateId)
54     {
55         return maSkipStates.contains(nStateId);
56     }
57 
58 
59 
60 
GetSkipStateCount()61     public int GetSkipStateCount ()
62     {
63         return maSkipStates.size();
64     }
65 
66 
67 
68 
69     private final Set<Integer> maSkipStates;
70 }
71