diff options
| author | Constantin Jucovschi <cj@ubuntu.localdomain> | 2009-03-31 06:18:54 -0400 |
|---|---|---|
| committer | Constantin Jucovschi <cj@ubuntu.localdomain> | 2009-03-31 06:18:54 -0400 |
| commit | 0f1055b8d7f97d86c66fa602c17666bc2ff9c437 (patch) | |
| tree | 9c68fa99a97063bbe4a4231e04fc09329541ac71 /src/grammar/ComplexConst.java | |
Initial commit
Diffstat (limited to 'src/grammar/ComplexConst.java')
| -rw-r--r-- | src/grammar/ComplexConst.java | 37 |
1 files changed, 37 insertions, 0 deletions
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 "<complexConstant><re>" + re + "</re><im>" + im + "</im></complexConstant"; + } +} + + +//~ Formatted by Jindent --- http://www.jindent.com |
