create changelog entry
[debian/openrocket] / core / src / de / congrace / exp4j / AbstractExpression.java
1 /*
2    Copyright 2011 frank asseg
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 package de.congrace.exp4j;
18
19 import java.text.NumberFormat;
20 import java.util.ArrayList;
21 import java.util.List;
22
23 /**
24  * Abstract base class for mathematical expressions
25  * 
26  * @author fas@congrace.de
27  */
28 abstract class AbstractExpression {
29         private final String expression;
30         private final Token[] tokens;
31         private final String[] variableStrings;
32         private final NumberFormat numberFormat = NumberFormat.getInstance();
33
34         /**
35          * Construct a new {@link AbstractExpression}
36          * 
37          * @param expression
38          *            the mathematical expression to be used
39          * @param tokens
40          *            the {@link Token}s in the expression
41          * @param variableNames
42          *            an array of variable names which are used in the expression
43          */
44         AbstractExpression(String expression, Token[] tokens, String[] variableStrings) {
45                 this.expression = expression;
46                 this.tokens = tokens;
47                 this.variableStrings = variableStrings;
48         }
49
50         /**
51          * get the mathematical expression {@link String}
52          * 
53          * @return the expression
54          */
55         public String getExpression() {
56                 return expression;
57         }
58
59         /**
60          * get the used {@link NumberFormat}
61          * 
62          * @return the used {@link NumberFormat}
63          */
64         public NumberFormat getNumberFormat() {
65                 return numberFormat;
66         }
67
68         /**
69          * get the {@link Token}s
70          * 
71          * @return the array of {@link Token}s
72          */
73         Token[] getTokens() {
74                 return tokens;
75         }
76         
77 }