001 /* 002 * Licensed to the Apache Software Foundation (ASF) under one 003 * or more contributor license agreements. See the NOTICE file 004 * distributed with this work for additional information 005 * regarding copyright ownership. The ASF licenses this file 006 * to you under the Apache License, Version 2.0 (the "License"); 007 * you may not use this file except in compliance with the License. 008 * You may obtain a copy of the License at 009 * 010 * http://www.apache.org/licenses/LICENSE-2.0 011 * 012 * Unless required by applicable law or agreed to in writing, software 013 * distributed under the License is distributed on an "AS IS" BASIS, 014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 015 * See the License for the specific language governing permissions and 016 * limitations under the License. 017 */ 018 /* 019 * $Id: SortSettings.java 468651 2006-10-28 07:04:25Z minchau $ 020 */ 021 022 package org.apache.xalan.xsltc.dom; 023 024 import java.text.Collator; 025 import java.util.Locale; 026 027 import org.apache.xalan.xsltc.runtime.AbstractTranslet; 028 029 /** 030 * Class for carrying settings that are to be used for a particular set 031 * of <code>xsl:sort</code> elements. 032 */ 033 final class SortSettings { 034 /** 035 * A reference to the translet object for the transformation. 036 */ 037 private AbstractTranslet _translet; 038 039 /** 040 * The sort order (ascending or descending) for each level of 041 * <code>xsl:sort</code> 042 */ 043 private int[] _sortOrders; 044 045 /** 046 * The type of comparison (text or number) for each level of 047 * <code>xsl:sort</code> 048 */ 049 private int[] _types; 050 051 /** 052 * The Locale for each level of <code>xsl:sort</code>, based on any lang 053 * attribute or the default Locale. 054 */ 055 private Locale[] _locales; 056 057 /** 058 * The Collator object in effect for each level of <code>xsl:sort</code> 059 */ 060 private Collator[] _collators; 061 062 /** 063 * Case ordering for each level of <code>xsl:sort</code>. 064 */ 065 private String[] _caseOrders; 066 067 /** 068 * Create an instance of <code>SortSettings</code>. 069 * @param translet {@link org.apache.xalan.xsltc.runtime.AbstractTranslet} 070 * object for the transformation 071 * @param sortOrders an array specifying the sort order for each sort level 072 * @param types an array specifying the type of comparison for each sort 073 * level (text or number) 074 * @param locales an array specifying the Locale for each sort level 075 * @param collators an array specifying the Collation in effect for each 076 * sort level 077 * @param caseOrders an array specifying whether upper-case, lower-case 078 * or neither is to take precedence for each sort level. 079 * The value of each element is equal to one of 080 * <code>"upper-first", "lower-first", or ""</code>. 081 */ 082 SortSettings(AbstractTranslet translet, int[] sortOrders, int[] types, 083 Locale[] locales, Collator[] collators, String[] caseOrders) { 084 _translet = translet; 085 _sortOrders = sortOrders; 086 _types = types; 087 _locales = locales; 088 _collators = collators; 089 _caseOrders = caseOrders; 090 } 091 092 /** 093 * @return A reference to the translet object for the transformation. 094 */ 095 AbstractTranslet getTranslet() { 096 return _translet; 097 } 098 099 /** 100 * @return An array containing the sort order (ascending or descending) 101 * for each level of <code>xsl:sort</code> 102 */ 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 */ 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 */ 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 */ 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 */ 135 String[] getCaseOrders() { 136 return _caseOrders; 137 } 138 }