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.attribute;
23 
24 import java.util.Map;
25 import java.util.Map.Entry;
26 import java.util.TreeMap;
27 
28 /** Container of attribute values of an opening tag.
29  */
30 public class AttributeValues
31 {
AttributeValues()32     AttributeValues ()
33     {
34         maRawAttributeValues = new TreeMap<>();
35         maProcessedAttributeValues = new TreeMap<>();
36     }
37 
38 
39 
40 
AddAttribute( final AttributeDescriptor aAttributeDescriptor, final String sRawValue, final Object aProcessedValue)41     public void AddAttribute (
42         final AttributeDescriptor aAttributeDescriptor,
43         final String sRawValue,
44         final Object aProcessedValue)
45     {
46         maRawAttributeValues.put(
47             aAttributeDescriptor.GetName(),
48             sRawValue);
49         maProcessedAttributeValues.put(
50             aAttributeDescriptor.GetName(),
51             aProcessedValue);
52     }
53 
54 
55 
56 
GetAttributes()57     public Iterable<Entry<String,String>> GetAttributes ()
58     {
59         return maRawAttributeValues.entrySet();
60     }
61 
62 
63 
64 
GetRawAttributeValue(final String sName)65     public String GetRawAttributeValue (final String sName)
66     {
67         return maRawAttributeValues.get(sName);
68     }
69 
70 
71 
72 
GetProcessedAttributeValue(final String sName)73     public Object GetProcessedAttributeValue (final String sName)
74     {
75         return maProcessedAttributeValues.get(sName);
76     }
77 
78 
79 
80 
GetAttributeCount()81     public int GetAttributeCount ()
82     {
83         return maRawAttributeValues.size();
84     }
85 
86 
87 
88 
89     private Map<String,String> maRawAttributeValues;
90     private Map<String,Object> maProcessedAttributeValues;
91 }
92