[BACK]Return to PolyCalc.java CVS log [TXT][DIR] Up to [local] / OpenXM / src / OpenMath

Diff for /OpenXM/src/OpenMath/PolyCalc.java between version 1.5 and 1.6

version 1.5, 1999/11/02 15:58:11 version 1.6, 1999/11/10 21:25:48
Line 1 
Line 1 
 /**  /**
  * $OpenXM: OpenXM/src/OpenMath/PolyCalc.java,v 1.4 1999/11/02 15:10:31 tam Exp $   * $OpenXM: OpenXM/src/OpenMath/PolyCalc.java,v 1.5 1999/11/02 15:58:11 tam Exp $
  */   */
   
 import JP.ac.kobe_u.math.tam.OpenXM.*;  import JP.ac.kobe_u.math.tam.OpenXM.*;
Line 7  import java.applet.*;
Line 7  import java.applet.*;
 import java.awt.event.*;  import java.awt.event.*;
 import java.awt.*;  import java.awt.*;
   
 class PolyCalc extends Applet implements ActionListener{  class PolyCalc extends Applet implements ActionListener,Runnable{
   private String host = "localhost";    private String host = "localhost";
   private int ControlPort = 1200,DataPort = 1300;    private int ControlPort = 1200,DataPort = 1300;
   private OpenXM oxm;    private OpenXM oxm;
Line 15  class PolyCalc extends Applet implements ActionListene
Line 15  class PolyCalc extends Applet implements ActionListene
   //private Button mul_button,remainder_button,swap_button,set_button;    //private Button mul_button,remainder_button,swap_button,set_button;
   private TextField poly1,poly2;    private TextField poly1,poly2;
   private TextArea textarea;    private TextArea textarea;
     private Thread thread = null;
   private boolean debug = false;    private boolean debug = false;
   //private Text    //private Text
   
Line 104  class PolyCalc extends Applet implements ActionListene
Line 105  class PolyCalc extends Applet implements ActionListene
     c.gridwidth = 1;      c.gridwidth = 1;
     add(poly2);      add(poly2);
   
       button = new Button("grobner base");
       button.addActionListener(this);
       gridbag.setConstraints(button,c);
       add(button);
   
     button = new Button("quit");      button = new Button("quit");
     button.addActionListener(this);      button.addActionListener(this);
     c.gridwidth = GridBagConstraints.REMAINDER;  
     gridbag.setConstraints(button,c);      gridbag.setConstraints(button,c);
     c.gridwidth = 1;  
     add(button);      add(button);
   }    }
   
   public void actionPerformed(ActionEvent e) {    public void run(){ // for debug
     String arg = e.getActionCommand();      try{
         while(true){
           CMO tmp;
   
           Thread.yield();
   
           switch(oxm.receiveOXtag()){
           case OpenXM.OX_COMMAND:
             oxm.receiveSM();
             break;
   
           case OpenXM.OX_DATA:
             tmp = oxm.receiveCMO();
             textarea.append("=> "+ tmp +"\n");
             break;
           }
         }
       }catch(java.io.IOException e){}
     }
   
     public void actionPerformed(ActionEvent evt) {
       String arg = evt.getActionCommand();
   
     debug("press \""+ arg +"\" button.");      debug("press \""+ arg +"\" button.");
   
       if(arg.equals("quit")){
       }else if(arg.equals("grobner base")){
         try{
           debug("poly A: "+ poly1.getText());
           oxm.sendCMO(new CMO_STRING("[[("+ poly1.getText() +") ("+ poly2.getText() +")] (x,y)] gb"));
           oxm.sendSM(new SM(SM.SM_executeStringByLocalParser));
           oxm.sendSM(new SM(SM.SM_popString));
         }catch(java.io.IOException e){}
       }
     /*      /*
       if ("first".equals(arg)) {        if ("first".equals(arg)) {
       ((CardLayout)cards.getLayout()).first(cards);        ((CardLayout)cards.getLayout()).first(cards);
Line 139  class PolyCalc extends Applet implements ActionListene
Line 173  class PolyCalc extends Applet implements ActionListene
     try{      try{
       oxm = new OpenXM(host,ControlPort,DataPort);        oxm = new OpenXM(host,ControlPort,DataPort);
       textarea.append("Connected.\n");        textarea.append("Connected.\n");
         oxm.sendCMO(new CMO_STRING("(cohom.sm1) run ;\n"));
         oxm.sendSM(new SM(SM.SM_executeStringByLocalParser));
   
         thread = new Thread(this);
         thread.start();
     }catch(java.io.IOException e){      }catch(java.io.IOException e){
       textarea.append("failed.\n");        textarea.append("failed.\n");
       stop();        stop();

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.6

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>