1 /*
2  * reserved comment block
3  * DO NOT REMOVE OR ALTER!
4  */
5 /*
6  * Licensed to the Apache Software Foundation (ASF) under one or more
7  * contributor license agreements.  See the NOTICE file distributed with
8  * this work for additional information regarding copyright ownership.
9  * The ASF licenses this file to You under the Apache License, Version 2.0
10  * (the "License"); you may not use this file except in compliance with
11  * the License.  You may obtain a copy of the License at
12  *
13  *      http://www.apache.org/licenses/LICENSE-2.0
14  *
15  * Unless required by applicable law or agreed to in writing, software
16  * distributed under the License is distributed on an "AS IS" BASIS,
17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18  * See the License for the specific language governing permissions and
19  * limitations under the License.
20  */
21 
22 package com.sun.org.apache.xalan.internal.xsltc.dom;
23 
24 import java.text.Collator;
25 import java.util.Locale;
26 
27 import com.sun.org.apache.xalan.internal.xsltc.runtime.AbstractTranslet;
28 
29 /**
30  * Class for carrying settings that are to be used for a particular set
31  * of <code>xsl:sort</code> elements.
32  */
33 final class SortSettings {
34     /**
35      * A reference to the translet object for the transformation.
36      */
37     private AbstractTranslet _translet;
38 
39     /**
40      * The sort order (ascending or descending) for each level of
41      * <code>xsl:sort</code>
42      */
43     private int[] _sortOrders;
44 
45     /**
46      * The type of comparison (text or number) for each level of
47      * <code>xsl:sort</code>
48      */
49     private int[] _types;
50 
51     /**
52      * The Locale for each level of <code>xsl:sort</code>, based on any lang
53      * attribute or the default Locale.
54      */
55     private Locale[] _locales;
56 
57     /**
58      * The Collator object in effect for each level of <code>xsl:sort</code>
59      */
60     private Collator[] _collators;
61 
62     /**
63      * Case ordering for each level of <code>xsl:sort</code>.
64      */
65     private String[] _caseOrders;
66 
67     /**
68      * Create an instance of <code>SortSettings</code>.
69      * @param translet {@link com.sun.org.apache.xalan.internal.xsltc.runtime.AbstractTranslet}
70      *                 object for the transformation
71      * @param sortOrders an array specifying the sort order for each sort level
72      * @param types an array specifying the type of comparison for each sort
73      *              level (text or number)
74      * @param locales an array specifying the Locale for each sort level
75      * @param collators an array specifying the Collation in effect for each
76      *                  sort level
77      * @param caseOrders an array specifying whether upper-case, lower-case
78      *                   or neither is to take precedence for each sort level.
79      *                   The value of each element is equal to one of
80      *                   <code>"upper-first", "lower-first", or ""</code>.
81      */
SortSettings(AbstractTranslet translet, int[] sortOrders, int[] types, Locale[] locales, Collator[] collators, String[] caseOrders)82     SortSettings(AbstractTranslet translet, int[] sortOrders, int[] types,
83                  Locale[] locales, Collator[] collators, String[] caseOrders) {
84         _translet = translet;
85         _sortOrders = sortOrders;
86         _types = types;
87         _locales = locales;
88         _collators = collators;
89         _caseOrders = caseOrders;
90     }
91 
92     /**
93      * @return A reference to the translet object for the transformation.
94      */
getTranslet()95     AbstractTranslet getTranslet() {
96         return _translet;
97     }
98 
99     /**
100      * @return An array containing the sort order (ascending or descending)
101      *         for each level of <code>xsl:sort</code>
102      */
getSortOrders()103     int[] getSortOrders() {
104         return _sortOrders;
105     }
106 
107     /**
108      * @return An array containing the type of comparison (text or number)
109      *         to perform for each level of <code>xsl:sort</code>
110      */
getTypes()111     int[] getTypes() {
112         return _types;
113     }
114 
115     /**
116      * @return An array containing the Locale object in effect for each level
117      *         of <code>xsl:sort</code>
118      */
getLocales()119     Locale[] getLocales() {
120         return _locales;
121     }
122 
123     /**
124      * @return An array containing the Collator object in effect for each level
125      *         of <code>xsl:sort</code>
126      */
getCollators()127     Collator[] getCollators() {
128         return _collators;
129     }
130 
131     /**
132      * @return An array specifying the case ordering for each level of
133      *         <code>xsl:sort</code>.
134      */
getCaseOrders()135     String[] getCaseOrders() {
136         return _caseOrders;
137     }
138 }
139