|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Operator | Line # 29 | 54 | 32 | 58% |
0.57954544
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||
(92) | |||
Result | |||
0.57954544
|
org.qedeq.kernel.bo.parser.LatexMathParserTest.testReadMaximalTerm09 org.qedeq.kernel.bo.parser.LatexMathParserTest.testReadMaximalTerm09 | 1 PASS | |
0.57954544
|
org.qedeq.kernel.bo.parser.LatexMathParserTest.testReadMaximalTerm05 org.qedeq.kernel.bo.parser.LatexMathParserTest.testReadMaximalTerm05 | 1 PASS | |
0.57954544
|
org.qedeq.kernel.bo.parser.AbstractParserTest.testAllTogether org.qedeq.kernel.bo.parser.AbstractParserTest.testAllTogether | 1 PASS | |
0.57954544
|
org.qedeq.kernel.bo.parser.LatexMathParserTest.testReadMaximalTerm04 org.qedeq.kernel.bo.parser.LatexMathParserTest.testReadMaximalTerm04 | 1 PASS | |
0.5681818
|
org.qedeq.kernel.bo.parser.AsciiMathParserTest.testReadMaximalTerm41 org.qedeq.kernel.bo.parser.AsciiMathParserTest.testReadMaximalTerm41 | 1 PASS | |
0.5681818
|
org.qedeq.kernel.bo.parser.AsciiMathParserTest.testReadMaximalTerm48 org.qedeq.kernel.bo.parser.AsciiMathParserTest.testReadMaximalTerm48 | 1 PASS | |
0.5681818
|
org.qedeq.kernel.bo.parser.AsciiMathParserTest.testReadMaximalTerm38 org.qedeq.kernel.bo.parser.AsciiMathParserTest.testReadMaximalTerm38 | 1 PASS | |
0.5681818
|
org.qedeq.kernel.bo.parser.AsciiMathParserTest.testReadMaximalTerm37 org.qedeq.kernel.bo.parser.AsciiMathParserTest.testReadMaximalTerm37 | 1 PASS | |
0.5681818
|
org.qedeq.kernel.bo.parser.SimpleMathParserTest.testReadMaximalTerm24 org.qedeq.kernel.bo.parser.SimpleMathParserTest.testReadMaximalTerm24 | 1 PASS | |
0.5681818
|
org.qedeq.kernel.bo.parser.SimpleMathParserTest.testReadMaximalTerm21 org.qedeq.kernel.bo.parser.SimpleMathParserTest.testReadMaximalTerm21 | 1 PASS | |
0.5681818
|
org.qedeq.kernel.bo.parser.AsciiMathParserTest.testReadMaximalTerm47 org.qedeq.kernel.bo.parser.AsciiMathParserTest.testReadMaximalTerm47 | 1 PASS | |
0.5681818
|
org.qedeq.kernel.bo.parser.AsciiMathParserTest.testReadMaximalTerm34 org.qedeq.kernel.bo.parser.AsciiMathParserTest.testReadMaximalTerm34 | 1 PASS | |
0.5681818
|
org.qedeq.kernel.bo.parser.AsciiMathParserTest.testReadMaximalTerm35 org.qedeq.kernel.bo.parser.AsciiMathParserTest.testReadMaximalTerm35 | 1 PASS | |
0.5681818
|
org.qedeq.kernel.bo.parser.AsciiMathParserTest.testReadMaximalTerm46 org.qedeq.kernel.bo.parser.AsciiMathParserTest.testReadMaximalTerm46 | 1 PASS | |
0.5681818
|
org.qedeq.kernel.bo.parser.AsciiMathParserTest.testReadMaximalTerm15 org.qedeq.kernel.bo.parser.AsciiMathParserTest.testReadMaximalTerm15 | 1 PASS | |
0.5681818
|
org.qedeq.kernel.bo.parser.AsciiMathParserTest.testReadMaximalTerm01 org.qedeq.kernel.bo.parser.AsciiMathParserTest.testReadMaximalTerm01 | 1 PASS | |
0.5681818
|
org.qedeq.kernel.bo.parser.AsciiMathParserTest.testReadMaximalTerm50 org.qedeq.kernel.bo.parser.AsciiMathParserTest.testReadMaximalTerm50 | 1 PASS | |
0.5681818
|
org.qedeq.kernel.bo.parser.AsciiMathParserTest.testReadMaximalTerm43 org.qedeq.kernel.bo.parser.AsciiMathParserTest.testReadMaximalTerm43 | 1 PASS | |
0.5681818
|
org.qedeq.kernel.bo.parser.AsciiMathParserTest.testReadMaximalTerm44 org.qedeq.kernel.bo.parser.AsciiMathParserTest.testReadMaximalTerm44 | 1 PASS | |
0.5681818
|
org.qedeq.kernel.bo.parser.AsciiMathParserTest.testReadMaximalTerm05 org.qedeq.kernel.bo.parser.AsciiMathParserTest.testReadMaximalTerm05 | 1 PASS | |
0.5681818
|
org.qedeq.kernel.bo.parser.AsciiMathParserTest.testReadMaximalTerm30 org.qedeq.kernel.bo.parser.AsciiMathParserTest.testReadMaximalTerm30 | 1 PASS | |
0.5681818
|
org.qedeq.kernel.bo.parser.AsciiMathParserTest.testReadMaximalTerm33 org.qedeq.kernel.bo.parser.AsciiMathParserTest.testReadMaximalTerm33 | 1 PASS | |
0.5681818
|
org.qedeq.kernel.bo.parser.AsciiMathParserTest.testReadMaximalTerm39 org.qedeq.kernel.bo.parser.AsciiMathParserTest.testReadMaximalTerm39 | 1 PASS | |
0.5681818
|
org.qedeq.kernel.bo.parser.AsciiMathParserTest.testReadMaximalTerm40 org.qedeq.kernel.bo.parser.AsciiMathParserTest.testReadMaximalTerm40 | 1 PASS | |
0.5681818
|
org.qedeq.kernel.bo.parser.AsciiMathParserTest.testReadMaximalTerm32 org.qedeq.kernel.bo.parser.AsciiMathParserTest.testReadMaximalTerm32 | 1 PASS | |
0.5681818
|
org.qedeq.kernel.bo.parser.AsciiMathParserTest.testReadMaximalTerm24 org.qedeq.kernel.bo.parser.AsciiMathParserTest.testReadMaximalTerm24 | 1 PASS | |
0.5681818
|
org.qedeq.kernel.bo.parser.AsciiMathParserTest.testReadMaximalTerm28 org.qedeq.kernel.bo.parser.AsciiMathParserTest.testReadMaximalTerm28 | 1 PASS | |
0.5681818
|
org.qedeq.kernel.bo.parser.AsciiMathParserTest.testReadMaximalTerm08 org.qedeq.kernel.bo.parser.AsciiMathParserTest.testReadMaximalTerm08 | 1 PASS | |
0.5681818
|
org.qedeq.kernel.bo.parser.AsciiMathParserTest.testReadMaximalTerm29 org.qedeq.kernel.bo.parser.AsciiMathParserTest.testReadMaximalTerm29 | 1 PASS | |
0.5681818
|
org.qedeq.kernel.bo.parser.AsciiMathParserTest.testReadMaximalTerm36 org.qedeq.kernel.bo.parser.AsciiMathParserTest.testReadMaximalTerm36 | 1 PASS | |
0.5681818
|
org.qedeq.kernel.bo.parser.AbstractParserTest.testAllTogether org.qedeq.kernel.bo.parser.AbstractParserTest.testAllTogether | 1 PASS | |
0.5681818
|
org.qedeq.kernel.bo.parser.SimpleMathParserTest.testReadMaximalTerm22 org.qedeq.kernel.bo.parser.SimpleMathParserTest.testReadMaximalTerm22 | 1 PASS | |
0.5681818
|
org.qedeq.kernel.bo.parser.AsciiMathParserTest.testReadMaximalTerm00 org.qedeq.kernel.bo.parser.AsciiMathParserTest.testReadMaximalTerm00 | 1 PASS | |
0.5681818
|
org.qedeq.kernel.bo.parser.AbstractParserTest.testAllTogether org.qedeq.kernel.bo.parser.AbstractParserTest.testAllTogether | 1 PASS | |
0.5681818
|
org.qedeq.kernel.bo.parser.AsciiMathParserTest.testReadMaximalTerm14 org.qedeq.kernel.bo.parser.AsciiMathParserTest.testReadMaximalTerm14 | 1 PASS | |
0.5681818
|
org.qedeq.kernel.bo.parser.AsciiMathParserTest.testReadMaximalTerm45 org.qedeq.kernel.bo.parser.AsciiMathParserTest.testReadMaximalTerm45 | 1 PASS | |
0.5681818
|
org.qedeq.kernel.bo.parser.AsciiMathParserTest.testReadMaximalTerm09 org.qedeq.kernel.bo.parser.AsciiMathParserTest.testReadMaximalTerm09 | 1 PASS | |
0.5681818
|
org.qedeq.kernel.bo.parser.AsciiMathParserTest.testReadMaximalTerm42 org.qedeq.kernel.bo.parser.AsciiMathParserTest.testReadMaximalTerm42 | 1 PASS | |
0.5681818
|
org.qedeq.kernel.bo.parser.AsciiMathParserTest.testReadMaximalTerm18 org.qedeq.kernel.bo.parser.AsciiMathParserTest.testReadMaximalTerm18 | 1 PASS | |
0.5681818
|
org.qedeq.kernel.bo.parser.AsciiMathParserTest.testReadMaximalTerm02 org.qedeq.kernel.bo.parser.AsciiMathParserTest.testReadMaximalTerm02 | 1 PASS | |
0.5681818
|
org.qedeq.kernel.bo.parser.AsciiMathParserTest.testReadMaximalTerm31 org.qedeq.kernel.bo.parser.AsciiMathParserTest.testReadMaximalTerm31 | 1 PASS | |
0.5568182
|
org.qedeq.kernel.bo.parser.LatexMathParserTest.testReadMaximalTerm07 org.qedeq.kernel.bo.parser.LatexMathParserTest.testReadMaximalTerm07 | 1 PASS | |
0.5568182
|
org.qedeq.kernel.bo.parser.LatexMathParserTest.testReadMaximalTerm06 org.qedeq.kernel.bo.parser.LatexMathParserTest.testReadMaximalTerm06 | 1 PASS | |
0.54545456
|
org.qedeq.kernel.bo.parser.SimpleMathParserTest.testReadMaximalTerm23 org.qedeq.kernel.bo.parser.SimpleMathParserTest.testReadMaximalTerm23 | 1 PASS | |
0.54545456
|
org.qedeq.kernel.bo.parser.SimpleMathParserTest.testReadMaximalTerm26 org.qedeq.kernel.bo.parser.SimpleMathParserTest.testReadMaximalTerm26 | 1 PASS | |
0.54545456
|
org.qedeq.kernel.bo.parser.SimpleMathParserTest.testReadMaximalTerm28 org.qedeq.kernel.bo.parser.SimpleMathParserTest.testReadMaximalTerm28 | 1 PASS | |
0.54545456
|
org.qedeq.kernel.bo.parser.SimpleMathParserTest.testReadMaximalTerm25 org.qedeq.kernel.bo.parser.SimpleMathParserTest.testReadMaximalTerm25 | 1 PASS | |
0.53409094
|
org.qedeq.kernel.bo.parser.LatexMathParserTest.testReadMaximalTerm08 org.qedeq.kernel.bo.parser.LatexMathParserTest.testReadMaximalTerm08 | 1 PASS | |
0.52272725
|
org.qedeq.kernel.bo.parser.SimpleMathParserTest.testReadMaximalTerm07 org.qedeq.kernel.bo.parser.SimpleMathParserTest.testReadMaximalTerm07 | 1 PASS | |
0.52272725
|
org.qedeq.kernel.bo.parser.SimpleMathParserTest.testReadMaximalTerm08 org.qedeq.kernel.bo.parser.SimpleMathParserTest.testReadMaximalTerm08 | 1 PASS | |
0.5113636
|
org.qedeq.kernel.bo.parser.LatexMathParserTest.testReadMaximalTerm03 org.qedeq.kernel.bo.parser.LatexMathParserTest.testReadMaximalTerm03 | 1 PASS | |
0.5113636
|
org.qedeq.kernel.bo.parser.LatexMathParserTest.testReadMaximalTerm02 org.qedeq.kernel.bo.parser.LatexMathParserTest.testReadMaximalTerm02 | 1 PASS | |
0.5113636
|
org.qedeq.kernel.bo.parser.LatexMathParserTest.testReadMaximalTerm00 org.qedeq.kernel.bo.parser.LatexMathParserTest.testReadMaximalTerm00 | 1 PASS | |
0.5113636
|
org.qedeq.kernel.bo.parser.LatexMathParserTest.testReadMaximalTerm01 org.qedeq.kernel.bo.parser.LatexMathParserTest.testReadMaximalTerm01 | 1 PASS | |
0.5
|
org.qedeq.kernel.bo.parser.SimpleMathParserTest.testReadMaximalTerm27 org.qedeq.kernel.bo.parser.SimpleMathParserTest.testReadMaximalTerm27 | 1 PASS | |
0.47727272
|
org.qedeq.kernel.bo.parser.SimpleMathParserTest.testReadMaximalTerm17 org.qedeq.kernel.bo.parser.SimpleMathParserTest.testReadMaximalTerm17 | 1 PASS | |
0.47727272
|
org.qedeq.kernel.bo.parser.SimpleMathParserTest.testReadMaximalTerm04 org.qedeq.kernel.bo.parser.SimpleMathParserTest.testReadMaximalTerm04 | 1 PASS | |
0.47727272
|
org.qedeq.kernel.bo.parser.SimpleMathParserTest.testReadMaximalTerm19 org.qedeq.kernel.bo.parser.SimpleMathParserTest.testReadMaximalTerm19 | 1 PASS | |
0.47727272
|
org.qedeq.kernel.bo.parser.SimpleMathParserTest.testReadMaximalTerm14 org.qedeq.kernel.bo.parser.SimpleMathParserTest.testReadMaximalTerm14 | 1 PASS | |
0.47727272
|
org.qedeq.kernel.bo.parser.AsciiMathParserTest.testReadMaximalTerm23 org.qedeq.kernel.bo.parser.AsciiMathParserTest.testReadMaximalTerm23 | 1 PASS | |
0.47727272
|
org.qedeq.kernel.bo.parser.AsciiMathParserTest.testReadMaximalTerm07 org.qedeq.kernel.bo.parser.AsciiMathParserTest.testReadMaximalTerm07 | 1 PASS | |
0.47727272
|
org.qedeq.kernel.bo.parser.SimpleMathParserTest.testReadMaximalTerm03 org.qedeq.kernel.bo.parser.SimpleMathParserTest.testReadMaximalTerm03 | 1 PASS | |
0.47727272
|
org.qedeq.kernel.bo.parser.SimpleMathParserTest.testReadMaximalTerm13 org.qedeq.kernel.bo.parser.SimpleMathParserTest.testReadMaximalTerm13 | 1 PASS | |
0.47727272
|
org.qedeq.kernel.bo.parser.AsciiMathParserTest.testReadMaximalTerm49 org.qedeq.kernel.bo.parser.AsciiMathParserTest.testReadMaximalTerm49 | 1 PASS | |
0.47727272
|
org.qedeq.kernel.bo.parser.AsciiMathParserTest.testReadMaximalTerm06 org.qedeq.kernel.bo.parser.AsciiMathParserTest.testReadMaximalTerm06 | 1 PASS | |
0.47727272
|
org.qedeq.kernel.bo.parser.SimpleMathParserTest.testReadMaximalTerm11 org.qedeq.kernel.bo.parser.SimpleMathParserTest.testReadMaximalTerm11 | 1 PASS | |
0.47727272
|
org.qedeq.kernel.bo.parser.AsciiMathParserTest.testReadMaximalTerm22 org.qedeq.kernel.bo.parser.AsciiMathParserTest.testReadMaximalTerm22 | 1 PASS | |
0.47727272
|
org.qedeq.kernel.bo.parser.SimpleMathParserTest.testReadMaximalTerm18 org.qedeq.kernel.bo.parser.SimpleMathParserTest.testReadMaximalTerm18 | 1 PASS | |
0.47727272
|
org.qedeq.kernel.bo.parser.AsciiMathParserTest.testReadMaximalTerm12 org.qedeq.kernel.bo.parser.AsciiMathParserTest.testReadMaximalTerm12 | 1 PASS | |
0.47727272
|
org.qedeq.kernel.bo.parser.AsciiMathParserTest.testReadMaximalTerm16 org.qedeq.kernel.bo.parser.AsciiMathParserTest.testReadMaximalTerm16 | 1 PASS | |
0.47727272
|
org.qedeq.kernel.bo.parser.SimpleMathParserTest.testReadMaximalTerm01 org.qedeq.kernel.bo.parser.SimpleMathParserTest.testReadMaximalTerm01 | 1 PASS | |
0.47727272
|
org.qedeq.kernel.bo.parser.AsciiMathParserTest.testReadMaximalTerm11 org.qedeq.kernel.bo.parser.AsciiMathParserTest.testReadMaximalTerm11 | 1 PASS | |
0.47727272
|
org.qedeq.kernel.bo.parser.AsciiMathParserTest.testReadMaximalTerm17 org.qedeq.kernel.bo.parser.AsciiMathParserTest.testReadMaximalTerm17 | 1 PASS | |
0.47727272
|
org.qedeq.kernel.bo.parser.SimpleMathParserTest.testReadMaximalTerm10 org.qedeq.kernel.bo.parser.SimpleMathParserTest.testReadMaximalTerm10 | 1 PASS | |
0.47727272
|
org.qedeq.kernel.bo.parser.SimpleMathParserTest.testReadMaximalTerm05 org.qedeq.kernel.bo.parser.SimpleMathParserTest.testReadMaximalTerm05 | 1 PASS | |
0.47727272
|
org.qedeq.kernel.bo.parser.AsciiMathParserTest.testReadMaximalTerm04 org.qedeq.kernel.bo.parser.AsciiMathParserTest.testReadMaximalTerm04 | 1 PASS | |
0.47727272
|
org.qedeq.kernel.bo.parser.SimpleMathParserTest.testReadMaximalTerm15 org.qedeq.kernel.bo.parser.SimpleMathParserTest.testReadMaximalTerm15 | 1 PASS | |
0.47727272
|
org.qedeq.kernel.bo.parser.AsciiMathParserTest.testReadMaximalTerm26 org.qedeq.kernel.bo.parser.AsciiMathParserTest.testReadMaximalTerm26 | 1 PASS | |
0.47727272
|
org.qedeq.kernel.bo.parser.SimpleMathParserTest.testReadMaximalTerm02 org.qedeq.kernel.bo.parser.SimpleMathParserTest.testReadMaximalTerm02 | 1 PASS | |
0.47727272
|
org.qedeq.kernel.bo.parser.SimpleMathParserTest.testReadMaximalTerm12 org.qedeq.kernel.bo.parser.SimpleMathParserTest.testReadMaximalTerm12 | 1 PASS | |
0.47727272
|
org.qedeq.kernel.bo.parser.SimpleMathParserTest.testReadMaximalTerm16 org.qedeq.kernel.bo.parser.SimpleMathParserTest.testReadMaximalTerm16 | 1 PASS | |
0.47727272
|
org.qedeq.kernel.bo.parser.AsciiMathParserTest.testReadMaximalTerm21 org.qedeq.kernel.bo.parser.AsciiMathParserTest.testReadMaximalTerm21 | 1 PASS | |
0.47727272
|
org.qedeq.kernel.bo.parser.AsciiMathParserTest.testReadMaximalTerm03 org.qedeq.kernel.bo.parser.AsciiMathParserTest.testReadMaximalTerm03 | 1 PASS | |
0.47727272
|
org.qedeq.kernel.bo.parser.SimpleMathParserTest.testReadMaximalTerm20 org.qedeq.kernel.bo.parser.SimpleMathParserTest.testReadMaximalTerm20 | 1 PASS | |
0.47727272
|
org.qedeq.kernel.bo.parser.AsciiMathParserTest.testReadMaximalTerm10 org.qedeq.kernel.bo.parser.AsciiMathParserTest.testReadMaximalTerm10 | 1 PASS | |
0.47727272
|
org.qedeq.kernel.bo.parser.SimpleMathParserTest.testReadMaximalTerm09 org.qedeq.kernel.bo.parser.SimpleMathParserTest.testReadMaximalTerm09 | 1 PASS | |
0.47727272
|
org.qedeq.kernel.bo.parser.AsciiMathParserTest.testReadMaximalTerm20 org.qedeq.kernel.bo.parser.AsciiMathParserTest.testReadMaximalTerm20 | 1 PASS | |
0.47727272
|
org.qedeq.kernel.bo.parser.AsciiMathParserTest.testReadMaximalTerm27 org.qedeq.kernel.bo.parser.AsciiMathParserTest.testReadMaximalTerm27 | 1 PASS | |
0.47727272
|
org.qedeq.kernel.bo.parser.SimpleMathParserTest.testReadMaximalTerm00 org.qedeq.kernel.bo.parser.SimpleMathParserTest.testReadMaximalTerm00 | 1 PASS | |
0.47727272
|
org.qedeq.kernel.bo.parser.AsciiMathParserTest.testReadMaximalTerm13 org.qedeq.kernel.bo.parser.AsciiMathParserTest.testReadMaximalTerm13 | 1 PASS | |
0.47727272
|
org.qedeq.kernel.bo.parser.AsciiMathParserTest.testReadMaximalTerm19 org.qedeq.kernel.bo.parser.AsciiMathParserTest.testReadMaximalTerm19 | 1 PASS | |
0.3409091
|
org.qedeq.kernel.bo.parser.SimpleMathParserTest.testReadMaximalTerm06 org.qedeq.kernel.bo.parser.SimpleMathParserTest.testReadMaximalTerm06 | 1 PASS | |
1 | /* $Id: Operator.java,v 1.1 2008/07/26 07:58:30 m31 Exp $ | |
2 | * | |
3 | * This file is part of the project "Hilbert II" - http://www.qedeq.org | |
4 | * | |
5 | * Copyright 2000-2008, Michael Meyling <mime@qedeq.org>. | |
6 | * | |
7 | * "Hilbert II" is free software; you can redistribute | |
8 | * it and/or modify it under the terms of the GNU General Public | |
9 | * License as published by the Free Software Foundation; either | |
10 | * version 2 of the License, or (at your option) any later version. | |
11 | * | |
12 | * This program is distributed in the hope that it will be useful, | |
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 | * GNU General Public License for more details. | |
16 | */ | |
17 | ||
18 | package org.qedeq.kernel.bo.parser; | |
19 | ||
20 | ||
21 | /** | |
22 | * This class describes an term or logical operator. An operator is of either | |
23 | * prefix, infix or postfix type and has a minimum and maximum number of operands. | |
24 | * It has a symbol or token that enables to recognize it and a QEDEQ representation. | |
25 | * | |
26 | * @version $Revision: 1.1 $ | |
27 | * @author Michael Meyling | |
28 | */ | |
29 | public final class Operator { | |
30 | ||
31 | /** Marks infix operator. */ | |
32 | public static final int INFIX = 0; | |
33 | ||
34 | /** Marks prefix operator. */ | |
35 | public static final int SIMPLE_PREFIX = 1; | |
36 | ||
37 | /** Marks postfix operator. */ | |
38 | public static final int POSTFIX = 2; | |
39 | ||
40 | /** Marks function operator. */ | |
41 | public static final int FUNCTION = 4; | |
42 | ||
43 | /** Prefix, function, infix or postfix. See {@link #SIMPLE_PREFIX}, {@link #FUNCTION}, | |
44 | * {@link #INFIX} and {@link #POSTFIX}. */ | |
45 | private final int type; | |
46 | ||
47 | /** Start symbol or token for this operator. */ | |
48 | private final String startSymbol; | |
49 | ||
50 | /** Separator symbol or token for this operator. This could be a comma for example. */ | |
51 | private final String separatorSymbol; | |
52 | ||
53 | /** End symbol or token for this operator. */ | |
54 | private final String endSymbol; | |
55 | ||
56 | /** Operator priority. Highest is 0. */ | |
57 | private final int priority; | |
58 | ||
59 | /** QEDEQ token for this operator. */ | |
60 | private final String qedeq; | |
61 | ||
62 | /** First QEDEQ argument. Can be <code>null</code>. */ | |
63 | private final String qedeqArgument; | |
64 | ||
65 | /** Minimum number of arguments. */ | |
66 | private final int min; | |
67 | ||
68 | /** Maximum number of arguments. */ | |
69 | private final int max; | |
70 | ||
71 | ||
72 | /** | |
73 | * Constructor. | |
74 | * | |
75 | * @param symbol Symbol or token for this operator. | |
76 | * @param qedeq QEDEQ operator symbol. | |
77 | * @param qedeqArgument First Argument in QEDEQ-Syntax - if any. | |
78 | * @param priority Operator priority, highest is 0. | |
79 | * @param type Prefix, infix or postfix. See {@link #SIMPLE_PREFIX}, {@link #FUNCTION}, | |
80 | * {@link #INFIX} and {@link #POSTFIX}. | |
81 | * @param min Minimum number of arguments for this operator. | |
82 | */ | |
83 | 544 | public Operator(final String symbol, |
84 | final String qedeq, | |
85 | final String qedeqArgument, | |
86 | final int priority, | |
87 | final int type, | |
88 | final int min) { | |
89 | 544 | this(symbol, qedeq, qedeqArgument, priority, type, min, -1); |
90 | } | |
91 | ||
92 | /** | |
93 | * Constructor. | |
94 | * | |
95 | * @param symbol Symbol or token for this operator. | |
96 | * @param qedeq QEDEQ operator symbol. | |
97 | * @param qedeqArgument First Argument in QEDEQ-Syntax - if any. | |
98 | * @param priority Operator priority, highest is 0. | |
99 | * @param type Prefix, infix or postfix. See {@link #SIMPLE_PREFIX}, | |
100 | * {@link #FUNCTION}, | |
101 | * {@link #INFIX} and {@link #POSTFIX}. | |
102 | * @param min Minimum number of arguments for this operator. | |
103 | * @param max Maximum number of arguments for this operator. | |
104 | */ | |
105 | 1338 | public Operator(final String symbol, |
106 | final String qedeq, | |
107 | final String qedeqArgument, | |
108 | final int priority, | |
109 | final int type, | |
110 | final int min, | |
111 | final int max) { | |
112 | 1338 | this(symbol, null, null, qedeq, qedeqArgument, priority, type, min, max); |
113 | } | |
114 | ||
115 | /** | |
116 | * Constructor for prefix operators like <code>{x | x > 0}</code>. | |
117 | * | |
118 | * @param startSymbol Starting symbol or token for this operator. | |
119 | * @param separatorSymbol Symbol or token that separates arguments for this operator. | |
120 | * @param endSymbol End symbol or token for this operator. | |
121 | * @param qedeq QEDEQ operator symbol. | |
122 | * @param qedeqArgument First Argument in QEDEQ-Syntax - if any | |
123 | * @param priority Operator priority, highest is 0. | |
124 | * @param min Minimum number of arguments for this operator. | |
125 | */ | |
126 | 92 | public Operator(final String startSymbol, |
127 | final String separatorSymbol, | |
128 | final String endSymbol, | |
129 | final String qedeq, | |
130 | final String qedeqArgument, | |
131 | final int priority, | |
132 | final int min) { | |
133 | 92 | this(startSymbol, separatorSymbol, endSymbol, qedeq, qedeqArgument, priority, SIMPLE_PREFIX, |
134 | min, -1); | |
135 | } | |
136 | ||
137 | /** | |
138 | * Constructor for prefix operators like <code>{x, y, z}</code>. | |
139 | * | |
140 | * @param startSymbol Starting symbol or token for this operator. | |
141 | * @param separatorSymbol Symbol or token that separates arguments for this operator. | |
142 | * @param endSymbol End symbol or token for this operator. | |
143 | * @param qedeq QEDEQ operator symbol. | |
144 | * @param qedeqArgument First Argument in QEDEQ-Syntax - if any. | |
145 | * @param priority Operator priority, highest is 0. | |
146 | * @param min Minimum number of arguments for this operator. | |
147 | * @param max Maximum number of arguments for this operator. | |
148 | */ | |
149 | 92 | public Operator(final String startSymbol, |
150 | final String separatorSymbol, | |
151 | final String endSymbol, | |
152 | final String qedeq, | |
153 | final String qedeqArgument, | |
154 | final int priority, | |
155 | final int min, | |
156 | final int max) { | |
157 | 92 | this(startSymbol, separatorSymbol, endSymbol, qedeq, qedeqArgument, priority, SIMPLE_PREFIX, |
158 | min, max); | |
159 | } | |
160 | ||
161 | /** | |
162 | * Constructor. | |
163 | * | |
164 | * @param startSymbol Starting symbol or token for this operator. | |
165 | * @param separatorSymbol Symbol or token that separates arguments for this operator. | |
166 | * @param endSymbol End symbol or token for this operator. | |
167 | * @param qedeq QEDEQ operator symbol. | |
168 | * @param qedeqArgument First Argument in QEDEQ-Syntax - if any. | |
169 | * @param priority Operator priority, highest is 0. | |
170 | * @param type Prefix, infix or postfix. See {@link #SIMPLE_PREFIX}, | |
171 | * {@link #FUNCTION}, {@link #INFIX} and {@link #POSTFIX}. | |
172 | * @param min Minimum number of arguments for this operator. | |
173 | * @param max Maximum number of arguments for this operator. | |
174 | */ | |
175 | 1522 | public Operator(final String startSymbol, final String separatorSymbol, final String endSymbol, |
176 | final String qedeq, | |
177 | final String qedeqArgument, | |
178 | final int priority, | |
179 | final int type, | |
180 | final int min, | |
181 | final int max) { | |
182 | 1522 | this.startSymbol = startSymbol; |
183 | 1522 | this.separatorSymbol = separatorSymbol; |
184 | 1522 | this.endSymbol = endSymbol; |
185 | 1522 | this.type = type; |
186 | 1522 | this.qedeq = qedeq; |
187 | 1522 | this.qedeqArgument = qedeqArgument; |
188 | 1522 | this.priority = priority; |
189 | 1522 | this.min = min; |
190 | 1522 | this.max = max; |
191 | 1522 | switch (type) { |
192 | 747 | case INFIX: |
193 | 687 | case SIMPLE_PREFIX: |
194 | 88 | case FUNCTION: |
195 | 0 | case POSTFIX: |
196 | 1522 | break; |
197 | 0 | default: |
198 | 0 | throw new IllegalArgumentException("unknown operator type: " |
199 | + type); | |
200 | } | |
201 | 1522 | if (max != -1 && min > max) { |
202 | 0 | throw new IllegalArgumentException("Min greater than max: " + min + " > " + max); |
203 | } | |
204 | 1522 | if (isInfix() && min < 2) { |
205 | 0 | throw new IllegalArgumentException("Infix needs at least two arguments"); |
206 | } | |
207 | } | |
208 | ||
209 | /** | |
210 | * Returns symbol or token to identify this operator. | |
211 | * | |
212 | * @return Symbol or token to identify a start of this operator. | |
213 | */ | |
214 | 144522 | public final String getStartSymbol() { |
215 | 144522 | return startSymbol; |
216 | } | |
217 | ||
218 | /** | |
219 | * Returns symbol or token to separate different arguments for this operator. Can only be | |
220 | * different from <code>null</code> if this is a prefix operator. | |
221 | * | |
222 | * @return Symbol or token to identify the start of a new argument of this operator. | |
223 | */ | |
224 | 292 | public String getSeparatorSymbol() { |
225 | 292 | return separatorSymbol; |
226 | } | |
227 | ||
228 | /** | |
229 | * Returns symbol or token to identify the end of this operator. Can only be different from | |
230 | * <code>null</code> if this is a prefix operator. | |
231 | * | |
232 | * @return Symbol or token to identify the end of this operator. Maybe <code>null</code>. | |
233 | */ | |
234 | 566 | public String getEndSymbol() { |
235 | 566 | return endSymbol; |
236 | } | |
237 | ||
238 | /** | |
239 | * Is this an infix operator? | |
240 | * | |
241 | * @return Is this an infix operator? | |
242 | */ | |
243 | 1522 | public final boolean isInfix() { |
244 | 1522 | return type == INFIX; |
245 | } | |
246 | ||
247 | /** | |
248 | * Is this a prefix operator? | |
249 | * | |
250 | * @return Is this a prefix operator? | |
251 | */ | |
252 | 1105 | public final boolean isPrefix() { |
253 | 1105 | return type == SIMPLE_PREFIX || type == FUNCTION; |
254 | } | |
255 | ||
256 | /** | |
257 | * Is this a function operator? | |
258 | * | |
259 | * @return Is this a function operator? | |
260 | */ | |
261 | 436 | public final boolean isFunction() { |
262 | 436 | return type == FUNCTION; |
263 | } | |
264 | ||
265 | /** | |
266 | * Is this a postfix operator? | |
267 | * | |
268 | * @return Is this a postfix operator? | |
269 | */ | |
270 | 613 | public final boolean isPostfix() { |
271 | 613 | return type == POSTFIX; |
272 | } | |
273 | ||
274 | /** | |
275 | * Get operator priority. 0 is the highest priority. | |
276 | * | |
277 | * @return Priority. | |
278 | */ | |
279 | 2368 | public final int getPriority() { |
280 | 2368 | return this.priority; |
281 | } | |
282 | ||
283 | /** | |
284 | * Get minimum argument number. | |
285 | * | |
286 | * @return Minimum argument number. | |
287 | */ | |
288 | 830 | public final int getMin() { |
289 | 830 | return this.min; |
290 | } | |
291 | ||
292 | /** | |
293 | * Get maximum argument number. | |
294 | * | |
295 | * @return Maximum argument number. | |
296 | */ | |
297 | 3482 | public final int getMax() { |
298 | 3482 | return max; |
299 | } | |
300 | ||
301 | /** | |
302 | * Get QEDEQ operator name. | |
303 | * | |
304 | * @return QEDEQ operator name. | |
305 | */ | |
306 | 11343 | public final String getQedeq() { |
307 | 11343 | return qedeq; |
308 | } | |
309 | ||
310 | /** | |
311 | * Get first QEDEQ argument. | |
312 | * | |
313 | * @return First QEDEQ argument. Can be <code>null</code>. | |
314 | */ | |
315 | 18096 | public final String getQedeqArgument() { |
316 | 18096 | return qedeqArgument; |
317 | } | |
318 | ||
319 | 0 | public final String toString() { |
320 | 0 | final StringBuffer buffer = new StringBuffer(getStartSymbol()); |
321 | 0 | buffer.append("[" + getMin() + ", "); |
322 | 0 | if (getMax() == -1) { |
323 | 0 | buffer.append(".."); |
324 | } else { | |
325 | 0 | buffer.append(getMax()); |
326 | } | |
327 | 0 | buffer.append("]"); |
328 | 0 | if (getSeparatorSymbol() != null) { |
329 | 0 | buffer.append(" ").append(getSeparatorSymbol()); |
330 | } | |
331 | 0 | if (getEndSymbol() != null) { |
332 | 0 | buffer.append(" ").append(getEndSymbol()); |
333 | } | |
334 | 0 | if (isFunction()) { |
335 | 0 | buffer.append(", is function"); |
336 | } | |
337 | 0 | if (isPrefix()) { |
338 | 0 | buffer.append(", is prefix"); |
339 | } | |
340 | 0 | if (isInfix()) { |
341 | 0 | buffer.append(", is infix"); |
342 | } | |
343 | 0 | return buffer.toString(); |
344 | } | |
345 | ||
346 | } | |
347 |
|