From 0f1055b8d7f97d86c66fa602c17666bc2ff9c437 Mon Sep 17 00:00:00 2001 From: Constantin Jucovschi Date: Tue, 31 Mar 2009 06:18:54 -0400 Subject: Initial commit --- src/grammar/ComplexConst.java | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 src/grammar/ComplexConst.java (limited to 'src/grammar/ComplexConst.java') diff --git a/src/grammar/ComplexConst.java b/src/grammar/ComplexConst.java new file mode 100644 index 0000000..d05e279 --- /dev/null +++ b/src/grammar/ComplexConst.java @@ -0,0 +1,37 @@ +package grammar; + +/** + * ComplexConst + * @author: Andrei Aiordachioaie + */ +public class ComplexConst +{ + String re, im; + + /** + * ComplexLit constructor comment. + */ + public ComplexConst() + { + super(); + } + + public ComplexConst(String val) + { + int pos = val.indexOf("+i", 0); + + if (pos != -1) + { + re = val.substring(0, pos - 1); + im = val.substring(pos + 2, val.length()); + } + } + + public String toXML() + { + return "" + re + "" + im + "