[Mathlib-commitlog] SF.net SVN: mathlib:[910] JMathLib/trunk/src/jmathlib/toolbox/jmathlib/ui
Status: Beta
Brought to you by:
st_mueller
|
From: <st_...@us...> - 2009-03-26 20:42:03
|
Revision: 910
http://mathlib.svn.sourceforge.net/mathlib/?rev=910&view=rev
Author: st_mueller
Date: 2009-03-26 20:41:53 +0000 (Thu, 26 Mar 2009)
Log Message:
-----------
just some blank functions. Nothing really useful inside.
Added Paths:
-----------
JMathLib/trunk/src/jmathlib/toolbox/jmathlib/ui/errordlg.java
JMathLib/trunk/src/jmathlib/toolbox/jmathlib/ui/helpdlg.java
JMathLib/trunk/src/jmathlib/toolbox/jmathlib/ui/inputdlg.java
JMathLib/trunk/src/jmathlib/toolbox/jmathlib/ui/msgbox.java
JMathLib/trunk/src/jmathlib/toolbox/jmathlib/ui/warndlg.java
Added: JMathLib/trunk/src/jmathlib/toolbox/jmathlib/ui/errordlg.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/jmathlib/ui/errordlg.java (rev 0)
+++ JMathLib/trunk/src/jmathlib/toolbox/jmathlib/ui/errordlg.java 2009-03-26 20:41:53 UTC (rev 910)
@@ -0,0 +1,125 @@
+package jmathlib.toolbox.jmathlib.ui;
+
+import jmathlib.core.tokens.numbertokens.DoubleNumberToken;
+import jmathlib.core.tokens.Token;
+import jmathlib.core.tokens.OperandToken;
+import jmathlib.core.functions.ExternalFunction;
+import jmathlib.core.interpreter.GlobalValues;
+
+import java.awt.*;
+import java.awt.event.*;
+
+
+public class errordlg extends ExternalFunction
+{
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
+ {
+
+ // exactly one operand
+ if (getNArgIn(operands) != 1)
+ throwMathLibException("fix: number of arguments != 1");
+
+ // only works on numbers
+ if(!(operands[0] instanceof DoubleNumberToken))
+ throwMathLibException("fix: only works on numbers");
+
+ Frame f = new Frame();
+ ModalDialog m = new ModalDialog(f,"kk","What do you want?",new String[]{"ok","not ok","maybe"});
+
+
+ //f.show();
+ m.show();
+
+ debugLine("questdlg: "+m.str);
+
+ DoubleNumberToken matrix = ((DoubleNumberToken)operands[0]);
+ OperandToken temp = ((OperandToken)matrix.clone());
+
+ double[][] reValues = matrix.getValuesRe();
+ double[][] imValues = matrix.getValuesIm();
+ for(int y = 0; y < matrix.getSizeY(); y++)
+ {
+ for(int x = 0; x < matrix.getSizeX(); x++)
+ {
+ if(reValues[y][x] >=0 )
+ {
+ // e.g. fix(3.2) => 3
+ reValues[y][x] = java.lang.Math.floor(reValues[y][x]);
+ }
+ else
+ {
+ // e.g. fix(-3.2) => -3
+ reValues[y][x] = java.lang.Math.ceil(reValues[y][x]);
+ }
+ if(imValues[y][x] >=0 )
+ {
+ // e.g. fix(3.2i) => 3
+ imValues[y][x] = java.lang.Math.floor(imValues[y][x]);
+ }
+ else
+ {
+ // e.g. fix(-3.2i) => -3
+ imValues[y][x] = java.lang.Math.ceil(imValues[y][x]);
+ }
+ }
+ }
+ return new DoubleNumberToken(reValues, imValues);
+
+ }
+
+ class ModalDialog extends Dialog implements ActionListener
+ {
+ public String str = "XX";
+
+ public ModalDialog(Frame owner, String title, String msg, String[] buttons)
+ {
+ super(owner, title, true);
+
+ setBackground(Color.lightGray);
+ setLayout(new BorderLayout());
+ setResizable(false);
+ add(new Label(msg), BorderLayout.CENTER);
+
+ Panel panel = new Panel();
+ panel.setLayout(new FlowLayout(FlowLayout.CENTER));
+
+ for (int i=0; i<buttons.length; i++)
+ {
+ Button button = new Button(buttons[i]);
+ button.addActionListener(this);
+ panel.add(button);
+ }
+
+
+ add(panel, BorderLayout.SOUTH);
+ pack();
+
+
+ }
+
+ public void actionPerformed(ActionEvent event)
+ {
+ str = event.getActionCommand();
+ setVisible(false);
+ dispose();
+ }
+
+ }
+}
+
+/*
+@GROUP
+ui
+@SYNTAX
+button = questdlg(question, title, button1, button2, options);
+@DOC
+Rounds the element to the nearest element towards zero.
+@EXAMPLES
+<programlisting>
+button = questdlg("do you like JMathLib","What about JMathLib","yes","even mor","yes");
+</programlisting>
+@NOTES
+@SEE
+
+**/
+
Added: JMathLib/trunk/src/jmathlib/toolbox/jmathlib/ui/helpdlg.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/jmathlib/ui/helpdlg.java (rev 0)
+++ JMathLib/trunk/src/jmathlib/toolbox/jmathlib/ui/helpdlg.java 2009-03-26 20:41:53 UTC (rev 910)
@@ -0,0 +1,125 @@
+package jmathlib.toolbox.jmathlib.ui;
+
+import jmathlib.core.tokens.numbertokens.DoubleNumberToken;
+import jmathlib.core.tokens.Token;
+import jmathlib.core.tokens.OperandToken;
+import jmathlib.core.functions.ExternalFunction;
+import jmathlib.core.interpreter.GlobalValues;
+
+import java.awt.*;
+import java.awt.event.*;
+
+
+public class helpdlg extends ExternalFunction
+{
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
+ {
+
+ // exactly one operand
+ if (getNArgIn(operands) != 1)
+ throwMathLibException("fix: number of arguments != 1");
+
+ // only works on numbers
+ if(!(operands[0] instanceof DoubleNumberToken))
+ throwMathLibException("fix: only works on numbers");
+
+ Frame f = new Frame();
+ ModalDialog m = new ModalDialog(f,"kk","What do you want?",new String[]{"ok","not ok","maybe"});
+
+
+ //f.show();
+ m.show();
+
+ debugLine("questdlg: "+m.str);
+
+ DoubleNumberToken matrix = ((DoubleNumberToken)operands[0]);
+ OperandToken temp = ((OperandToken)matrix.clone());
+
+ double[][] reValues = matrix.getValuesRe();
+ double[][] imValues = matrix.getValuesIm();
+ for(int y = 0; y < matrix.getSizeY(); y++)
+ {
+ for(int x = 0; x < matrix.getSizeX(); x++)
+ {
+ if(reValues[y][x] >=0 )
+ {
+ // e.g. fix(3.2) => 3
+ reValues[y][x] = java.lang.Math.floor(reValues[y][x]);
+ }
+ else
+ {
+ // e.g. fix(-3.2) => -3
+ reValues[y][x] = java.lang.Math.ceil(reValues[y][x]);
+ }
+ if(imValues[y][x] >=0 )
+ {
+ // e.g. fix(3.2i) => 3
+ imValues[y][x] = java.lang.Math.floor(imValues[y][x]);
+ }
+ else
+ {
+ // e.g. fix(-3.2i) => -3
+ imValues[y][x] = java.lang.Math.ceil(imValues[y][x]);
+ }
+ }
+ }
+ return new DoubleNumberToken(reValues, imValues);
+
+ }
+
+ class ModalDialog extends Dialog implements ActionListener
+ {
+ public String str = "XX";
+
+ public ModalDialog(Frame owner, String title, String msg, String[] buttons)
+ {
+ super(owner, title, true);
+
+ setBackground(Color.lightGray);
+ setLayout(new BorderLayout());
+ setResizable(false);
+ add(new Label(msg), BorderLayout.CENTER);
+
+ Panel panel = new Panel();
+ panel.setLayout(new FlowLayout(FlowLayout.CENTER));
+
+ for (int i=0; i<buttons.length; i++)
+ {
+ Button button = new Button(buttons[i]);
+ button.addActionListener(this);
+ panel.add(button);
+ }
+
+
+ add(panel, BorderLayout.SOUTH);
+ pack();
+
+
+ }
+
+ public void actionPerformed(ActionEvent event)
+ {
+ str = event.getActionCommand();
+ setVisible(false);
+ dispose();
+ }
+
+ }
+}
+
+/*
+@GROUP
+ui
+@SYNTAX
+button = questdlg(question, title, button1, button2, options);
+@DOC
+Rounds the element to the nearest element towards zero.
+@EXAMPLES
+<programlisting>
+button = questdlg("do you like JMathLib","What about JMathLib","yes","even mor","yes");
+</programlisting>
+@NOTES
+@SEE
+
+**/
+
Added: JMathLib/trunk/src/jmathlib/toolbox/jmathlib/ui/inputdlg.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/jmathlib/ui/inputdlg.java (rev 0)
+++ JMathLib/trunk/src/jmathlib/toolbox/jmathlib/ui/inputdlg.java 2009-03-26 20:41:53 UTC (rev 910)
@@ -0,0 +1,125 @@
+package jmathlib.toolbox.jmathlib.ui;
+
+import jmathlib.core.tokens.numbertokens.DoubleNumberToken;
+import jmathlib.core.tokens.Token;
+import jmathlib.core.tokens.OperandToken;
+import jmathlib.core.functions.ExternalFunction;
+import jmathlib.core.interpreter.GlobalValues;
+
+import java.awt.*;
+import java.awt.event.*;
+
+
+public class inputdlg extends ExternalFunction
+{
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
+ {
+
+ // exactly one operand
+ if (getNArgIn(operands) != 1)
+ throwMathLibException("fix: number of arguments != 1");
+
+ // only works on numbers
+ if(!(operands[0] instanceof DoubleNumberToken))
+ throwMathLibException("fix: only works on numbers");
+
+ Frame f = new Frame();
+ ModalDialog m = new ModalDialog(f,"kk","What do you want?",new String[]{"ok","not ok","maybe"});
+
+
+ //f.show();
+ m.show();
+
+ debugLine("questdlg: "+m.str);
+
+ DoubleNumberToken matrix = ((DoubleNumberToken)operands[0]);
+ OperandToken temp = ((OperandToken)matrix.clone());
+
+ double[][] reValues = matrix.getValuesRe();
+ double[][] imValues = matrix.getValuesIm();
+ for(int y = 0; y < matrix.getSizeY(); y++)
+ {
+ for(int x = 0; x < matrix.getSizeX(); x++)
+ {
+ if(reValues[y][x] >=0 )
+ {
+ // e.g. fix(3.2) => 3
+ reValues[y][x] = java.lang.Math.floor(reValues[y][x]);
+ }
+ else
+ {
+ // e.g. fix(-3.2) => -3
+ reValues[y][x] = java.lang.Math.ceil(reValues[y][x]);
+ }
+ if(imValues[y][x] >=0 )
+ {
+ // e.g. fix(3.2i) => 3
+ imValues[y][x] = java.lang.Math.floor(imValues[y][x]);
+ }
+ else
+ {
+ // e.g. fix(-3.2i) => -3
+ imValues[y][x] = java.lang.Math.ceil(imValues[y][x]);
+ }
+ }
+ }
+ return new DoubleNumberToken(reValues, imValues);
+
+ }
+
+ class ModalDialog extends Dialog implements ActionListener
+ {
+ public String str = "XX";
+
+ public ModalDialog(Frame owner, String title, String msg, String[] buttons)
+ {
+ super(owner, title, true);
+
+ setBackground(Color.lightGray);
+ setLayout(new BorderLayout());
+ setResizable(false);
+ add(new Label(msg), BorderLayout.CENTER);
+
+ Panel panel = new Panel();
+ panel.setLayout(new FlowLayout(FlowLayout.CENTER));
+
+ for (int i=0; i<buttons.length; i++)
+ {
+ Button button = new Button(buttons[i]);
+ button.addActionListener(this);
+ panel.add(button);
+ }
+
+
+ add(panel, BorderLayout.SOUTH);
+ pack();
+
+
+ }
+
+ public void actionPerformed(ActionEvent event)
+ {
+ str = event.getActionCommand();
+ setVisible(false);
+ dispose();
+ }
+
+ }
+}
+
+/*
+@GROUP
+ui
+@SYNTAX
+button = questdlg(question, title, button1, button2, options);
+@DOC
+Rounds the element to the nearest element towards zero.
+@EXAMPLES
+<programlisting>
+button = questdlg("do you like JMathLib","What about JMathLib","yes","even mor","yes");
+</programlisting>
+@NOTES
+@SEE
+
+**/
+
Added: JMathLib/trunk/src/jmathlib/toolbox/jmathlib/ui/msgbox.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/jmathlib/ui/msgbox.java (rev 0)
+++ JMathLib/trunk/src/jmathlib/toolbox/jmathlib/ui/msgbox.java 2009-03-26 20:41:53 UTC (rev 910)
@@ -0,0 +1,125 @@
+package jmathlib.toolbox.jmathlib.ui;
+
+import jmathlib.core.tokens.numbertokens.DoubleNumberToken;
+import jmathlib.core.tokens.Token;
+import jmathlib.core.tokens.OperandToken;
+import jmathlib.core.functions.ExternalFunction;
+import jmathlib.core.interpreter.GlobalValues;
+
+import java.awt.*;
+import java.awt.event.*;
+
+
+public class msgbox extends ExternalFunction
+{
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
+ {
+
+ // exactly one operand
+ if (getNArgIn(operands) != 1)
+ throwMathLibException("fix: number of arguments != 1");
+
+ // only works on numbers
+ if(!(operands[0] instanceof DoubleNumberToken))
+ throwMathLibException("fix: only works on numbers");
+
+ Frame f = new Frame();
+ ModalDialog m = new ModalDialog(f,"kk","What do you want?",new String[]{"ok","not ok","maybe"});
+
+
+ //f.show();
+ m.show();
+
+ debugLine("questdlg: "+m.str);
+
+ DoubleNumberToken matrix = ((DoubleNumberToken)operands[0]);
+ OperandToken temp = ((OperandToken)matrix.clone());
+
+ double[][] reValues = matrix.getValuesRe();
+ double[][] imValues = matrix.getValuesIm();
+ for(int y = 0; y < matrix.getSizeY(); y++)
+ {
+ for(int x = 0; x < matrix.getSizeX(); x++)
+ {
+ if(reValues[y][x] >=0 )
+ {
+ // e.g. fix(3.2) => 3
+ reValues[y][x] = java.lang.Math.floor(reValues[y][x]);
+ }
+ else
+ {
+ // e.g. fix(-3.2) => -3
+ reValues[y][x] = java.lang.Math.ceil(reValues[y][x]);
+ }
+ if(imValues[y][x] >=0 )
+ {
+ // e.g. fix(3.2i) => 3
+ imValues[y][x] = java.lang.Math.floor(imValues[y][x]);
+ }
+ else
+ {
+ // e.g. fix(-3.2i) => -3
+ imValues[y][x] = java.lang.Math.ceil(imValues[y][x]);
+ }
+ }
+ }
+ return new DoubleNumberToken(reValues, imValues);
+
+ }
+
+ class ModalDialog extends Dialog implements ActionListener
+ {
+ public String str = "XX";
+
+ public ModalDialog(Frame owner, String title, String msg, String[] buttons)
+ {
+ super(owner, title, true);
+
+ setBackground(Color.lightGray);
+ setLayout(new BorderLayout());
+ setResizable(false);
+ add(new Label(msg), BorderLayout.CENTER);
+
+ Panel panel = new Panel();
+ panel.setLayout(new FlowLayout(FlowLayout.CENTER));
+
+ for (int i=0; i<buttons.length; i++)
+ {
+ Button button = new Button(buttons[i]);
+ button.addActionListener(this);
+ panel.add(button);
+ }
+
+
+ add(panel, BorderLayout.SOUTH);
+ pack();
+
+
+ }
+
+ public void actionPerformed(ActionEvent event)
+ {
+ str = event.getActionCommand();
+ setVisible(false);
+ dispose();
+ }
+
+ }
+}
+
+/*
+@GROUP
+ui
+@SYNTAX
+button = questdlg(question, title, button1, button2, options);
+@DOC
+Rounds the element to the nearest element towards zero.
+@EXAMPLES
+<programlisting>
+button = questdlg("do you like JMathLib","What about JMathLib","yes","even mor","yes");
+</programlisting>
+@NOTES
+@SEE
+
+**/
+
Added: JMathLib/trunk/src/jmathlib/toolbox/jmathlib/ui/warndlg.java
===================================================================
--- JMathLib/trunk/src/jmathlib/toolbox/jmathlib/ui/warndlg.java (rev 0)
+++ JMathLib/trunk/src/jmathlib/toolbox/jmathlib/ui/warndlg.java 2009-03-26 20:41:53 UTC (rev 910)
@@ -0,0 +1,125 @@
+package jmathlib.toolbox.jmathlib.ui;
+
+import jmathlib.core.tokens.numbertokens.DoubleNumberToken;
+import jmathlib.core.tokens.Token;
+import jmathlib.core.tokens.OperandToken;
+import jmathlib.core.functions.ExternalFunction;
+import jmathlib.core.interpreter.GlobalValues;
+
+import java.awt.*;
+import java.awt.event.*;
+
+
+public class warndlg extends ExternalFunction
+{
+ public OperandToken evaluate(Token[] operands, GlobalValues globals)
+ {
+
+ // exactly one operand
+ if (getNArgIn(operands) != 1)
+ throwMathLibException("fix: number of arguments != 1");
+
+ // only works on numbers
+ if(!(operands[0] instanceof DoubleNumberToken))
+ throwMathLibException("fix: only works on numbers");
+
+ Frame f = new Frame();
+ ModalDialog m = new ModalDialog(f,"kk","What do you want?",new String[]{"ok","not ok","maybe"});
+
+
+ //f.show();
+ m.show();
+
+ debugLine("questdlg: "+m.str);
+
+ DoubleNumberToken matrix = ((DoubleNumberToken)operands[0]);
+ OperandToken temp = ((OperandToken)matrix.clone());
+
+ double[][] reValues = matrix.getValuesRe();
+ double[][] imValues = matrix.getValuesIm();
+ for(int y = 0; y < matrix.getSizeY(); y++)
+ {
+ for(int x = 0; x < matrix.getSizeX(); x++)
+ {
+ if(reValues[y][x] >=0 )
+ {
+ // e.g. fix(3.2) => 3
+ reValues[y][x] = java.lang.Math.floor(reValues[y][x]);
+ }
+ else
+ {
+ // e.g. fix(-3.2) => -3
+ reValues[y][x] = java.lang.Math.ceil(reValues[y][x]);
+ }
+ if(imValues[y][x] >=0 )
+ {
+ // e.g. fix(3.2i) => 3
+ imValues[y][x] = java.lang.Math.floor(imValues[y][x]);
+ }
+ else
+ {
+ // e.g. fix(-3.2i) => -3
+ imValues[y][x] = java.lang.Math.ceil(imValues[y][x]);
+ }
+ }
+ }
+ return new DoubleNumberToken(reValues, imValues);
+
+ }
+
+ class ModalDialog extends Dialog implements ActionListener
+ {
+ public String str = "XX";
+
+ public ModalDialog(Frame owner, String title, String msg, String[] buttons)
+ {
+ super(owner, title, true);
+
+ setBackground(Color.lightGray);
+ setLayout(new BorderLayout());
+ setResizable(false);
+ add(new Label(msg), BorderLayout.CENTER);
+
+ Panel panel = new Panel();
+ panel.setLayout(new FlowLayout(FlowLayout.CENTER));
+
+ for (int i=0; i<buttons.length; i++)
+ {
+ Button button = new Button(buttons[i]);
+ button.addActionListener(this);
+ panel.add(button);
+ }
+
+
+ add(panel, BorderLayout.SOUTH);
+ pack();
+
+
+ }
+
+ public void actionPerformed(ActionEvent event)
+ {
+ str = event.getActionCommand();
+ setVisible(false);
+ dispose();
+ }
+
+ }
+}
+
+/*
+@GROUP
+ui
+@SYNTAX
+button = questdlg(question, title, button1, button2, options);
+@DOC
+Rounds the element to the nearest element towards zero.
+@EXAMPLES
+<programlisting>
+button = questdlg("do you like JMathLib","What about JMathLib","yes","even mor","yes");
+</programlisting>
+@NOTES
+@SEE
+
+**/
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|