home *** CD-ROM | disk | FTP | other *** search
/ PC Pro 2001 December / dppcpro1201.iso / Extras / maple / Viewer / WebEQ / MMLViewerInstall.cab / MMLViewerApplet.cab / webeq3 / P2CTester$TDButtonAdapter.class (.txt) < prev    next >
Encoding:
Java Class File  |  2001-05-24  |  2.8 KB  |  70 lines

  1. package webeq3;
  2.  
  3. import java.awt.event.MouseAdapter;
  4. import java.awt.event.MouseEvent;
  5. import webeq3.parser.mathml.P2CConverterException;
  6. import webeq3.schema.ContentBox;
  7. import webeq3.schema.Normalizer;
  8.  
  9. class P2CTester$TDButtonAdapter extends MouseAdapter {
  10.    String name;
  11.    // $FF: synthetic field
  12.    private final P2CTester this$0;
  13.  
  14.    public P2CTester$TDButtonAdapter(P2CTester var1, String var2) {
  15.       this.this$0 = var1;
  16.       this.name = var2;
  17.    }
  18.  
  19.    public void mouseClicked(MouseEvent var1) {
  20.       if (this.name.equals("next")) {
  21.          ++this.this$0.idx;
  22.          if (this.this$0.idx == this.this$0.mathMLVector.size()) {
  23.             this.this$0.idx = 0;
  24.          }
  25.       } else if (this.name.equals("prev")) {
  26.          --this.this$0.idx;
  27.          if (this.this$0.idx < 0) {
  28.             this.this$0.idx = this.this$0.mathMLVector.size() - 1;
  29.          }
  30.       } else if (this.name.equals("check all")) {
  31.          System.out.println("Checking equations..");
  32.  
  33.          for(this.this$0.idx = 0; this.this$0.idx < this.this$0.mathMLVector.size(); ++this.this$0.idx) {
  34.             this.this$0.setEquation(this.this$0.idx);
  35.             this.this$0.eq.redraw();
  36.             this.this$0.presentationRoot = this.this$0.eq.root.getCopy();
  37.  
  38.             try {
  39.                this.this$0.normalizedRoot = this.this$0.eq.root.getCopy();
  40.                Normalizer.normalize(this.this$0.normalizedRoot);
  41.             } catch (Exception var4) {
  42.                System.out.println("Normalization failed: " + var4);
  43.             }
  44.  
  45.             try {
  46.                this.this$0.p2cconverter.convert(this.this$0.normalizedRoot, this.this$0.eq.markupRoot);
  47.                this.this$0.contentRoot = this.this$0.eq.markupRoot.getCopy();
  48.                if (!this.this$0.treeEqualityCheck((ContentBox)this.this$0.contentRoot, (ContentBox)this.this$0.answerRoot)) {
  49.                   this.this$0.contentRoot.printDebug();
  50.                   this.this$0.answerRoot.printDebug();
  51.                }
  52.             } catch (P2CConverterException var3) {
  53.                System.out.println("P2C conversion failed: " + var3);
  54.             }
  55.  
  56.             System.out.print("#" + this.this$0.idx + ".. ");
  57.             if (10 * (this.this$0.idx / 10) == this.this$0.idx) {
  58.                System.out.println();
  59.             }
  60.          }
  61.  
  62.          this.this$0.idx = 0;
  63.       }
  64.  
  65.       System.out.println("\n Testing finished.");
  66.       this.this$0.setEquation(this.this$0.idx);
  67.       this.this$0.repaint();
  68.    }
  69. }
  70.