| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| OperatorAttribute |
|
| 2.0;2 |
| 1 | /* | |
| 2 | * Copyright 2002 - 2007 JEuclid, http://jeuclid.sf.net | |
| 3 | * | |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); | |
| 5 | * you may not use this file except in compliance with the License. | |
| 6 | * You may obtain a copy of the License at | |
| 7 | * | |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 | |
| 9 | * | |
| 10 | * Unless required by applicable law or agreed to in writing, software | |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, | |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| 13 | * See the License for the specific language governing permissions and | |
| 14 | * limitations under the License. | |
| 15 | */ | |
| 16 | ||
| 17 | /* $Id: OperatorAttribute.java,v 88b901bf20fb 2008/06/07 14:12:27 maxberger $ */ | |
| 18 | ||
| 19 | package net.sourceforge.jeuclid.elements.support.operatordict; | |
| 20 | ||
| 21 | import java.util.Locale; | |
| 22 | ||
| 23 | import net.sourceforge.jeuclid.Constants; | |
| 24 | ||
| 25 | /** | |
| 26 | * @version $Revision: 88b901bf20fb $ | |
| 27 | */ | |
| 28 | /** | |
| 29 | * @version $Revision: 88b901bf20fb $ | |
| 30 | */ | |
| 31 | 21823990 | public enum OperatorAttribute { |
| 32 | ||
| 33 | /** */ | |
| 34 | 209 | FORM(OperatorDictionary.FORM_INFIX), |
| 35 | /** */ | |
| 36 | 209 | FENCE(Constants.FALSE), |
| 37 | /** */ | |
| 38 | 209 | SEPARATOR(Constants.FALSE), |
| 39 | /** */ | |
| 40 | 209 | LSPACE(OperatorDictionary.NAME_THICKMATHSPACE), |
| 41 | /** */ | |
| 42 | 209 | RSPACE(OperatorDictionary.NAME_THICKMATHSPACE), |
| 43 | /** */ | |
| 44 | 209 | STRETCHY(Constants.FALSE), |
| 45 | /** */ | |
| 46 | 209 | SYMMETRIC(Constants.TRUE), |
| 47 | /** */ | |
| 48 | 209 | MAXSIZE(OperatorDictionary.NAME_INFINITY), |
| 49 | /** */ | |
| 50 | 209 | MINSIZE("1"), |
| 51 | /** */ | |
| 52 | 209 | LARGEOP(Constants.FALSE), |
| 53 | /** */ | |
| 54 | 209 | MOVABLELIMITS(Constants.FALSE), |
| 55 | /** */ | |
| 56 | 209 | ACCENT(Constants.FALSE); |
| 57 | ||
| 58 | private final String defaultValue; | |
| 59 | ||
| 60 | 2508 | private OperatorAttribute(final String defValue) { |
| 61 | 2508 | this.defaultValue = defValue; |
| 62 | 2508 | } |
| 63 | ||
| 64 | /** | |
| 65 | * @return the default value for this operator attribute. | |
| 66 | */ | |
| 67 | public String getDefaultValue() { | |
| 68 | 11677364 | return this.defaultValue; |
| 69 | } | |
| 70 | ||
| 71 | /** | |
| 72 | * Parses a String into an OperatorAttribute. | |
| 73 | * | |
| 74 | * @param attr | |
| 75 | * the String to parse | |
| 76 | * @return an operatorAttibute if possible | |
| 77 | * @throws UnknownAttributeException | |
| 78 | * if the string does not represent a valid attribute. | |
| 79 | */ | |
| 80 | public static OperatorAttribute parseOperatorAttribute(final String attr) | |
| 81 | throws UnknownAttributeException { | |
| 82 | try { | |
| 83 | 21823572 | return OperatorAttribute.valueOf(attr.toUpperCase(Locale.US)); |
| 84 | 418 | } catch (final IllegalArgumentException iae) { |
| 85 | 418 | throw new UnknownAttributeException(attr, iae); |
| 86 | } | |
| 87 | } | |
| 88 | ||
| 89 | } |