home *** CD-ROM | disk | FTP | other *** search
- package webeq3;
-
- import java.awt.event.MouseAdapter;
- import java.awt.event.MouseEvent;
- import webeq3.parser.mathml.P2CConverterException;
- import webeq3.schema.ContentBox;
- import webeq3.schema.Normalizer;
-
- class P2CTester$TDButtonAdapter extends MouseAdapter {
- String name;
- // $FF: synthetic field
- private final P2CTester this$0;
-
- public P2CTester$TDButtonAdapter(P2CTester var1, String var2) {
- this.this$0 = var1;
- this.name = var2;
- }
-
- public void mouseClicked(MouseEvent var1) {
- if (this.name.equals("next")) {
- ++this.this$0.idx;
- if (this.this$0.idx == this.this$0.mathMLVector.size()) {
- this.this$0.idx = 0;
- }
- } else if (this.name.equals("prev")) {
- --this.this$0.idx;
- if (this.this$0.idx < 0) {
- this.this$0.idx = this.this$0.mathMLVector.size() - 1;
- }
- } else if (this.name.equals("check all")) {
- System.out.println("Checking equations..");
-
- for(this.this$0.idx = 0; this.this$0.idx < this.this$0.mathMLVector.size(); ++this.this$0.idx) {
- this.this$0.setEquation(this.this$0.idx);
- this.this$0.eq.redraw();
- this.this$0.presentationRoot = this.this$0.eq.root.getCopy();
-
- try {
- this.this$0.normalizedRoot = this.this$0.eq.root.getCopy();
- Normalizer.normalize(this.this$0.normalizedRoot);
- } catch (Exception var4) {
- System.out.println("Normalization failed: " + var4);
- }
-
- try {
- this.this$0.p2cconverter.convert(this.this$0.normalizedRoot, this.this$0.eq.markupRoot);
- this.this$0.contentRoot = this.this$0.eq.markupRoot.getCopy();
- if (!this.this$0.treeEqualityCheck((ContentBox)this.this$0.contentRoot, (ContentBox)this.this$0.answerRoot)) {
- this.this$0.contentRoot.printDebug();
- this.this$0.answerRoot.printDebug();
- }
- } catch (P2CConverterException var3) {
- System.out.println("P2C conversion failed: " + var3);
- }
-
- System.out.print("#" + this.this$0.idx + ".. ");
- if (10 * (this.this$0.idx / 10) == this.this$0.idx) {
- System.out.println();
- }
- }
-
- this.this$0.idx = 0;
- }
-
- System.out.println("\n Testing finished.");
- this.this$0.setEquation(this.this$0.idx);
- this.this$0.repaint();
- }
- }
-