Back to index

wims  3.65+svn20090927
Public Member Functions | Static Public Member Functions | Package Attributes | Private Member Functions
MathView Class Reference
Inheritance diagram for MathView:
Inheritance graph
[legend]
Collaboration diagram for MathView:
Collaboration graph
[legend]

List of all members.

Public Member Functions

void setWindow (JFrame frame)
void toggleFont ()
void start ()
void init ()
 MathView ()
void actionPerformed (ActionEvent actionevent)
void itemStateChanged (ItemEvent itemevent)
void textValueChanged (TextEvent textevent)
void windowOpened (WindowEvent windowevent)
void windowIconified (WindowEvent windowevent)
void windowDeiconified (WindowEvent windowevent)
void windowActivated (WindowEvent windowevent)
void windowDeactivated (WindowEvent windowevent)
void windowResized (WindowEvent windowevent)
void windowClosing (WindowEvent windowevent)
void windowClosed (WindowEvent windowevent)
String getLinear ()

Static Public Member Functions

static String replace (String source, String pattern, String replace)
static void main (String args[])

Package Attributes

Jome j
JFrame standaloneWindow
JPanel controlPane
JPanel palette
JPanel paletteCards
CardLayout paletteCardsLayout
Choice paletteChoice
TextArea linearInput
JButton undoButton
JButton redoButton
boolean inAnApplet
String previousLinear
String undoBuffer []
int undoBufferCursor
int undoBufferValidSize
int undoBufferValidSizeMax
Font bigFont
Font defaultFont

Private Member Functions

String removespecial (String t)
String root2sqrtn (String t)
String sqrtn2root (String t)
String filter1 (String s1, int k)
String filter2 (String s)
String readParams (String s)
void reportError (String s)
void addPaletteCard (Choice choice, Container container, String s, Container container1)
JButton addButton (Container container, String s, String s1)
JButton addButton (Container container, String s, String s1, String s2)
void setLinear (String s)
void markUndo ()
void redo ()
void undo ()
void updateUndoRedoButtons ()
void updateJomeView ()

Detailed Description

Definition at line 79 of file MathView.java.


Constructor & Destructor Documentation

MathView.MathView ( ) [inline]

Definition at line 740 of file MathView.java.

    {
        standaloneWindow = null;
        inAnApplet = true;
        previousLinear = null;
        undoBuffer = new String[50];
        undoBufferCursor = 0;
        undoBufferValidSize = 0;
        undoBufferValidSizeMax = 0;
        bigFont = new Font("Helvetica", 0, 32);
        defaultFont = new Font("Helvetica", 0, 18);
    }

Here is the caller graph for this function:


Member Function Documentation

void MathView.actionPerformed ( ActionEvent  actionevent) [inline]

Definition at line 753 of file MathView.java.

    {
        String s = actionevent.getActionCommand();
        if(s.startsWith("append "))
        {
            markUndo();
            linearInput.setText(linearInput.getText() + s.substring("append ".length()));
        } else

        if(s.startsWith("insert "))
        {
            markUndo();
            String s1 = linearInput.getText();
            int i = linearInput.getCaretPosition();
            linearInput.setText(s1.substring(0, i) + s.substring("insert ".length()) + s1.substring(i));
        } else
        if(s.startsWith("enclose "))
        {
            markUndo();
            String s2 = linearInput.getText();
            String s3 = s.substring("append ".length(), s.length() - 1);
            String s4 = s.substring(s.length() - 1);
            int k = linearInput.getSelectionStart();
            int l = linearInput.getSelectionEnd();
            linearInput.setText(s2.substring(0, k) + s3 + linearInput.getSelectedText() + s4 + s2.substring(l));
        } else
        if(s.equals("undo"))
            undo();
        else
        if(s.equals("redo"))
            redo();
        else
        if(s.equals("toggle_font"))
        {
            toggleFont();
        } else
        {
            System.out.println("input: " + s);
            updateJomeView();
        }
    }

Here is the call graph for this function:

JButton MathView.addButton ( Container  container,
String  s,
String  s1 
) [inline, private]

Definition at line 366 of file MathView.java.

    {
        JButton button = new JButton(s);
        button.setActionCommand(s1);
        button.addActionListener(this);
        container.add(button);
        return button;
    }

Here is the caller graph for this function:

JButton MathView.addButton ( Container  container,
String  s,
String  s1,
String  s2 
) [inline, private]

Definition at line 375 of file MathView.java.

    {
        JButton button = new JButton(s);
        button.setActionCommand(s1);
        button.addActionListener(this);
        container.add(button, s2);
        return button;
    }
void MathView.addPaletteCard ( Choice  choice,
Container  container,
String  s,
Container  container1 
) [inline, private]

Definition at line 360 of file MathView.java.

    {
        choice.add(s);
        container.add(container1, s);
    }

Here is the caller graph for this function:

String MathView.filter1 ( String  s1,
int  k 
) [inline, private]

Definition at line 255 of file MathView.java.

                                              {
        int p;String r1;String r2;
       String d1[] = new String[]{"of","et","en","*","cdot","times","div","N","Z","Q","R","\\",
       "f^-1(x)","isin","and","or","notin","-->","=>","inf","->",
       "log[2]","log[3]","log[4]","log[5]","log[6]","log[7]","log[8]","log[9]"};
       
       String d2[] = new String[]{"\u22C1","\u22C0","\u22C0","\u2027","\u2027","X","\u00F7","\u2115","\u2124","\u211A","\u211D","\u2216",
       "f\u00AF\u00B9(x)","\u2208","\u22C0","\u22C1","\u2209","rightarrow","\u21D4","\u221E","\u2192",
       "\u00B2log","\u00B3log","\u2074log","\u2075log","\u2076log","\u2077log","\u2078log","\u2079log"};
       
       String d3[] = new String[]{" or "," and "," and ","*","*","*","/","N","Z","Q","R","\\",
       "f^-1(x)"," isin "," and "," or "," notin "," -> "," -> "," inf "," -> ",
       "log[2]","log[3]","log[4]","log[5]","log[6]","log[7]","log[8]","log[9]"};
       
       int d=d1.length;
       //int e=d1.length;int f=d1.length;if( d!=e || d!=f){System.out.println("ERROR array lengte verschil d= " + d +"\n e= "+ e +"\n f =" +f) ;}
       // d1=applettext from wims
       // d2=unchangable text in math-area from applet
       // d3=the syntax we want to read by javascript: basically spaces/words for readablitity 
       if(k==1){
           // from ascii applettext-param to unicode applet and visa versa
           for ( p=0;p<d;p++){                                                                                                                
              r1=d1[p];                                                                                                                 
              r2=d2[p];                                                                                                                 
              s1=replace(s1,r1,r2);                                                                                                          
           }
           s1=sqrtn2root(s1);
       }
       else
       {
           for ( p=0;p<d;p++){                                                                                                                
              r1=d3[p];                                                                                                                 
              r2=d2[p];                                                                                                                 
              s1=replace(s1,r2,r1);                                                                                                          
           }
       }
        return s1;                                                                                                                         
    }

Here is the call graph for this function:

Here is the caller graph for this function:

String MathView.filter2 ( String  s) [inline, private]

Definition at line 294 of file MathView.java.

                                    {
       String vars=readParams("wimsvars");
       if(vars.length()==0){vars="x";}
       vars=vars.toString();vars=replace(vars,",","");
       StringBuffer S=new StringBuffer(s);int p;int r;char x;char getal;char P1;char P2;char P3;String P4="";
       String nummers="0123456789"+vars;nummers=nummers.toString();int t=vars.length();
       int q=nummers.length();int m;int max=S.length();
       String[] mathopts={"sq","si","co","ta","ab","lo","ln"};int opts=7;String mop="";int a;
       //System.out.println("aantal chars is nu...max = " + max);
       if(max>1){
           for(r=0;r<t;r++){ 
              x=vars.charAt(r);
              for(p=0;p<q;p++){
                  getal=nummers.charAt(p);
                  for(m=0;m<max-2;m++){
                     P1=S.charAt(m);P2=S.charAt(m+1);
                     if(P1==getal && P2==x){
                         S=S.insert(m+1,"*");m=m+2;max++;linearInput.setText(S.toString());
                         //System.out.println("S="+S+" P1= "+P1 +" P2= "+P2 );
                     }
                     else
                     {
                         if(max>3){
                            P3=S.charAt(m+2);
                            if( (P1==' ' && P2==' ' && P3==' ') || (P1==' ' && P2=='e' && P3=='n') || (P1=='e' && P2=='n' && P3==' ') || (P1=='e' && P2=='n' && P3==x) ){
                                S=S.delete(m,m+3);S=S.append(" and ");m=m+3;linearInput.setText(S.toString());
                            }
                            else
                            {
                                if( (P1==' ' && P2=='o' && P3=='f') || (P1=='o' && P2=='f' && P3==' ') || (P1=='o' && P2=='f' && P3==x) ){
                                   S=S.delete(m,m+3);S=S.append(" or ");m=m+2;linearInput.setText(S.toString());
                                }
                                else
                                {
                                   // poormans rawmath for "common function"
                                   if(P1==getal || P1==x ){
                                       P4="" + P2 + P3;
                                       for(a=0;a<opts;a++){
                                          mop=mathopts[a];if(P4.equals(mop)){S=S.insert(m+1,"*");a=opts;m=m+4;linearInput.setText(S.toString());}
                                       }
                                   }
                                }
                            }
                         }
                     }
                     max=S.length();
                  }
              }
           }    
       }
       s=S.toString();
       s=sqrtn2root(s);
       return s;
    }

Here is the call graph for this function:

Here is the caller graph for this function:

String MathView.getLinear ( ) [inline]

Definition at line 848 of file MathView.java.

                             {
       String S=j.getLinear();     int lu;
       String applettext=readParams("helptext");
       if(applettext!=null){
           applettext=filter1(applettext , 1);
           // cut helptext/applettext from the reply string
           int li=applettext.length();
           if(li > 0){
              lu=S.length();
              S=S.substring(li,lu);
           }
       }
       // back to ascii wims/javascript processable syntax
       S=filter1(S, 0);
       S=root2sqrtn(S);
       S=removespecial(S);
       return S;
    }

Here is the call graph for this function:

void MathView.init ( ) [inline]

Definition at line 400 of file MathView.java.

    {
       String special=readParams("my_panel");
       String smallfont=readParams("smallfont");
       String largefont=readParams("largefont");
       String kleur=readParams("bgcolor");
       int font1;int font2;
       /* check op getallen */
       if(smallfont==null){font1=16;}else{font1 = Integer.parseInt(smallfont);}
       if(largefont==null){font2=24;}else{font2 = Integer.parseInt(largefont);}
        bigFont = new Font("Helvetica", 0, font2);defaultFont = new Font("Helvetica", 0, font1);
       Color bgcolor;
       if(kleur!=null){bgcolor=Color.decode(kleur);}else { bgcolor=Color.white; }
        setBackground(bgcolor);
        j = new Jome();
        j.setFont(defaultFont);
        j.setDrawBounds(true);
        //j.setBackground(new Color(0xffffdd));
        j.setBackground(bgcolor);  
        BorderLayout borderlayout = new BorderLayout();
        setLayout(new BorderLayout());
       

        controlPane = new JPanel();
       controlPane.setFont(defaultFont);
        controlPane.setLayout(new BorderLayout());
        palette = new JPanel();
        palette.setLayout(new BorderLayout());
       palette.setFont(defaultFont);
        paletteCards = new JPanel();
        paletteCardsLayout = new CardLayout(5, 4);
        paletteCards.setLayout(paletteCardsLayout);
        paletteChoice = new Choice();
        paletteChoice.addItemListener(this);

       // param name="my_panel" value="title : function1 : function1 : function1 : function1 "
       if(special!=null){
           int maxfun=7;
           String[] results = special.split(":");
           JPanel panel01 = new JPanel();
           panel01.setLayout(new GridLayout());
           int p;
           int pos=results.length;
           String P;
           String PP="";
           String titel=results[0];
           for (p=1;p<pos;p++){
           P=results[p];
           // converting wims-module syntax to panel buttons
           if(P.equals("sqrt()")){PP="\u221A";}
           else
           if(P.equals("sqrt[2]()")){P="sqrt()";PP="<html><sup>2</sup>\u221A</html>";}
           else
           if(P.equals("sqrt[3]()")){PP="<html><sup>3</sup>\u221A</font></html>";}
           else
           if(P.equals("sqrt[4]()")){PP="<html><sup>4</sup>\u221A</html>";}
           else
           if(P.equals("sqrt[5]()")){PP="<html><sup>5</sup>\u221A</html>";}
           else
           if(P.equals("sqrt[6]()")){PP="<html><sup>6</sup>\u221A</html>";}
           else
           if(P.equals("sqrt[7]()")){PP="<html><sup>7</sup>\u221A</html>";}
           else
           if(P.equals("sqrt[8]()")){PP="<html><sup>8</sup>\u221A</html>";}
           else
           if(P.equals("sqrt[9]()")){PP="<html><sup>9</sup>\u221A</html>";}
           else
           if(P.equals("sqrt[n]()")){PP="<html><sup>n</sup>\u221A</html>";}
           else
           if(P.equals("log[2]()")){P="\u00B2log()";PP="<html><sup>2</sup>log</html>";}
           else
           if(P.equals("log[3]()")){P="\u00B3log()";PP="<html><sup>3</sup>log</html>";}
           else
           if(P.equals("log[4]()")){P="\u2074log()";PP="<html><sup>4</sup>log</html>";}
           else
           if(P.equals("log[5]()")){P="\u2075log()";PP="<html><sup>5</sup>log</html>";}
           else
           if(P.equals("log[6]()")){P="\u2076log()";PP="<html><sup>6</sup>log</html>";}
           else
           if(P.equals("log[7]()")){P="\u2077log()";PP="<html><sup>7</sup>log</html>";}
           else
           if(P.equals("log[8]()")){P="\u2078log()";PP="<html><sup>8</sup>log</html>";}
           else
           if(P.equals("log[9]()")){P="\u2079log()";PP="<html><sup>9</sup>log</html>";}
           else
           if(P.equals("isin")){P="\u0020in\u0020" ;PP="\u2208 [isin]";}
           else
           if(P.equals("and")){P="\u0020and\u0020";PP="\u22C0 [and]";}
           else
           if(P.equals("or")){P="\u0020or\u0020";PP="\u22C1 [or]";}
           else
           if(P.equals("pi")){P="\u0020pi\u0020";PP="\u03C0";}    
           else
           if(P.equals("notin")){P="\u0020notin\u0020";PP="\u2209 [notin]";}    
           else
           if(P.equals("->")){P="\u2192";PP="\u2192";}    
           else
           if(P.equals("=>")){P="\u2192";PP=P;}    
           else
           if(P.equals("<=>")){P="\u21E4";PP=P;}    
           else
           if(P.equals("<->")){P="\u21D4";PP=P;}    
           else
           if(P.equals("<->")){P="\u21D4";PP=P;}    
           else
           if(P.equals("langle")){P="\u0020langle\u0020";PP="<";}    
           else
           if(P.equals("rangle")){P="\u0020rangle\u0020";PP=">";}    
           else
           if(P.equals("lbracket")){P="\u0020lbracket\u0020";PP="[";}    
           else
           if(P.equals("rbracket")){P="\u0020rbracket\u0020";PP="]";}    
           else
           if(P.equals("inf")){P="infty";PP="\u221E";}
           else{PP=P;}
           addButton(panel01,PP,"insert "+P);
           }
           addPaletteCard(paletteChoice, paletteCards , titel , panel01);
           palette.add(paletteChoice, "North");
           palette.add(paletteCards, "Center");
           controlPane.add(palette, "Center");
           j.setVisible(true);
           add(j, "Center");
       }

        JPanel panel04 = new JPanel();
        panel04.setLayout(new GridLayout());
        addButton(panel04, "\u22C0 [and]", "insert \u0020and ");
        addButton(panel04, "\u22C1 [or]", "insert \u0020or ");
        addButton(panel04, "\u2208 [in]", "insert \u0020in");
        addButton(panel04, "\u2209 [notin]", "insert \u0020notin");
        addButton(panel04, "\u2192", "insert \u0020\u2192\u0020");    
        addButton(panel04, "\u21D4", "insert \u21D4");
        addButton(panel04, "\u221E [inf]", "insert \u221E");
        addPaletteCard(paletteChoice, paletteCards, "Misc. Symbols", panel04);
        palette.add(paletteChoice, "North");
        palette.add(paletteCards, "Center");
        controlPane.add(palette, "Center");
        j.setVisible(true);
        add(j, "Center");

        JPanel panel05 = new JPanel();
        panel05.setLayout(new GridLayout());
        addButton(panel05, "multiple answers", "insert vlist(answer1,answer2,answer3,answer4)");
        addButton(panel05, "ln", "append ln()");
        addButton(panel05, "|x|", "append |x|");
        addButton(panel05, "f \u00AF\u00B9(x)= [inverse]", "append f\u00AF\u00B9(x)=");
        addPaletteCard(paletteChoice, paletteCards, "Misc.", panel05);
        palette.add(paletteChoice, "North");
        palette.add(paletteCards, "Center");
        controlPane.add(palette, "Center");
        j.setVisible(true);
        add(j, "Center");

        JPanel panel07 = new JPanel();
        panel07.setLayout(new GridLayout());
        addButton(panel07, "log", "append log()");
        addButton(panel07, "<html><sup>2</sup>log</html>", "append \u00B2log()");
        addButton(panel07, "<html><sup>3</sup>log</html>", "append \u00B3log()");
        addButton(panel07, "<html><sup>4</sup>log</html>", "append \u2074log()");
        addButton(panel07, "<html><sup>5</sup>log</html>", "append \u2075log()");
        addButton(panel07, "<html><sup>6</sup>log</html>", "append \u2076log()");
        addButton(panel07, "<html><sup>7</sup>log</html>", "append \u2077log()");
        addButton(panel07, "<html><sup>8</sup>log</html>", "append \u2078log()");
        addButton(panel07, "<html><sup>9</sup>log</html>", "append \u2079log()");
        addPaletteCard(paletteChoice, paletteCards, "Log", panel07);
        palette.add(paletteChoice, "North");
        palette.add(paletteCards, "Center");
        controlPane.add(palette, "Center");
        j.setVisible(true);
        add(j, "Center");

        JPanel panel08 = new JPanel();
        panel08.setLayout(new GridLayout());
        addButton(panel08, "\u221A", "append sqrt()");
        addButton(panel08, "<html><sup>3</sup>\u221A</html>", "append sqrt[3]()");
        addButton(panel08, "<html><sup>4</sup>\u221A</html>", "append sqrt[4]()");
        addButton(panel08, "<html><sup>5</sup>\u221A</html>", "append sqrt[5]()");
        addButton(panel08, "<html><sup>6</sup>\u221A</html>", "append sqrt[6]()");
        addButton(panel08, "<html><sup>7</sup>\u221A</html>", "append sqrt[7]()");
        addButton(panel08, "<html><sup>8</sup>\u221A</html>", "append sqrt[8]()");
        addButton(panel08, "<html><sup>n</sup>\u221A</html>", "append sqrt[n](p)");
        addPaletteCard(paletteChoice, paletteCards, "\u221A", panel08);
        palette.add(paletteChoice, "North");
        palette.add(paletteCards, "Center");
        controlPane.add(palette, "Center");
        j.setVisible(true);
        add(j, "Center");

        JPanel panel09 = new JPanel();
        panel09.setLayout(new GridLayout());
        addButton(panel09, "\u03C0 [pi]", "insert \u0020pi ");
        addButton(panel09, "sin()", "append sin()");
        addButton(panel09, "sin\u00B2()", "append sin()^2");
        addButton(panel09, "cos()", "append cos()");
        addButton(panel09, "cos\u00B2()", "append cos()^2");
        addButton(panel09, "tan()", "append tan()");
        addButton(panel09, "tan\u00B2()", "append tan()^2");
        addPaletteCard(paletteChoice, paletteCards, "Trigonometry", panel09);
        palette.add(paletteChoice, "North");
        palette.add(paletteCards, "Center");
        controlPane.add(palette, "Center");
        j.setVisible(true);
        add(j, "Center");

        JPanel panel10 = new JPanel();
        panel10.setLayout(new GridLayout());
        addButton(panel10, " < : > ", "append \u0020langle\u0020:\u0020rangle");
        addButton(panel10, " [ : > ", "append \u0020lbracket\u0020:\u0020rangle");
        addButton(panel10, " < : ] ", "append \u0020langle\u0020:\u0020rbracket");
        addButton(panel10, " [ : ] ", "append \u0020lbracket\u0020:\u0020rbracket");
        addButton(panel10, "-\u221E [-inf]", "insert -\u221E");
        addButton(panel10, "+\u221E [+inf]", "insert +\u221E");
        addPaletteCard(paletteChoice, paletteCards, "Domains I", panel10);
        palette.add(paletteChoice, "North");
        palette.add(paletteCards, "Center");
        controlPane.add(palette, "Center");
        j.setVisible(true);
        add(j, "Center");

        JPanel panel11 = new JPanel();
        panel11.setLayout(new GridLayout());
        addButton(panel11, "x \u2208 \u2115 \u2216 \u007B a \u003B b \u007D", "insert x\u2208\u2115\u0020\u2216\u0020\u007Ba:b:c\u007D");
        addButton(panel11, "x \u2208 \u2124 \u2216 \u007B a \u003B b \u007D", "insert x\u2208\u2124\u0020\u2216\u0020\u007Ba:b:c\u007D");
        addButton(panel11, "x \u2208 \u211A \u2216 \u007B a \u003B b \u007D", "insert x\u2208\u211A\u0020\u2216\u0020\u007Ba:b:c\u007D");
        addButton(panel11, "x \u2208 \u211D \u2216 \u007B a \u003B b \u007D", "insert x\u2208\u211D\u0020\u2216\u0020\u007Ba:b:c\u007D");
        addPaletteCard(paletteChoice, paletteCards, "Domains II", panel11);
        palette.add(paletteChoice, "North");
        palette.add(paletteCards, "Center");
        controlPane.add(palette, "Center");
        j.setVisible(true);
        add(j, "Center");
        
       JPanel panel2 = new JPanel();
        panel2.setLayout(new BorderLayout());

       JPanel panel4 = new JPanel();
        panel2.add(panel4, "South");
        reportError("OK");
        JPanel panel3 = new JPanel();
        panel2.add(panel3, "West");
       undoButton = addButton(panel3, "\u21A9", "undo");
        redoButton = null;
        addButton(panel3, "\261", "toggle_font", "Center");
        controlPane.add(panel2, "South");
        linearInput = new TextArea("",1,1,TextArea.SCROLLBARS_NONE);
        linearInput.addTextListener(this);
        linearInput.setFont(bigFont);
       linearInput.setBackground(Color.white);
        controlPane.add(linearInput, "North");
        add(controlPane, "South");
        setVisible(true);
        setLinear("");
        linearInput.requestFocus();
    }

Here is the call graph for this function:

Here is the caller graph for this function:

void MathView.itemStateChanged ( ItemEvent  itemevent) [inline]

Definition at line 795 of file MathView.java.

    {

        paletteCardsLayout.show(paletteCards, (String)itemevent.getItem());
        linearInput.requestFocus();
    }
static void MathView.main ( String  args[]) [inline, static]

Definition at line 130 of file MathView.java.

    {
        MathView mathview = new MathView();
        JFrame frame = new JFrame();
        mathview.setWindow(frame);
        frame.add(mathview);
        frame.setTitle("WIMS JAVA INPUT");
        frame.addWindowListener(mathview);
        mathview.init();
        frame.pack();
        frame.setSize(640,480);
        frame.setVisible(true);
        frame.validate();
        mathview.start();
        mathview.repaint();


    }

Here is the call graph for this function:

void MathView.markUndo ( ) [inline, private]

Definition at line 663 of file MathView.java.

Here is the call graph for this function:

Here is the caller graph for this function:

String MathView.readParams ( String  s) [inline, private]

Definition at line 349 of file MathView.java.

                                       {
       String c=getParameter(s);
       return c;
    }

Here is the caller graph for this function:

void MathView.redo ( ) [inline, private]

Definition at line 683 of file MathView.java.

Here is the call graph for this function:

Here is the caller graph for this function:

String MathView.removespecial ( String  t) [inline, private]

vlist(1,2,3,4) and restanswer -> 1 and 2 and 3 and 4 and restanswer

Definition at line 149 of file MathView.java.

                                          {
       int begin=t.indexOf("vlist(");
       if(begin==-1){return t;}
       String org=t;
       int t1;int t2;int tot;int Got;int Wait;int End;char chr;int s;
       String value;String exp;String val;String L;String R;int cnt=0;
       while (begin >= 0){
           cnt++;if(cnt>1000){return org+" vlist(a,b) syntax error" ;}
           tot=t.length();Wait=0;Got=0;End=0;
           for(s=begin+5;s<tot;s++){
              if(End==0){
                  chr=t.charAt(s);
                  if(chr=='('){Wait=Wait+1;}
                  if(chr==')'){Got=Got+1;}
                  if(Got!=0){if(Wait==Got){End=s;}}
              }
           }
           value=t.substring(begin+6,End);
           t1=value.indexOf(",");if(t1<0){return org+" syntax error: comma missing\nvlist(a,b,c,d)";}
           t2=value.length();
           val=value.substring(0,t2);
           if(val.indexOf("vlist(")!=-1){return org + "error :vlist within vlist";}
           L="vlist("+val+")";R=val;
           t=replace(t,L,R);
           //System.out.println("val= " + val +" L= "+L);
           begin=t.indexOf("vlist(");
       }
       t=replace(t,","," and ");
       return t;
    }

Here is the call graph for this function:

Here is the caller graph for this function:

static String MathView.replace ( String  source,
String  pattern,
String  replace 
) [inline, static]

Definition at line 84 of file MathView.java.

    {
           if (source!=null)
           {
              final int len = pattern.length();
              StringBuffer sb = new StringBuffer();
              int found = -1;
              int start = 0;
              while( (found = source.indexOf(pattern, start) ) != -1) {
                  sb.append(source.substring(start, found));
                  sb.append(replace);
                  start = found + len;
              }
           sb.append(source.substring(start));
           return sb.toString();
           }
        else return "";
    }

Here is the call graph for this function:

Here is the caller graph for this function:

void MathView.reportError ( String  s) [inline, private]

Definition at line 354 of file MathView.java.

    {
        if(!inAnApplet)
            System.err.println(s);
    }

Here is the caller graph for this function:

String MathView.root2sqrtn ( String  t) [inline, private]

Definition at line 182 of file MathView.java.

                                       {
       int begin=t.indexOf("root(");
       if(begin==-1){return t;}
       String org=t;
       int t1;int t2;int tot;int Got;int Wait;int End;char chr;int s;
       String value;String exp;String val;String L;String R;int cnt=0;
       while (begin >= 0){
           cnt++;if(cnt>1000){return org+" root(a,b) syntax error" ;}
           tot=t.length();Wait=0;Got=0;End=0;
           for(s=begin+4;s<tot;s++){
              if(End==0){
                  chr=t.charAt(s);
                  if(chr=='('){Wait=Wait+1;}
                  if(chr==')'){Got=Got+1;}
                  if(Got!=0){if(Wait==Got){End=s;}}
              }
           }
           value=t.substring(begin+5,End);
           t1=value.indexOf(",");if(t1<0){return org+" syntax error: comma missing\nroot(a,b)";}
           t2=value.length();
           val=value.substring(0,t1);exp=value.substring(t1+1,t2);
           if(val.indexOf("root(")!=-1){return org + "error : absurd root-syntax";}
           if(exp.indexOf("root(")!=-1){return org + "error : absurd root-syntax";}
           L="root("+val+","+exp+")";R="sqrt["+exp+"]#"+val+"@";
           t=replace(t,L,R);
           //System.out.println("val= " + val + "  exp=  "+ exp+ "  L= "+L+"  R= "+R);
           begin=t.indexOf("root(");
       }
       t=t.replace('#','(');
       t=t.replace('@',')');
       return t;
    }

Here is the call graph for this function:

Here is the caller graph for this function:

void MathView.setLinear ( String  s) [inline, private]

Definition at line 656 of file MathView.java.

    {
        markUndo();         
       linearInput.setText(s);
        updateJomeView();
    }

Here is the call graph for this function:

Here is the caller graph for this function:

void MathView.setWindow ( JFrame  frame) [inline]

Definition at line 103 of file MathView.java.

    {
        standaloneWindow = frame;
        inAnApplet = false;
    }

Here is the caller graph for this function:

String MathView.sqrtn2root ( String  t) [inline, private]

Definition at line 215 of file MathView.java.

                                       {
       int begin=t.indexOf("sqrt[");
       if(begin==-1){return t;}
       String org=t;
       int tot;int Got;int Wait;int End;char chr;int s;int restart;
       String value;String exp;String val;String L;String R;int cnt=0;
       while (begin >= 0){
           cnt++;if(cnt>1000){return org+"sqrt[]() syntax error" ;}
           tot=t.length();Wait=0;Got=0;End=0;
           for(s=begin+4;s<tot;s++){
              if(End==0){
                  chr=t.charAt(s);
                  if(chr=='['){Wait=Wait+1;}
                  if(chr==']'){Got=Got+1;}
                  if(Got!=0){if(Wait==Got){End=s;}}
              }
           }
           restart=End;    
           exp=t.substring(begin+5,End);
           Wait=0;Got=0;End=0;
           for(s=restart;s<tot;s++){
              if(End==0){
                  chr=t.charAt(s);
                  if(chr=='('){Wait=Wait+1;}
                  if(chr==')'){Got=Got+1;}
                  if(Got!=0){if(Wait==Got){End=s;}}
              }
           }
           val=t.substring(restart+2,End);
           R="root#"+val+","+exp+"@";L="sqrt["+exp+"]("+val+")";
           t=replace(t,L,R);
           //System.out.println("val= " + val + "  exp=  "+ exp+ "  L= "+L+"  R= "+R);
           begin=t.indexOf("sqrt[");
       }
       t=t.replace('#','(');
       t=t.replace('@',')');
       return t;
    }

Here is the call graph for this function:

Here is the caller graph for this function:

void MathView.start ( ) [inline]

Definition at line 384 of file MathView.java.

    {
        linearInput.setFont(defaultFont);
        linearInput.invalidate();
        j.invalidate();
        repaint();
        linearInput.requestFocus();
       // echoing the WIMS rejected answer in the inputarea...what kindness of the heart ;)
       String oldreply=readParams("oldreply");
       if(oldreply.length()!=0){
           oldreply=replace(oldreply," ","");
           oldreply=filter1(oldreply,1);
           linearInput.setText(oldreply.toString());
       }
    }

Here is the call graph for this function:

Here is the caller graph for this function:

void MathView.textValueChanged ( TextEvent  textevent) [inline]

Definition at line 802 of file MathView.java.

Here is the call graph for this function:

void MathView.toggleFont ( ) [inline]

Definition at line 109 of file MathView.java.

    {
        Jome jome = j;
        if(jome.getFont() == bigFont)
        {
            jome.setFont(defaultFont);
            linearInput.setFont(defaultFont);
        } else
        {
            jome.setFont(bigFont);
            linearInput.setFont(bigFont);
        }
        invalidate();
        jome.invalidate();
        linearInput.invalidate();
        linearInput.requestFocus();
        repaint();
        jome.repaint();
        linearInput.repaint();
    }

Here is the call graph for this function:

Here is the caller graph for this function:

void MathView.undo ( ) [inline, private]

Definition at line 697 of file MathView.java.

Here is the call graph for this function:

Here is the caller graph for this function:

void MathView.updateJomeView ( ) [inline, private]

Definition at line 727 of file MathView.java.

    {
       String s=linearInput.getText().toString();
       s=filter2(s);
       String applettext=readParams("helptext");
       if(applettext!=null){
           applettext=filter1(applettext,1);
           s=applettext+s;
           s=s.toString();
       }
        j.setLinear(s);
    }

Here is the call graph for this function:

Here is the caller graph for this function:

void MathView.updateUndoRedoButtons ( ) [inline, private]

Definition at line 721 of file MathView.java.

Here is the caller graph for this function:

void MathView.windowActivated ( WindowEvent  windowevent) [inline]

Definition at line 819 of file MathView.java.

    {
    }
void MathView.windowClosed ( WindowEvent  windowevent) [inline]

Definition at line 843 of file MathView.java.

    {
        System.exit(0);
    }
void MathView.windowClosing ( WindowEvent  windowevent) [inline]

Definition at line 831 of file MathView.java.

    {
        stop();
       destroy();
        if(!inAnApplet)
        {
            standaloneWindow.setVisible(false);
            standaloneWindow.dispose();
        }
    }
void MathView.windowDeactivated ( WindowEvent  windowevent) [inline]

Definition at line 823 of file MathView.java.

    {
    }
void MathView.windowDeiconified ( WindowEvent  windowevent) [inline]

Definition at line 815 of file MathView.java.

    {
    }
void MathView.windowIconified ( WindowEvent  windowevent) [inline]

Definition at line 811 of file MathView.java.

    {
    }
void MathView.windowOpened ( WindowEvent  windowevent) [inline]

Definition at line 807 of file MathView.java.

    {
    }
void MathView.windowResized ( WindowEvent  windowevent) [inline]

Definition at line 827 of file MathView.java.

    {
    }

Member Data Documentation

Font MathView.bigFont [package]

Definition at line 884 of file MathView.java.

JPanel MathView.controlPane [package]

Definition at line 869 of file MathView.java.

Font MathView.defaultFont [package]

Definition at line 885 of file MathView.java.

Definition at line 878 of file MathView.java.

Jome MathView.j [package]

Definition at line 867 of file MathView.java.

TextArea MathView.linearInput [package]

Definition at line 874 of file MathView.java.

JPanel MathView.palette [package]

Definition at line 870 of file MathView.java.

JPanel MathView.paletteCards [package]

Definition at line 871 of file MathView.java.

CardLayout MathView.paletteCardsLayout [package]

Definition at line 872 of file MathView.java.

Choice MathView.paletteChoice [package]

Definition at line 873 of file MathView.java.

String MathView.previousLinear [package]

Definition at line 879 of file MathView.java.

JButton MathView.redoButton [package]

Definition at line 877 of file MathView.java.

JFrame MathView.standaloneWindow [package]

Definition at line 868 of file MathView.java.

String MathView.undoBuffer[] [package]

Definition at line 880 of file MathView.java.

Definition at line 881 of file MathView.java.

Definition at line 882 of file MathView.java.

Definition at line 883 of file MathView.java.

JButton MathView.undoButton [package]

Definition at line 876 of file MathView.java.


The documentation for this class was generated from the following file: