001    /*
002     * Copyright 2009 - 2009 JEuclid, http://jeuclid.sf.net
003     * 
004     * Licensed under the Apache License, Version 2.0 (the "License");
005     * you may not use this file except in compliance with the License.
006     * You may obtain a copy of the License at
007     *
008     *      http://www.apache.org/licenses/LICENSE-2.0
009     *
010     * Unless required by applicable law or agreed to in writing, software
011     * distributed under the License is distributed on an "AS IS" BASIS,
012     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013     * See the License for the specific language governing permissions and
014     * limitations under the License.
015     */
016    
017    /* $Id: StretchOverride.java,v c75d8b379394 2009/09/25 20:03:08 max $ */
018    
019    package net.sourceforge.jeuclid.elements.support.operatordict;
020    
021    import java.util.HashMap;
022    import java.util.Map;
023    
024    import net.sourceforge.jeuclid.elements.presentation.token.Mo;
025    
026    /**
027     * Contains information on characters which stretch vertical / horizontal only.
028     * 
029     * @version $Revision: c75d8b379394 $
030     */
031    public final class StretchOverride {
032        private static final Map<String, String> STRETCHATTR = new HashMap<String, String>();
033    
034        private StretchOverride() {
035            // nothing to do.
036        }
037    
038        /**
039         * Returns {@link Mo#VALUE_STRETCHY_HORIZONTAL} or
040         * {@link Mo#VALUE_STRETCHY_VERTICAL} if the character is to be stretch only
041         * in that direction.
042         * 
043         * @param operator
044         *            operator to check
045         * @return a String or null if not known.
046         */
047        public static String getStretchOverride(final String operator) {
048            return StretchOverride.STRETCHATTR.get(operator);
049        }
050    
051        // CHECKSTYLE:OFF
052        // Method is too long... I know.
053        static {
054            // CHECKSTYLE:ON
055            StretchOverride.STRETCHATTR.put("\ufe36", Mo.VALUE_STRETCHY_HORIZONTAL);
056            StretchOverride.STRETCHATTR.put("\ufe37", Mo.VALUE_STRETCHY_HORIZONTAL);
057            StretchOverride.STRETCHATTR.put("\ufe35", Mo.VALUE_STRETCHY_HORIZONTAL);
058            StretchOverride.STRETCHATTR.put("\u0029", Mo.VALUE_STRETCHY_VERTICAL);
059            StretchOverride.STRETCHATTR.put("\ufe38", Mo.VALUE_STRETCHY_HORIZONTAL);
060            StretchOverride.STRETCHATTR.put("\u0028", Mo.VALUE_STRETCHY_VERTICAL);
061            StretchOverride.STRETCHATTR.put("\u222c", Mo.VALUE_STRETCHY_VERTICAL);
062            StretchOverride.STRETCHATTR.put("\u222d", Mo.VALUE_STRETCHY_VERTICAL);
063            StretchOverride.STRETCHATTR.put("\u222e", Mo.VALUE_STRETCHY_VERTICAL);
064            StretchOverride.STRETCHATTR.put("\u222f", Mo.VALUE_STRETCHY_VERTICAL);
065            StretchOverride.STRETCHATTR.put("\u222b", Mo.VALUE_STRETCHY_VERTICAL);
066            StretchOverride.STRETCHATTR.put("\u2230", Mo.VALUE_STRETCHY_VERTICAL);
067            StretchOverride.STRETCHATTR.put("\u2233", Mo.VALUE_STRETCHY_VERTICAL);
068            StretchOverride.STRETCHATTR.put("\u2232", Mo.VALUE_STRETCHY_VERTICAL);
069            StretchOverride.STRETCHATTR.put("\u005e", Mo.VALUE_STRETCHY_HORIZONTAL);
070            StretchOverride.STRETCHATTR.put("\u005d", Mo.VALUE_STRETCHY_VERTICAL);
071            StretchOverride.STRETCHATTR.put("\u005b", Mo.VALUE_STRETCHY_VERTICAL);
072            StretchOverride.STRETCHATTR.put("\u007d", Mo.VALUE_STRETCHY_VERTICAL);
073            StretchOverride.STRETCHATTR.put("\u007c", Mo.VALUE_STRETCHY_VERTICAL);
074            StretchOverride.STRETCHATTR.put("\u007b", Mo.VALUE_STRETCHY_VERTICAL);
075            StretchOverride.STRETCHATTR.put("\u00af", Mo.VALUE_STRETCHY_HORIZONTAL);
076            StretchOverride.STRETCHATTR.put("\u02c7", Mo.VALUE_STRETCHY_HORIZONTAL);
077            StretchOverride.STRETCHATTR.put("\u02dc", Mo.VALUE_STRETCHY_HORIZONTAL);
078            StretchOverride.STRETCHATTR.put("\u0332", Mo.VALUE_STRETCHY_HORIZONTAL);
079            StretchOverride.STRETCHATTR.put("\u2500", Mo.VALUE_STRETCHY_HORIZONTAL);
080            StretchOverride.STRETCHATTR.put("\u2502", Mo.VALUE_STRETCHY_VERTICAL);
081            StretchOverride.STRETCHATTR.put("\u232a", Mo.VALUE_STRETCHY_VERTICAL);
082            StretchOverride.STRETCHATTR.put("\u2329", Mo.VALUE_STRETCHY_VERTICAL);
083            StretchOverride.STRETCHATTR.put("\u2758", Mo.VALUE_STRETCHY_VERTICAL);
084            StretchOverride.STRETCHATTR.put("\u007c\u007c",
085                    Mo.VALUE_STRETCHY_VERTICAL);
086            StretchOverride.STRETCHATTR.put("\u301a", Mo.VALUE_STRETCHY_VERTICAL);
087            StretchOverride.STRETCHATTR.put("\u301b", Mo.VALUE_STRETCHY_VERTICAL);
088            StretchOverride.STRETCHATTR.put("\u2308", Mo.VALUE_STRETCHY_VERTICAL);
089            StretchOverride.STRETCHATTR.put("\u230b", Mo.VALUE_STRETCHY_VERTICAL);
090            StretchOverride.STRETCHATTR.put("\u230a", Mo.VALUE_STRETCHY_VERTICAL);
091            StretchOverride.STRETCHATTR.put("\u2309", Mo.VALUE_STRETCHY_VERTICAL);
092            StretchOverride.STRETCHATTR.put("\u294e", Mo.VALUE_STRETCHY_HORIZONTAL);
093            StretchOverride.STRETCHATTR.put("\u21d5", Mo.VALUE_STRETCHY_VERTICAL);
094            StretchOverride.STRETCHATTR.put("\u21d4", Mo.VALUE_STRETCHY_HORIZONTAL);
095            StretchOverride.STRETCHATTR.put("\u294f", Mo.VALUE_STRETCHY_VERTICAL);
096            StretchOverride.STRETCHATTR.put("\u21d1", Mo.VALUE_STRETCHY_VERTICAL);
097            StretchOverride.STRETCHATTR.put("\u21d0", Mo.VALUE_STRETCHY_HORIZONTAL);
098            StretchOverride.STRETCHATTR.put("\u21d3", Mo.VALUE_STRETCHY_VERTICAL);
099            StretchOverride.STRETCHATTR.put("\u21d2", Mo.VALUE_STRETCHY_HORIZONTAL);
100            StretchOverride.STRETCHATTR.put("\u2954", Mo.VALUE_STRETCHY_VERTICAL);
101            StretchOverride.STRETCHATTR.put("\u21cc", Mo.VALUE_STRETCHY_HORIZONTAL);
102            StretchOverride.STRETCHATTR.put("\u2955", Mo.VALUE_STRETCHY_VERTICAL);
103            StretchOverride.STRETCHATTR.put("\u2956", Mo.VALUE_STRETCHY_HORIZONTAL);
104            StretchOverride.STRETCHATTR.put("\u2957", Mo.VALUE_STRETCHY_HORIZONTAL);
105            StretchOverride.STRETCHATTR.put("\u2950", Mo.VALUE_STRETCHY_HORIZONTAL);
106            StretchOverride.STRETCHATTR.put("\u2951", Mo.VALUE_STRETCHY_VERTICAL);
107            StretchOverride.STRETCHATTR.put("\u2952", Mo.VALUE_STRETCHY_HORIZONTAL);
108            StretchOverride.STRETCHATTR.put("\u2953", Mo.VALUE_STRETCHY_HORIZONTAL);
109            StretchOverride.STRETCHATTR.put("\u21cb", Mo.VALUE_STRETCHY_HORIZONTAL);
110            StretchOverride.STRETCHATTR.put("\u295c", Mo.VALUE_STRETCHY_VERTICAL);
111            StretchOverride.STRETCHATTR.put("\u21c4", Mo.VALUE_STRETCHY_HORIZONTAL);
112            StretchOverride.STRETCHATTR.put("\u21c5", Mo.VALUE_STRETCHY_VERTICAL);
113            StretchOverride.STRETCHATTR.put("\u295d", Mo.VALUE_STRETCHY_VERTICAL);
114            StretchOverride.STRETCHATTR.put("\u21c6", Mo.VALUE_STRETCHY_HORIZONTAL);
115            StretchOverride.STRETCHATTR.put("\u295e", Mo.VALUE_STRETCHY_HORIZONTAL);
116            StretchOverride.STRETCHATTR.put("\u295f", Mo.VALUE_STRETCHY_HORIZONTAL);
117            StretchOverride.STRETCHATTR.put("\u2958", Mo.VALUE_STRETCHY_VERTICAL);
118            StretchOverride.STRETCHATTR.put("\u21c0", Mo.VALUE_STRETCHY_HORIZONTAL);
119            StretchOverride.STRETCHATTR.put("\u2959", Mo.VALUE_STRETCHY_VERTICAL);
120            StretchOverride.STRETCHATTR.put("\u21c1", Mo.VALUE_STRETCHY_HORIZONTAL);
121            StretchOverride.STRETCHATTR.put("\u21c2", Mo.VALUE_STRETCHY_VERTICAL);
122            StretchOverride.STRETCHATTR.put("\u295a", Mo.VALUE_STRETCHY_HORIZONTAL);
123            StretchOverride.STRETCHATTR.put("\u21c3", Mo.VALUE_STRETCHY_VERTICAL);
124            StretchOverride.STRETCHATTR.put("\u295b", Mo.VALUE_STRETCHY_HORIZONTAL);
125            StretchOverride.STRETCHATTR.put("\u2961", Mo.VALUE_STRETCHY_VERTICAL);
126            StretchOverride.STRETCHATTR.put("\u2960", Mo.VALUE_STRETCHY_VERTICAL);
127            StretchOverride.STRETCHATTR.put("\u296f", Mo.VALUE_STRETCHY_VERTICAL);
128            StretchOverride.STRETCHATTR.put("\u296e", Mo.VALUE_STRETCHY_VERTICAL);
129            StretchOverride.STRETCHATTR.put("\u21f5", Mo.VALUE_STRETCHY_VERTICAL);
130            StretchOverride.STRETCHATTR.put("\u21e4", Mo.VALUE_STRETCHY_HORIZONTAL);
131            StretchOverride.STRETCHATTR.put("\u21e5", Mo.VALUE_STRETCHY_HORIZONTAL);
132            StretchOverride.STRETCHATTR.put("\u27f7", Mo.VALUE_STRETCHY_HORIZONTAL);
133            StretchOverride.STRETCHATTR.put("\u27f6", Mo.VALUE_STRETCHY_HORIZONTAL);
134            StretchOverride.STRETCHATTR.put("\u27f5", Mo.VALUE_STRETCHY_HORIZONTAL);
135            StretchOverride.STRETCHATTR.put("\u23b4", Mo.VALUE_STRETCHY_HORIZONTAL);
136            StretchOverride.STRETCHATTR.put("\u2192", Mo.VALUE_STRETCHY_HORIZONTAL);
137            StretchOverride.STRETCHATTR.put("\u23b5", Mo.VALUE_STRETCHY_HORIZONTAL);
138            StretchOverride.STRETCHATTR.put("\u27fa", Mo.VALUE_STRETCHY_HORIZONTAL);
139            StretchOverride.STRETCHATTR.put("\u2190", Mo.VALUE_STRETCHY_HORIZONTAL);
140            StretchOverride.STRETCHATTR.put("\u2193", Mo.VALUE_STRETCHY_VERTICAL);
141            StretchOverride.STRETCHATTR.put("\u27f9", Mo.VALUE_STRETCHY_HORIZONTAL);
142            StretchOverride.STRETCHATTR.put("\u27f8", Mo.VALUE_STRETCHY_HORIZONTAL);
143            StretchOverride.STRETCHATTR.put("\u2195", Mo.VALUE_STRETCHY_VERTICAL);
144            StretchOverride.STRETCHATTR.put("\u2194", Mo.VALUE_STRETCHY_HORIZONTAL);
145            StretchOverride.STRETCHATTR.put("\u2912", Mo.VALUE_STRETCHY_VERTICAL);
146            StretchOverride.STRETCHATTR.put("\u2913", Mo.VALUE_STRETCHY_VERTICAL);
147            StretchOverride.STRETCHATTR.put("\u21bc", Mo.VALUE_STRETCHY_HORIZONTAL);
148            StretchOverride.STRETCHATTR.put("\u21bf", Mo.VALUE_STRETCHY_VERTICAL);
149            StretchOverride.STRETCHATTR.put("\u21be", Mo.VALUE_STRETCHY_VERTICAL);
150            StretchOverride.STRETCHATTR.put("\u21bd", Mo.VALUE_STRETCHY_HORIZONTAL);
151            StretchOverride.STRETCHATTR.put("\u21a6", Mo.VALUE_STRETCHY_HORIZONTAL);
152            StretchOverride.STRETCHATTR.put("\u21a7", Mo.VALUE_STRETCHY_VERTICAL);
153            StretchOverride.STRETCHATTR.put("\u21a4", Mo.VALUE_STRETCHY_HORIZONTAL);
154            StretchOverride.STRETCHATTR.put("\u21a5", Mo.VALUE_STRETCHY_VERTICAL);
155        }
156    }