classes.
Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
class Chiffre extends Facteur {
+ Character c;
- public boolean evaluer() {
- return true;
+ Chiffre(Character c) throws NotCharacterException {
+ //TODO?: remove extragenous whitespace
+ if (Character.isLetterOrDigit(c)) {
+ this.c = c;
+ } else {
+ throw new NotCharacterException(c + " is not a character type");
+ }
+ }
+
+ private boolean isChiffre() {
+ return Character.isDigit(c);
+ }
+ public double evaluer() {
+ return 0.0;
}
}
public abstract class Expression {
-
- abstract boolean evaluer();
+
+ abstract double evaluer();
}
# NAME = Camilo Juan
CLASSES = \
+ NotCharacterException.java \
Expression.java \
Terme.java \
Opadd.java \
--- /dev/null
+
+public class NotCharacterException extends Exception {
+
+ public NotCharacterException() {
+ super();
+ // TODO Auto-generated constructor stub
+ }
+
+ public NotCharacterException(String message) {
+ super(message);
+ // TODO Auto-generated constructor stub
+ }
+
+ public NotCharacterException(Throwable cause) {
+ super(cause);
+ // TODO Auto-generated constructor stub
+ }
+
+ public NotCharacterException(String message, Throwable cause) {
+ super(message, cause);
+ // TODO Auto-generated constructor stub
+ }
+
+}
class Opdiv extends Opmul {
- public boolean evaluer() {
- return true;
+ public double evaluer() {
+ return 0.0;
}
}
class Opminus extends Opadd {
- public boolean evaluer() {
- return true;
+ public double evaluer() {
+ return 0.0;
}
}
class Opmulti extends Opmul {
- public boolean evaluer() {
- return true;
+ public double evaluer() {
+ return 0.0;
}
}
class Opplus extends Opadd {
- public boolean evaluer() {
- return true;
- }
+ public double evaluer() {
+ return 0.0;
+ }
}
class Parenthese extends Facteur {
- public boolean evaluer() {
- return true;
- }
+ public double evaluer() {
+ return 0.0;
+ }
}
+import java.util.TreeMap;
class Variable extends Terme {
+ TreeMap<Character, Double> v;
- public boolean evaluer() {
- return true;
+ Variable(Character c) throws NotCharacterException {
+ v = new TreeMap<Character, Double>();
+ //TODO?: remove extragenous whitespace
+ if (Character.isLetterOrDigit(c)) {
+ v.put(c, 0.0); // we suppose the default variable value is 0
+ } else {
+ throw new NotCharacterException(c + " is not a character type");
+ }
+ }
+
+ private boolean isVariable() {
+ //FIXME: this cover more than latin alphabet
+ return Character.isLetter(v.firstKey());
+ }
+
+ public double evaluer() {
+ return 0.0;
}
}
<w>100</w>
<h>60</h>
</coordinates>
- <panel_attributes>Expression
+ <panel_attributes>/Expression/
--
--
-/+evaluer()/
+/+evaluer():/
</panel_attributes>
<additional_attributes/>
</element>
<w>100</w>
<h>30</h>
</coordinates>
- <panel_attributes>Terme</panel_attributes>
+ <panel_attributes>/Terme/</panel_attributes>
<additional_attributes/>
</element>
<element>
<w>100</w>
<h>30</h>
</coordinates>
- <panel_attributes>Op-add</panel_attributes>
+ <panel_attributes>/Op-add/</panel_attributes>
<additional_attributes/>
</element>
<element>
<w>100</w>
<h>30</h>
</coordinates>
- <panel_attributes>Facteur</panel_attributes>
+ <panel_attributes>/Facteur/</panel_attributes>
<additional_attributes/>
</element>
<element>
<w>100</w>
<h>30</h>
</coordinates>
- <panel_attributes>Op-mul</panel_attributes>
+ <panel_attributes>/Op-mul/</panel_attributes>
<additional_attributes/>
</element>
<element>