1 /*
   2  * reserved comment block
   3  * DO NOT REMOVE OR ALTER!
   4  */
   5 /*
   6  * Copyright 2001-2004 The Apache Software Foundation.
   7  *
   8  * Licensed under the Apache License, Version 2.0 (the "License");
   9  * you may not use this file except in compliance with the License.
  10  * 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  * $Id: SortSettings.java,v 1.2.4.1 2005/09/06 10:19:22 pvedula Exp $
  22  */
  23 
  24 package com.sun.org.apache.xalan.internal.xsltc.dom;
  25 
  26 import java.text.Collator;
  27 import java.util.Locale;
  28 
  29 import com.sun.org.apache.xalan.internal.xsltc.runtime.AbstractTranslet;
  30 
  31 /**
  32  * Class for carrying settings that are to be used for a particular set
  33  * of <code>xsl:sort</code> elements.
  34  */
  35 final class SortSettings {
  36     /**
  37      * A reference to the translet object for the transformation.
  38      */
  39     private AbstractTranslet _translet;
  40 
  41     /**
  42      * The sort order (ascending or descending) for each level of
  43      * <code>xsl:sort</code>
  44      */
  45     private int[] _sortOrders;
  46 
  47     /**
  48      * The type of comparison (text or number) for each level of
  49      * <code>xsl:sort</code>
  50      */
  51     private int[] _types;
  52 
  53     /**
  54      * The Locale for each level of <code>xsl:sort</code>, based on any lang
  55      * attribute or the default Locale.
  56      */
  57     private Locale[] _locales;
  58 
  59     /**
  60      * The Collator object in effect for each level of <code>xsl:sort</code>
  61      */
  62     private Collator[] _collators;
  63 
  64     /**
  65      * Case ordering for each level of <code>xsl:sort</code>.
  66      */
  67     private String[] _caseOrders;
  68 
  69     /**
  70      * Create an instance of <code>SortSettings</code>.
  71      * @param translet {@link com.sun.org.apache.xalan.internal.xsltc.runtime.AbstractTranslet}
  72      *                 object for the transformation
  73      * @param sortOrders an array specifying the sort order for each sort level
  74      * @param types an array specifying the type of comparison for each sort
  75      *              level (text or number)
  76      * @param locales an array specifying the Locale for each sort level
  77      * @param collators an array specifying the Collation in effect for each
  78      *                  sort level
  79      * @param caseOrders an array specifying whether upper-case, lower-case
  80      *                   or neither is to take precedence for each sort level.
  81      *                   The value of each element is equal to one of
  82      *                   <code>"upper-first", "lower-first", or ""</code>.
  83      */
  84     SortSettings(AbstractTranslet translet, int[] sortOrders, int[] types,
  85                  Locale[] locales, Collator[] collators, String[] caseOrders) {
  86         _translet = translet;
  87         _sortOrders = sortOrders;
  88         _types = types;
  89         _locales = locales;
  90         _collators = collators;
  91         _caseOrders = caseOrders;
  92     }
  93 
  94     /**
  95      * @return A reference to the translet object for the transformation.
  96      */
  97     AbstractTranslet getTranslet() {
  98         return _translet;
  99     }
 100 
 101     /**
 102      * @return An array containing the sort order (ascending or descending)
 103      *         for each level of <code>xsl:sort</code>
 104      */
 105     int[] getSortOrders() {
 106         return _sortOrders;
 107     }
 108 
 109     /**
 110      * @return An array containing the type of comparison (text or number)
 111      *         to perform for each level of <code>xsl:sort</code>
 112      */
 113     int[] getTypes() {
 114         return _types;
 115     }
 116 
 117     /**
 118      * @return An array containing the Locale object in effect for each level
 119      *         of <code>xsl:sort</code>
 120      */
 121     Locale[] getLocales() {
 122         return _locales;
 123     }
 124 
 125     /**
 126      * @return An array containing the Collator object in effect for each level
 127      *         of <code>xsl:sort</code>
 128      */
 129     Collator[] getCollators() {
 130         return _collators;
 131     }
 132 
 133     /**
 134      * @return An array specifying the case ordering for each level of
 135      *         <code>xsl:sort</code>.
 136      */
 137     String[] getCaseOrders() {
 138         return _caseOrders;
 139     }
 140 }